From 8e021133bb3cd9292a565c6806d755d4e21bb45b Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 23 Jun 2022 17:09:54 +0800 Subject: [PATCH] iOS: fix loadMore's change may cause UITableView internal inconsistency,add reloadData action --- doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m | 6 +++++- doric-iOS/Pod/Classes/Shader/DoricListNode.m | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m index 197e75e0..32d9d35a 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m @@ -240,7 +240,11 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu } else if ([@"loadMoreView" isEqualToString:name]) { self.loadMoreViewId = prop; } else if ([@"loadMore" isEqualToString:name]) { - self.loadMore = [prop boolValue]; + BOOL loadMore = [prop boolValue]; + if (loadMore != self.loadMore) { + self.loadMore = loadMore; + [self.view reloadData]; + } } else if ([@"onScroll" isEqualToString:name]) { self.onScrollFuncId = prop; } else if ([@"onScrollEnd" isEqualToString:name]) { diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index ad106a94..bb1700c2 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -103,7 +103,7 @@ - (UITableView *)build { }]; } --(void)longPressAction:(UILongPressGestureRecognizer *)sender{ +- (void)longPressAction:(UILongPressGestureRecognizer *)sender { CGPoint locationInView = [sender locationInView:self.view]; NSIndexPath *indexPath = [self.view indexPathForRowAtPoint:locationInView]; if (sender.state == UIGestureRecognizerStateBegan) { @@ -117,7 +117,7 @@ -(void)longPressAction:(UILongPressGestureRecognizer *)sender{ NSString *toValue = self.itemViewIds[@(indexPath.row)]; self.itemViewIds[@(self.currentDragIndexPath.row)] = toValue; self.itemViewIds[@(indexPath.row)] = fromValue; - + [self.view moveRowAtIndexPath:self.currentDragIndexPath toIndexPath:indexPath]; if (self.onDraggingFuncId != nil) { [self callJSResponse:self.onDraggingFuncId, @(self.currentDragIndexPath.row), @(indexPath.row), nil]; @@ -156,7 +156,11 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id } else if ([@"loadMoreView" isEqualToString:name]) { self.loadMoreViewId = prop; } else if ([@"loadMore" isEqualToString:name]) { - self.loadMore = [prop boolValue]; + BOOL loadMore = [prop boolValue]; + if (loadMore != self.loadMore) { + self.loadMore = loadMore; + [self.view reloadData]; + } } else if ([@"onScroll" isEqualToString:name]) { self.onScrollFuncId = prop; } else if ([@"onScrollEnd" isEqualToString:name]) {