cxfeng1 closed pull request #1602: Fix div in list which cause weexcore render 
objects not ordered.
URL: https://github.com/apache/incubator-weex/pull/1602
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXCellSlotComponent.mm 
b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXCellSlotComponent.mm
index 3b7b90635c..70143bbcc6 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXCellSlotComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXCellSlotComponent.mm
@@ -43,7 +43,6 @@ - (instancetype)initWithRef:(NSString *)ref
         }
         _templateCaseType = attributes[@"case"] ? [WXConvert 
NSString:attributes[@"case"]] :const_cast<NSString 
*>(WXDefaultRecycleTemplateType);
         _lazyCreateView = YES;
-        _isNeedJoinLayoutSystem = NO;
     }
     
     return self;
diff --git 
a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm 
b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
index 767ffe3eae..26892dbd60 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.mm
@@ -170,7 +170,7 @@ - (void)updateBindingData:(NSDictionary *)data
         if (!needDisplay) {
             self.displayType = WXDisplayTypeNone;
             return;
-        } else if (needDisplay && !_isNeedJoinLayoutSystem) {
+        } else if (needDisplay) {
             self.displayType = WXDisplayTypeBlock;
         }
     }
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm 
b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
index 393d26149e..64ead8bc11 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
@@ -51,7 +51,6 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString 
*)type styles:(NSDict
         _deleteAnimation = [WXConvert 
UITableViewRowAnimation:attributes[@"deleteAnimation"]];
         _keepScrollPosition = attributes[@"keepScrollPosition"] ? [WXConvert 
BOOL:attributes[@"keepScrollPosition"]] : NO;
         _lazyCreateView = YES;
-        _isNeedJoinLayoutSystem = NO;
         if (attributes[@"zIndex"]) {
             _zIndex = [WXConvert NSString:attributes[@"zIndex"]];
         }
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h 
b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
index 161eb2bf06..fb1b673422 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
@@ -129,10 +129,9 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL 
*needUpdate);
     WXBorderStyle _borderBottomStyle;
     WXBorderStyle _borderLeftStyle;
     
-    
+    BOOL _isViewTreeIgnored; // Component is added to super, but it is not 
added to views.
     BOOL _isFixed;
     BOOL _async;
-    BOOL _isNeedJoinLayoutSystem;
     BOOL _lazyCreateView;
     
     WXTransform *_transform;
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.mm 
b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.mm
index c555a23c60..2d5c6a7bde 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.mm
@@ -33,7 +33,6 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString 
*)type styles:(NSDict
     
     if (self) {
         _async = YES;
-        _isNeedJoinLayoutSystem = NO;
         _keepScrollPosition = attributes[@"keepScrollPosition"] ? [WXConvert 
BOOL:attributes[@"keepScrollPosition"]] : NO;
     }
     
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm 
b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
index 26949909c0..55116af68a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.mm
@@ -262,7 +262,7 @@ - (BOOL)_insertSubcomponent:(WXComponent *)subcomponent 
atIndex:(NSInteger)index
                && ![subcomponent isKindOfClass:[WXLoadingComponent class]]
                && subcomponent->_positionType != WXPositionTypeFixed) {
         WXLogError(@"list only support 
cell/header/refresh/loading/fixed-component as child.");
-        return NO;
+        subcomponent->_isViewTreeIgnored = YES; // do not show this element.
     }
     
     BOOL inserted = [super _insertSubcomponent:subcomponent atIndex:index];
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm 
b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
index 02d937e6be..e00a8edf7d 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
@@ -99,7 +99,6 @@ - (instancetype)initWithRef:(NSString *)ref
         _absolutePosition = CGPointMake(NAN, NAN);
         
         _displayType = WXDisplayTypeBlock;
-        _isNeedJoinLayoutSystem = YES;
         _isViewFrameSyncWithCalculated = YES;
         _ariaHidden = nil;
         _accessible = nil;
@@ -323,13 +322,11 @@ - (void)setDisplayType:(WXDisplayType)displayType
     if (_displayType != displayType) {
         _displayType = displayType;
         if (displayType == WXDisplayTypeNone) {
-            _isNeedJoinLayoutSystem = NO;
             [self _removeFromSupercomponent];
             WXPerformBlockOnMainThread(^{
                 [self removeFromSuperview];
             });
         } else {
-            _isNeedJoinLayoutSystem = YES;
             WXPerformBlockOnMainThread(^{
                 [self _buildViewHierarchyLazily];
                 // TODO: insert into the correct index
@@ -594,7 +591,6 @@ - (BOOL)_insertSubcomponent:(WXComponent *)subcomponent 
atIndex:(NSInteger)index
     
     if (subcomponent->_positionType == WXPositionTypeFixed) {
         [self.weexInstance.componentManager addFixedComponent:subcomponent];
-        subcomponent->_isNeedJoinLayoutSystem = NO;
     }
     
     if (_useCompositing || _isCompositingChild) {
@@ -628,7 +624,6 @@ - (void)_removeFromSupercomponent:(BOOL)remove
     
     if (_positionType == WXPositionTypeFixed) {
         [self.weexInstance.componentManager removeFixedComponent:self];
-        self->_isNeedJoinLayoutSystem = YES;
     }
     if (_positionType == WXPositionTypeSticky) {
         [self.ancestorScroller removeStickyComponent:self];
diff --git a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm 
b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
index 93f7d009b8..ad178903bc 100644
--- a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
+++ b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
@@ -99,6 +99,17 @@ - (void)insertSubview:(WXComponent *)subcomponent 
atIndex:(NSInteger)index
     if (subcomponent.displayType == WXDisplayTypeNone) {
         return;
     }
+    
+    if (_isViewTreeIgnored) {
+        // self not added to views, children also ignored.
+        subcomponent->_isViewTreeIgnored = YES;
+        return;
+    }
+    
+    if (subcomponent->_isViewTreeIgnored) {
+        // children not added to views, such as div in list, we do not create 
view.
+        return;
+    }
   
     WX_CHECK_COMPONENT_TYPE(self.componentType)
     if (subcomponent->_positionType == WXPositionTypeFixed) {
@@ -230,10 +241,8 @@ - (void)_updateViewStyles:(NSDictionary *)styles
         WXPerformBlockOnComponentThread(^{
             if (positionType == WXPositionTypeFixed) {
                 [self.weexInstance.componentManager addFixedComponent:self];
-                _isNeedJoinLayoutSystem = NO;
             } else if (_positionType == WXPositionTypeFixed) {
                 [self.weexInstance.componentManager removeFixedComponent:self];
-                _isNeedJoinLayoutSystem = YES;
             }
             
             _positionType = positionType;


 

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


With regards,
Apache Git Services

Reply via email to