* [ios] fix v-if case in recycle component

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ca7c0850
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ca7c0850
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ca7c0850

Branch: refs/heads/master
Commit: ca7c08506f24122fe9c1edf63e2782068101d0f0
Parents: ca5ad34
Author: acton393 <zhangxing610...@gmail.com>
Authored: Mon Sep 25 22:26:21 2017 +0800
Committer: acton393 <zhangxing610...@gmail.com>
Committed: Mon Sep 25 22:26:21 2017 +0800

----------------------------------------------------------------------
 .../Component/RecycleList/WXComponent+DataBinding.mm        | 9 ++++++++-
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m                 | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ca7c0850/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
----------------------------------------------------------------------
diff --git 
a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm 
b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
index b15ebd8..0b73721 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
@@ -85,7 +85,14 @@ static JSContext *jsContext;
     WXDataBindingBlock matchBlock = templateComponent->_bindingMatch;
     if (matchBlock) {
         BOOL needUpdate = NO;
-        BOOL needDisplay = [matchBlock(data, &needUpdate) boolValue];
+        BOOL needDisplay = NO;
+        id match = matchBlock(data, &needUpdate);
+        if ([match isKindOfClass:[NSNumber class]]) {
+            needDisplay = [match boolValue];
+        } else {
+            needDisplay = (match != nil);
+        }
+        
         if (!needDisplay) {
             self.displayType = WXDisplayTypeNone;
             return;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ca7c0850/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m 
b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 9a2966a..a13b749 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -279,7 +279,7 @@
             WXPerformBlockOnMainThread(^{
                 [self _buildViewHierarchyLazily];
                 // TODO: insert into the correct index
-                [self.supercomponent insertSubview:self atIndex:0];
+                [self.supercomponent.view addSubview:self.view];
             });
         }
     }

Reply via email to