You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2019/08/16 11:25:34 UTC

[GitHub] [incubator-weex] PorterLuo opened a new issue #2833: [Android] Android SDK 自定义WXComponent, 有多个属性使用@WXComponentProp 定义,我要怎么知道什么时候所有属性都从JS传到native这边呢?

PorterLuo opened a new issue #2833: [Android] Android SDK 自定义WXComponent, 有多个属性使用@WXComponentProp  定义,我要怎么知道什么时候所有属性都从JS传到native这边呢? 
URL: https://github.com/apache/incubator-weex/issues/2833
 
 
   weex Android SDK 自定义WXComponent, 有多个属性使用@WXComponentProp
   
   定义,我要怎么知道什么时候所有属性都从JS传到native这边呢? 我第二个属性需要依赖第一个属性传过来了
   自定义WXComponent代码如下
   
   public class WeexLottieAnimationView extends WXComponent<LottieAnimationView> {
       public Context mContext;
       private LottieTask<LottieComposition> mLottieResult;
       private boolean mLoop;
       public WeexLottieAnimationView(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) {
           super(instance, parent, basicComponentData);
           mContext = instance.getContext();
       }
   
       @Override
       protected LottieAnimationView initComponentHostView(@NonNull Context context) {
           LottieAnimationView animationView = new LottieAnimationView(context);
           return animationView;
       }
   
       @WXComponentProp(name = "url")
       public void getUrl(String url) {
           mLottieResult = LottieCompositionFactory.fromUrl(mContext, url);
           mLottieResult.addListener(new LottieListener<LottieComposition>() {
               @Override
               public void onResult(LottieComposition result) {
                   getHostView().setComposition(result);
                   if (mLoop) {
                       getHostView().setRepeatCount(-1);
                   }
                   getHostView().playAnimation();
   
               }
           });
       }
   
       @WXComponentProp(name = "loop")
       public void setLoop(final boolean loop) {
           mLoop = loop;
           if (loop) {
               getHostView().setRepeatCount(-1);
           }
       }
   
   weex代码如下:
   [http://editor.weex.io/p/PorterLuo/8nus6j/commit/8c592bdb31a3075dffd4b35a88cae396](url)
   
   我url属性回调方法依赖loop属性,我希望url属性回调方法在loop属性回调方法之后执行。
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services