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 2018/02/09 11:26:46 UTC

incubator-weex git commit: [WEEX-204][iOS] bugfix about longpress and pangesture innner waterfall component

Repository: incubator-weex
Updated Branches:
  refs/heads/master e31458ac3 -> 784903132


[WEEX-204][iOS] bugfix about longpress and pangesture innner waterfall component

 watterfall add a longpress and pan gesture for drag dataSource, so make it
lazy load so that it take no effect on user who don't care about the drag
dataSource, you can reproduce it by the follow case
http://dotwe.org/vue/4444eae2b4257b787dd5b82051aff2c5

Bug: 204
close #1007


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

Branch: refs/heads/master
Commit: 7849031323844c50ce3c5749d0bc407acc85fedc
Parents: e31458a
Author: acton393 <zh...@gmail.com>
Authored: Mon Jan 29 16:49:28 2018 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Fri Feb 9 19:26:08 2018 +0800

----------------------------------------------------------------------
 .../Sources/Component/Recycler/WXRecyclerComponent.m   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/78490313/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 aa4bf1a..c67ac6a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -144,15 +144,14 @@ typedef enum : NSUInteger {
         _updateController.delegate = self;
         [self fixFlicker];
         
-        _dragController = [WXRecyclerDragController new];
-        _dragController.delegate = self;
         if ([attributes[@"draggable"] boolValue]) {
+            // lazy load
+            _dragController = [WXRecyclerDragController new];
+            _dragController.delegate = self;
             if([attributes[@"dragTriggerType"]  isEqual: @"pan"]){
                 _dragController.dragTriggerType = WXRecyclerDragTriggerPan;
             }
             _dragController.isDragable = YES;
-        }else{
-            _dragController.isDragable = NO;
         }
     }
     
@@ -211,11 +210,15 @@ typedef enum : NSUInteger {
         BOOL needUpdateLayout = NO;
         
         if ([attributes[@"draggable"] boolValue]) {
+            if (!_dragController) {  // lazy load
+                _dragController = [WXRecyclerDragController new];
+                _dragController.delegate = self;
+            }
             if([attributes[@"dragTriggerType"]  isEqual: @"pan"]){
                 _dragController.dragTriggerType = WXRecyclerDragTriggerPan;
             }
             _dragController.isDragable = YES;
-        }else{
+        } else {
             _dragController.isDragable = NO;
         }