react-native-drag-sort-list 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/DragItemContainer.js +9 -10
- package/package.json +1 -1
package/lib/DragItemContainer.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file DragItemContainer.js
|
|
3
|
-
* @description
|
|
3
|
+
* @description
|
|
4
4
|
* @author liushun
|
|
5
|
-
* @created 2025/12/
|
|
6
|
-
* @lastModified 2025/12/
|
|
5
|
+
* @created 2025/12/20 13:22
|
|
6
|
+
* @lastModified 2025/12/20 13:22
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
9
|
import React, {useRef} from "react";
|
|
12
10
|
import { Animated, Dimensions, Easing, StyleSheet, View } from 'react-native'
|
|
13
11
|
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'
|
|
@@ -21,7 +19,6 @@ const DragItemContainer = (props) => {
|
|
|
21
19
|
const itemScaleAnime = useRef(new Animated.Value(1)).current;
|
|
22
20
|
|
|
23
21
|
const isDragging = useRef(false);
|
|
24
|
-
|
|
25
22
|
//长按手势处理
|
|
26
23
|
const longPress = Gesture.LongPress().onStart((e)=>{
|
|
27
24
|
itemScaleAnime.setValue(1.1)
|
|
@@ -36,10 +33,12 @@ const DragItemContainer = (props) => {
|
|
|
36
33
|
onDragMove?.(e);
|
|
37
34
|
}
|
|
38
35
|
}).onTouchesUp((e)=>{ //停止拖拽
|
|
39
|
-
isDragging.current
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
if(isDragging.current){
|
|
37
|
+
isDragging.current = false;
|
|
38
|
+
itemScaleAnime.setValue(1)
|
|
39
|
+
setZIndex(0);
|
|
40
|
+
onDragEnd?.(e);
|
|
41
|
+
}
|
|
43
42
|
}).activateAfterLongPress(505).enabled(true);
|
|
44
43
|
|
|
45
44
|
//手势合并
|
package/package.json
CHANGED