You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/22 02:00:13 UTC
[40/50] incubator-weex git commit: * [ios] fix contentOffset reset
* [ios] fix contentOffset reset
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/928f1592
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/928f1592
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/928f1592
Branch: refs/heads/0.12-dev
Commit: 928f1592aa728f3fd254830b1821b027ae81086a
Parents: c885bbf
Author: acton393 <zh...@gmail.com>
Authored: Mon Mar 20 17:59:17 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Mar 20 17:59:17 2017 +0800
----------------------------------------------------------------------
.../Component/Recycler/WXRecyclerComponent.m | 23 ++++++++++++++++++++
.../Sources/Component/WXRefreshComponent.m | 4 +---
2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/928f1592/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index 4789291..073e878 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -105,6 +105,7 @@ typedef enum : NSUInteger {
_dataController = [WXRecyclerDataController new];
_updateController = [WXRecyclerUpdateController new];
_updateController.delegate = self;
+ [self fixFlicker];
}
return self;
@@ -581,4 +582,26 @@ typedef enum : NSUInteger {
return sectionArray;
}
+- (void)fixFlicker
+{
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ // FIXME:(\u0e07 \u2022\u0300_\u2022\u0301)\u0e07\u253b\u2501\u253b Stupid scoll view, always reset content offset to zero by calling _adjustContentOffsetIfNecessary after insert cells.
+ // So if you pull down list while list is rendering, the list will be flickering.
+ // Demo:
+ // Have to hook _adjustContentOffsetIfNecessary here.
+ // Any other more elegant way?
+ NSString *a = @"ntOffsetIfNe";
+ NSString *b = @"adjustConte";
+
+ NSString *originSelector = [NSString stringWithFormat:@"_%@%@cessary", b, a];
+ [[self class] weex_swizzle:[WXCollectionView class] Method:NSSelectorFromString(originSelector) withMethod:@selector(fixedFlickerSelector)];
+ });
+}
+
+- (void)fixedFlickerSelector
+{
+ // DO NOT delete this method.
+}
+
@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/928f1592/ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.m
index d71df2d..ab790dc 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.m
@@ -142,9 +142,7 @@
offset.y = -self.calculatedFrame.size.height;
[_indicator start];
} else {
- if (fabs(offset.y) >= CGRectGetHeight(self.calculatedFrame)) {
- offset.y += CGRectGetHeight(self.calculatedFrame);
- }
+ offset.y += CGRectGetHeight(self.calculatedFrame);
[_indicator stop];
}
[scrollerProtocol setContentOffset:offset animated:YES];