diff --git a/doric-demo/src/HorizontalListDemo.ts b/doric-demo/src/HorizontalListDemo.ts index 48d6006b..8b01d942 100644 --- a/doric-demo/src/HorizontalListDemo.ts +++ b/doric-demo/src/HorizontalListDemo.ts @@ -66,11 +66,21 @@ class ListVM extends ViewModel { onAttached(state: ListModel, vh: ListVH) { vh.list.apply({ canDrag: true, + itemCanDrag: (from) => { + if (from === 0) { + return false; + } else { + return true; + } + }, + beforeDragging: (from) => { + return [0, 1, 2] + }, onDragging: (from, to) => { - log(`onDragging, from: ${from}, to: ${to}`) + loge(`onDragging from: ${from}, to: ${to}`) }, onDragged: (from, to) => { - log(`onDragged, from: ${from}, to: ${to}`) + loge(`onDragged from: ${from}, to: ${to}`) }, renderItem: (index) => { const data = state.data[index] diff --git a/doric-iOS/Pod/Classes/Shader/DoricHorizontalListNode.m b/doric-iOS/Pod/Classes/Shader/DoricHorizontalListNode.m index 5f5165f7..2ea74c34 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricHorizontalListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricHorizontalListNode.m @@ -72,11 +72,12 @@ @interface DoricHorizontalListNode () *)didScrollBlocks { if (!_didScrollBlocks) { _didScrollBlocks = [NSMutableSet new]; @@ -549,6 +584,7 @@ - (void)reset { self.loadMoreViewId = nil; self.onScrollFuncId = nil; self.onScrollEndFuncId = nil; + self.itemCanDragFuncId = nil; self.beforeDraggingFuncId = nil; self.onDraggingFuncId = nil; self.onDraggedFuncId = nil;