From 86e5e2422f9742b9960463b0cd5d371267fca16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 30 Jun 2022 16:39:28 +0800 Subject: [PATCH] iOS: implement beforeDragging callback --- doric-iOS/Pod/Classes/Shader/DoricListNode.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index bb1700c2..2239463c 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -63,6 +63,7 @@ @interface DoricListNode () @property(nonatomic, strong) UILongPressGestureRecognizer *longPress; @property(nonatomic, strong) NSIndexPath *initialDragIndexPath; @property(nonatomic, strong) NSIndexPath *currentDragIndexPath; +@property(nonatomic, copy) NSString *beforeDraggingFuncId; @property(nonatomic, copy) NSString *onDraggingFuncId; @property(nonatomic, copy) NSString *onDraggedFuncId; @end @@ -110,6 +111,9 @@ - (void)longPressAction:(UILongPressGestureRecognizer *)sender { if (indexPath != nil) { self.initialDragIndexPath = indexPath; self.currentDragIndexPath = indexPath; + if (self.beforeDraggingFuncId != nil) { + [self callJSResponse:self.beforeDraggingFuncId, @(indexPath.row), nil]; + } } } else if (sender.state == UIGestureRecognizerStateChanged) { if ((indexPath != nil) && (indexPath != self.currentDragIndexPath)) { @@ -172,6 +176,8 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id } else if ([@"canDrag" isEqualToString:name]) { bool canDrag = [prop boolValue]; [self.longPress setEnabled:canDrag]; + } else if ([@"beforeDragging" isEqualToString:name]) { + self.beforeDraggingFuncId = prop; } else if ([@"onDragging" isEqualToString:name]) { self.onDraggingFuncId = prop; } else if ([@"onDragged" isEqualToString:name]) { @@ -533,6 +539,7 @@ - (void)reset { self.loadMoreViewId = nil; self.onScrollFuncId = nil; self.onScrollEndFuncId = nil; + self.beforeDraggingFuncId = nil; self.onDraggingFuncId = nil; self.onDraggedFuncId = nil; self.loadMore = NO;