[
https://issues.apache.org/jira/browse/WEEX-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620387#comment-16620387
]
ASF GitHub Bot commented on WEEX-585:
-------------------------------------
cxfeng1 closed pull request #1538: [WEEX-585][iOS] recycle list bugfix
URL: https://github.com/apache/incubator-weex/pull/1538
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/WXRecycleListComponent.mm
b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.mm
index 011c4322de..f6de48b9a4 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.mm
@@ -196,7 +196,6 @@ - (void)adjustSticky
- (void)loadMore
{
[super loadMore];
-
_previousLoadMoreCellNumber = [_collectionView numberOfItemsInSection:0];
}
diff --git
a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListUpdateManager.m
b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListUpdateManager.m
index 25b7282cfc..fbd6c20ae4 100644
--- a/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListUpdateManager.m
+++ b/ios/sdk/WeexSDK/Sources/Component/RecycleList/WXRecycleListUpdateManager.m
@@ -182,7 +182,6 @@ - (void)performBatchUpdates
void (^updates)(void) = [^{
[self.delegate updateManager:self willUpdateData:newData];
[UIView setAnimationsEnabled:NO];
- NSLog(@"UICollectionView update:%@", recycleListDiffResult);
[self applyUpdateWithDiffResult:recycleListDiffResult];
} copy];
@@ -190,7 +189,6 @@ - (void)performBatchUpdates
[UIView setAnimationsEnabled:YES];
self.isUpdating = NO;
[self.delegate updateManager:self didUpdateData:newData
withSuccess:finished];
-
[self.reloadIndexPaths removeAllObjects];
[self checkUpdates];
} copy];
@@ -243,9 +241,15 @@ - (void)applyUpdateWithDiffResult:(WXRecycleListDiffResult
*)diffResult
NSMutableSet *reloadIndexPaths = self.reloadIndexPaths ?
[[diffResult.reloadIndexPaths setByAddingObjectsFromSet:self.reloadIndexPaths]
mutableCopy]: [diffResult.reloadIndexPaths mutableCopy];
[reloadIndexPaths minusSet:diffResult.deleteIndexPaths];
- [_collectionView deleteItemsAtIndexPaths:[diffResult.deleteIndexPaths
allObjects]];
- [_collectionView insertItemsAtIndexPaths:[diffResult.insertIndexPaths
allObjects]];
- [_collectionView reloadItemsAtIndexPaths:[reloadIndexPaths allObjects]];
+ if (diffResult.deleteIndexPaths.count > 0) {
+ [_collectionView deleteItemsAtIndexPaths:[diffResult.deleteIndexPaths
allObjects]];
+ }
+ if (diffResult.insertIndexPaths.count > 0) {
+ [_collectionView insertItemsAtIndexPaths:[diffResult.insertIndexPaths
allObjects]];
+ }
+ if (reloadIndexPaths.count > 0) {
+ [_collectionView reloadItemsAtIndexPaths:[reloadIndexPaths
allObjects]];
+ }
}
- (void)cleanup
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
index 8c7aee3934..88b20df154 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h
@@ -68,3 +68,6 @@
@end
+@interface NSNull (WXDiffable) <WXDiffable>
+
+@end
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
index b1549fc1c6..1423cf596c 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m
@@ -279,3 +279,16 @@ - (BOOL)weex_isEqualTo:(id<WXDiffable>)object
}
@end
+
+@implementation NSNull (WXDiffable)
+
+- (BOOL)weex_isEqualTo:(id<WXDiffable>)object
+{
+ if ([object isKindOfClass:[NSNull class]]) {
+ return YES;
+ }
+ return NO;
+}
+
+@end
+
----------------------------------------------------------------
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]
> recycle list bugfix
> -------------------
>
> Key: WEEX-585
> URL: https://issues.apache.org/jira/browse/WEEX-585
> Project: Weex
> Issue Type: Bug
> Reporter: qz
> Assignee: qz
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)