You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/11/30 11:38:46 UTC

incubator-weex git commit: [WEEX-136][iOS] fix 1pixel when UICollectionView scroll end close #897 this case may reproduce problem https://alibaba.github.io/rax/playground/a42d134c-7465-4e20-96c0-fe935cac0170

Repository: incubator-weex
Updated Branches:
  refs/heads/master d9e726b92 -> b1a1dfa13


[WEEX-136][iOS] fix 1pixel when UICollectionView scroll end
close #897
this case may reproduce problem
https://alibaba.github.io/rax/playground/a42d134c-7465-4e20-96c0-fe935cac0170

Bug:136


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

Branch: refs/heads/master
Commit: b1a1dfa13bc1b1f3ac4486ea42e80f48fdbee2c8
Parents: d9e726b
Author: acton393 <zh...@gmail.com>
Authored: Tue Nov 21 21:47:17 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Nov 30 19:38:16 2017 +0800

----------------------------------------------------------------------
 .../Sources/Component/Recycler/WXRecyclerComponent.m | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b1a1dfa1/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 1164472..be4d7a6 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -63,6 +63,21 @@ typedef enum : NSUInteger {
 
 - (void)setContentOffset:(CGPoint)contentOffset
 {
+    // FIXME: side effect caused by hooking _adjustContentOffsetIfNecessary.
+    // When UICollectionView is pulled down and finger releases,contentOffset will be set from -xxxx to about -0.5(greater than -0.5), then contentOffset will be reset to zero by calling _adjustContentOffsetIfNecessary.
+    // So hooking _adjustContentOffsetIfNecessary will always cause remaining 1px space between list's top and navigator.
+    // Demo: http://dotwe.org/895630945793a9a044e49abe39cbb77f
+    // Have to reset contentOffset to zero manually here.
+    if (fabs(contentOffset.y) < 0.5) {
+        contentOffset.y = 0;
+    }
+    if (isnan(contentOffset.x)) {
+        contentOffset.x = 0;
+    }
+    if(isnan(contentOffset.y)) {
+        contentOffset.y = 0;
+    }
+    
     [super setContentOffset:contentOffset];
 }