You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/17 08:25:39 UTC

[26/50] incubator-weex git commit: * [ios] bugfix list view can not scroll

* [ios] bugfix list view can not scroll


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

Branch: refs/heads/release-0.16
Commit: 38f4369279f4d84e21dae6a9a1afda9daa780cae
Parents: acb1815
Author: acton393 <zh...@gmail.com>
Authored: Wed Oct 11 11:39:53 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Wed Oct 11 19:05:12 2017 +0800

----------------------------------------------------------------------
 .../Sources/Component/WXScrollerComponent.m     | 31 ++++++++++++--------
 1 file changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/38f43692/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index a7d042e..b7a522a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -69,8 +69,8 @@
     CGPoint _lastContentOffset;
     CGPoint _lastScrollEventFiredOffset;
     BOOL _scrollable;
-    BOOL _alwaysScrollableVertical;
-    BOOL _alwaysScrollableHorizontal;
+    NSString * _alwaysScrollableVertical;
+    NSString * _alwaysScrollableHorizontal;
 
     // vertical & horizontal
     WXScrollDirection _scrollDirection;
@@ -119,10 +119,13 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
         _lastScrollEventFiredOffset = CGPointMake(0, 0);
         _scrollDirection = attributes[@"scrollDirection"] ? [WXConvert WXScrollDirection:attributes[@"scrollDirection"]] : WXScrollDirectionVertical;
         _showScrollBar = attributes[@"showScrollbar"] ? [WXConvert BOOL:attributes[@"showScrollbar"]] : YES;
-        // default value is NO;
-        _alwaysScrollableVertical = attributes[@"alwaysScrollableVertical"]?[WXConvert BOOL:attributes[@"alwaysScrollableVertical"]] : NO;
-        // default value is NO;
-        _alwaysScrollableHorizontal = attributes[@"alwaysScrollableHorizontal"]?[WXConvert BOOL:attributes[@"alwaysScrollableHorizontal"]] : NO;
+        
+        if (attributes[@"alwaysScrollableVertical"]) {
+            _alwaysScrollableVertical = [WXConvert NSString:attributes[@"alwaysScrollableVertical"]];
+        }
+        if (attributes[@"alwaysScrollableHorizontal"]) {
+            _alwaysScrollableHorizontal = [WXConvert NSString:attributes[@"alwaysScrollableHorizontal"]];
+        }
         _pagingEnabled = attributes[@"pagingEnabled"] ? [WXConvert BOOL:attributes[@"pagingEnabled"]] : NO;
         _loadMoreOffset = attributes[@"loadmoreoffset"] ? [WXConvert WXPixelType:attributes[@"loadmoreoffset"] scaleFactor:self.weexInstance.pixelScaleFactor] : 0;
         _loadmoreretry = attributes[@"loadmoreretry"] ? [WXConvert NSUInteger:attributes[@"loadmoreretry"]] : 0;
@@ -162,8 +165,12 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
     scrollView.showsHorizontalScrollIndicator = _showScrollBar;
     scrollView.scrollEnabled = _scrollable;
     scrollView.pagingEnabled = _pagingEnabled;
-    scrollView.alwaysBounceHorizontal = _alwaysScrollableHorizontal;
-    scrollView.alwaysBounceVertical = _alwaysScrollableVertical;
+    if (_alwaysScrollableHorizontal) {
+        scrollView.alwaysBounceHorizontal = [WXConvert BOOL:_alwaysScrollableHorizontal];
+    }
+    if (_alwaysScrollableVertical) {
+        scrollView.alwaysBounceVertical = [WXConvert BOOL:_alwaysScrollableVertical];
+    }
     if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
         // now use the runtime to forbid the contentInset being Adjusted.
         // here we add a category for scoller component view class compatible for new API,
@@ -232,13 +239,13 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
         ((UIScrollView *)self.view).scrollEnabled = _scrollable;
     }
     if (attributes[@"alwaysScrollableHorizontal"]) {
-        _alwaysScrollableHorizontal = [WXConvert BOOL:attributes[@"alwaysScrollableHorizontal"]];
-        ((UIScrollView*)self.view).alwaysBounceHorizontal = _alwaysScrollableHorizontal;
+        _alwaysScrollableHorizontal = [WXConvert NSString:attributes[@"alwaysScrollableHorizontal"]];
+        ((UIScrollView*)self.view).alwaysBounceHorizontal = [WXConvert BOOL:_alwaysScrollableHorizontal];
     }
     
     if (attributes[@"alwaysScrollableVertical"]) {
-        _alwaysScrollableVertical = [WXConvert BOOL:attributes[@"alwaysScrollableVertical"]];
-        ((UIScrollView*)self.view).alwaysBounceVertical = _alwaysScrollableVertical;
+        _alwaysScrollableVertical = [WXConvert NSString:attributes[@"alwaysScrollableVertical"]];
+        ((UIScrollView*)self.view).alwaysBounceVertical = [WXConvert BOOL:_alwaysScrollableVertical];
     }
     if (attributes[@"offsetAccuracy"]) {
         _offsetAccuracy = [WXConvert WXPixelType:attributes[@"offsetAccuracy"] scaleFactor:self.weexInstance.pixelScaleFactor];