react-native-reorderable-list 0.14.0 → 0.15.0
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/README.md +3 -2
- package/lib/commonjs/components/NestedReorderableList.js +5 -7
- package/lib/commonjs/components/NestedReorderableList.js.map +1 -1
- package/lib/commonjs/components/ReorderableList.js +3 -7
- package/lib/commonjs/components/ReorderableList.js.map +1 -1
- package/lib/commonjs/components/ReorderableListCore.js +39 -31
- package/lib/commonjs/components/ReorderableListCore.js.map +1 -1
- package/lib/commonjs/components/ScrollViewContainer.js +11 -10
- package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
- package/lib/commonjs/hooks/index.js +26 -15
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/usePropAsSharedValue.js +17 -0
- package/lib/commonjs/hooks/usePropAsSharedValue.js.map +1 -0
- package/lib/module/components/NestedReorderableList.js +5 -7
- package/lib/module/components/NestedReorderableList.js.map +1 -1
- package/lib/module/components/ReorderableList.js +3 -7
- package/lib/module/components/ReorderableList.js.map +1 -1
- package/lib/module/components/ReorderableListCore.js +39 -31
- package/lib/module/components/ReorderableListCore.js.map +1 -1
- package/lib/module/components/ScrollViewContainer.js +10 -9
- package/lib/module/components/ScrollViewContainer.js.map +1 -1
- package/lib/module/hooks/index.js +3 -2
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/usePropAsSharedValue.js +10 -0
- package/lib/module/hooks/usePropAsSharedValue.js.map +1 -0
- package/lib/typescript/components/NestedReorderableList.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableList.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableListCore.d.ts +2 -3
- package/lib/typescript/components/ReorderableListCore.d.ts.map +1 -1
- package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
- package/lib/typescript/contexts/ScrollViewContainerContext.d.ts +2 -2
- package/lib/typescript/contexts/ScrollViewContainerContext.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +3 -2
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/usePropAsSharedValue.d.ts +3 -0
- package/lib/typescript/hooks/usePropAsSharedValue.d.ts.map +1 -0
- package/lib/typescript/types/props.d.ts +5 -1
- package/lib/typescript/types/props.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/NestedReorderableList.tsx +5 -6
- package/src/components/ReorderableList.tsx +4 -5
- package/src/components/ReorderableListCore.tsx +56 -48
- package/src/components/ScrollViewContainer.tsx +11 -8
- package/src/contexts/ScrollViewContainerContext.ts +2 -2
- package/src/hooks/index.ts +3 -2
- package/src/hooks/usePropAsSharedValue.ts +13 -0
- package/src/types/props.ts +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableList.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ReorderableList.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAoBnD,eAAO,MAAM,eAAe,4EAEvB,WAAW,CAAC"}
|
|
@@ -8,11 +8,10 @@ interface ReorderableListCoreProps<T> extends ReorderableListProps<T> {
|
|
|
8
8
|
scrollViewPageY: SharedValue<number> | undefined;
|
|
9
9
|
scrollViewHeightY: SharedValue<number> | undefined;
|
|
10
10
|
scrollViewScrollOffsetY: SharedValue<number> | undefined;
|
|
11
|
-
|
|
11
|
+
scrollViewScrollEnabledProp: SharedValue<boolean> | undefined;
|
|
12
|
+
scrollViewCurrentScrollEnabled: SharedValue<boolean> | undefined;
|
|
12
13
|
outerScrollGesture: NativeGesture | undefined;
|
|
13
|
-
initialScrollViewScrollEnabled: boolean | undefined;
|
|
14
14
|
scrollable: boolean | undefined;
|
|
15
|
-
scrollEnabled: boolean | undefined;
|
|
16
15
|
}
|
|
17
16
|
declare const MemoizedReorderableListCore: <T>(props: ReorderableListCoreProps<T> & {
|
|
18
17
|
ref?: React.ForwardedRef<FlatList<T> | null> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableListCore.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableListCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,EAEL,QAAQ,EAIR,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAIL,aAAa,EAGd,MAAM,8BAA8B,CAAC;AACtC,OAAiB,EAGf,WAAW,EAaZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAC,oBAAoB,EAAuB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ReorderableListCore.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableListCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,EAEL,QAAQ,EAIR,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAIL,aAAa,EAGd,MAAM,8BAA8B,CAAC;AACtC,OAAiB,EAGf,WAAW,EAaZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAC,oBAAoB,EAAuB,MAAM,UAAU,CAAC;AAepE,UAAU,wBAAwB,CAAC,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAEnE,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAChE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACnD,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACzD,2BAA2B,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9D,8BAA8B,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACjE,kBAAkB,EAAE,aAAa,GAAG,SAAS,CAAC;IAC9C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC;AAs6BD,QAAA,MAAM,2BAA2B;;MAM5B,MAAM,YAAY,CAAC;AAExB,OAAO,EAAC,2BAA2B,IAAI,mBAAmB,EAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollViewContainer.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollViewContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAoB,UAAU,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ScrollViewContainer.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollViewContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAoB,UAAU,EAAC,MAAM,cAAc,CAAC;AAc3D,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAgGvD,eAAO,MAAM,mBAAmB,6FAAyC,CAAC"}
|
|
@@ -7,9 +7,9 @@ interface ScrollViewContainerContextData {
|
|
|
7
7
|
scrollViewPageY: SharedValue<number>;
|
|
8
8
|
scrollViewHeightY: SharedValue<number>;
|
|
9
9
|
scrollViewScrollOffsetY: SharedValue<number>;
|
|
10
|
-
|
|
10
|
+
scrollViewScrollEnabledProp: SharedValue<boolean>;
|
|
11
|
+
scrollViewCurrentScrollEnabled: SharedValue<boolean>;
|
|
11
12
|
outerScrollGesture: NativeGesture;
|
|
12
|
-
initialScrollViewScrollEnabled: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare const ScrollViewContainerContext: React.Context<ScrollViewContainerContextData | undefined>;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollViewContainerContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ScrollViewContainerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,UAAU,8BAA8B;IACtC,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,
|
|
1
|
+
{"version":3,"file":"ScrollViewContainerContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ScrollViewContainerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAExC,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,UAAU,8BAA8B;IACtC,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,2BAA2B,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClD,8BAA8B,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACrD,kBAAkB,EAAE,aAAa,CAAC;CACnC;AAED,eAAO,MAAM,0BAA0B,2DAE3B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from './useContext';
|
|
2
|
+
export * from './usePropAsSharedValue';
|
|
1
3
|
export * from './useIsActive';
|
|
2
4
|
export * from './useReorderableDrag';
|
|
3
|
-
export * from './useReorderableDragStart';
|
|
4
5
|
export * from './useReorderableDragEnd';
|
|
5
|
-
export * from './
|
|
6
|
+
export * from './useReorderableDragStart';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePropAsSharedValue.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePropAsSharedValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,oBAAoB,iCAQhC,CAAC"}
|
|
@@ -78,6 +78,10 @@ export interface ReorderableListProps<T> extends Omit<FlatListProps<T>, OmittedP
|
|
|
78
78
|
* Allows passing an object with values and/or shared values that can animate a cell, for example by using the `onDragStart` and `onDragEnd` events. Supports view style properties. Override opacity and/or transform to disable the default animation, e.g. `{opacity: 1, transform: []}`.
|
|
79
79
|
*/
|
|
80
80
|
cellAnimations?: ReorderableListCellAnimations;
|
|
81
|
+
/**
|
|
82
|
+
* Whether dragging items is enabled. Default: `true`.
|
|
83
|
+
*/
|
|
84
|
+
dragEnabled?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* Whether the active item should be updated. Enables usage of `useIsActive` hook. Default: `false`.
|
|
83
87
|
*/
|
|
@@ -87,7 +91,7 @@ export interface ReorderableListProps<T> extends Omit<FlatListProps<T>, OmittedP
|
|
|
87
91
|
*/
|
|
88
92
|
panGesture?: PanGesture;
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
94
|
+
* Whether the pan gestures necessary for dragging are enabled. Default: `true`.
|
|
91
95
|
*
|
|
92
96
|
* @deprecated In favor of `panGesture` prop.
|
|
93
97
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,WAAW,EAAE,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAEvD,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,+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AAS,CAAC,QAAQ,CAAC;CACxB,EAED,WAAW,GAAG,SAAS,CACxB,CAAC;AAEF,MAAM,WAAW,6BACf,SAAQ,iCAAiC;IACzC;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;IACpE;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAC5E;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import {useContext} from '../hooks';
|
|
|
7
7
|
import type {NestedReorderableListProps} from '../types';
|
|
8
8
|
|
|
9
9
|
const NestedReorderableListWithRef = <T,>(
|
|
10
|
-
{scrollable,
|
|
10
|
+
{scrollable, ...rest}: NestedReorderableListProps<T>,
|
|
11
11
|
ref?: React.ForwardedRef<FlatList<T>>,
|
|
12
12
|
) => {
|
|
13
13
|
const {
|
|
@@ -15,9 +15,9 @@ const NestedReorderableListWithRef = <T,>(
|
|
|
15
15
|
scrollViewScrollOffsetY,
|
|
16
16
|
scrollViewPageY,
|
|
17
17
|
scrollViewHeightY,
|
|
18
|
-
|
|
18
|
+
scrollViewScrollEnabledProp,
|
|
19
|
+
scrollViewCurrentScrollEnabled,
|
|
19
20
|
outerScrollGesture,
|
|
20
|
-
initialScrollViewScrollEnabled,
|
|
21
21
|
} = useContext(ScrollViewContainerContext);
|
|
22
22
|
|
|
23
23
|
return (
|
|
@@ -29,10 +29,9 @@ const NestedReorderableListWithRef = <T,>(
|
|
|
29
29
|
scrollViewPageY={scrollViewPageY}
|
|
30
30
|
scrollViewHeightY={scrollViewHeightY}
|
|
31
31
|
outerScrollGesture={outerScrollGesture}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
scrollViewScrollEnabledProp={scrollViewScrollEnabledProp}
|
|
33
|
+
scrollViewCurrentScrollEnabled={scrollViewCurrentScrollEnabled}
|
|
34
34
|
scrollable={scrollable}
|
|
35
|
-
scrollEnabled={scrollEnabled}
|
|
36
35
|
nestedScrollEnabled
|
|
37
36
|
/>
|
|
38
37
|
);
|
|
@@ -5,20 +5,19 @@ import {ReorderableListCore} from './ReorderableListCore';
|
|
|
5
5
|
import type {ReorderableListProps} from '../types';
|
|
6
6
|
|
|
7
7
|
const ReorderableListWithRef = <T,>(
|
|
8
|
-
|
|
8
|
+
props: ReorderableListProps<T>,
|
|
9
9
|
ref: React.Ref<FlatList<T>>,
|
|
10
10
|
) => (
|
|
11
11
|
<ReorderableListCore
|
|
12
|
-
{...
|
|
12
|
+
{...props}
|
|
13
13
|
ref={ref}
|
|
14
|
-
scrollEnabled={scrollEnabled}
|
|
15
14
|
scrollViewContainerRef={undefined}
|
|
16
15
|
scrollViewScrollOffsetY={undefined}
|
|
17
16
|
scrollViewPageY={undefined}
|
|
18
17
|
scrollViewHeightY={undefined}
|
|
19
18
|
outerScrollGesture={undefined}
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
scrollViewScrollEnabledProp={undefined}
|
|
20
|
+
scrollViewCurrentScrollEnabled={undefined}
|
|
22
21
|
scrollable
|
|
23
22
|
/>
|
|
24
23
|
);
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
SCALE_ANIMATION_CONFIG_DEFAULT,
|
|
43
43
|
} from './constants';
|
|
44
44
|
import {ReorderableListCell} from './ReorderableListCell';
|
|
45
|
+
import {usePropAsSharedValue} from '../hooks';
|
|
45
46
|
|
|
46
47
|
const AnimatedFlatList = Animated.createAnimatedComponent(
|
|
47
48
|
FlatList,
|
|
@@ -55,11 +56,10 @@ interface ReorderableListCoreProps<T> extends ReorderableListProps<T> {
|
|
|
55
56
|
scrollViewPageY: SharedValue<number> | undefined;
|
|
56
57
|
scrollViewHeightY: SharedValue<number> | undefined;
|
|
57
58
|
scrollViewScrollOffsetY: SharedValue<number> | undefined;
|
|
58
|
-
|
|
59
|
+
scrollViewScrollEnabledProp: SharedValue<boolean> | undefined;
|
|
60
|
+
scrollViewCurrentScrollEnabled: SharedValue<boolean> | undefined;
|
|
59
61
|
outerScrollGesture: NativeGesture | undefined;
|
|
60
|
-
initialScrollViewScrollEnabled: boolean | undefined;
|
|
61
62
|
scrollable: boolean | undefined;
|
|
62
|
-
scrollEnabled: boolean | undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const ReorderableListCore = <T,>(
|
|
@@ -80,10 +80,12 @@ const ReorderableListCore = <T,>(
|
|
|
80
80
|
scrollViewPageY,
|
|
81
81
|
scrollViewHeightY,
|
|
82
82
|
scrollViewScrollOffsetY,
|
|
83
|
-
|
|
83
|
+
scrollViewScrollEnabledProp,
|
|
84
|
+
scrollViewCurrentScrollEnabled,
|
|
84
85
|
scrollable,
|
|
85
86
|
outerScrollGesture,
|
|
86
87
|
cellAnimations,
|
|
88
|
+
dragEnabled = true,
|
|
87
89
|
shouldUpdateActiveItem,
|
|
88
90
|
panGesture,
|
|
89
91
|
panEnabled = true,
|
|
@@ -93,18 +95,13 @@ const ReorderableListCore = <T,>(
|
|
|
93
95
|
}: ReorderableListCoreProps<T>,
|
|
94
96
|
ref: React.ForwardedRef<FlatList<T>>,
|
|
95
97
|
) => {
|
|
96
|
-
|
|
97
|
-
// but internally we would treat it as false, so we force true.
|
|
98
|
-
const initialScrollEnabled =
|
|
99
|
-
typeof rest.scrollEnabled === 'undefined' ? true : rest.scrollEnabled;
|
|
100
|
-
const initialScrollViewScrollEnabled =
|
|
101
|
-
typeof rest.initialScrollViewScrollEnabled === 'undefined'
|
|
102
|
-
? true
|
|
103
|
-
: rest.initialScrollViewScrollEnabled;
|
|
98
|
+
const scrollEnabled = rest.scrollEnabled ?? true;
|
|
104
99
|
|
|
105
100
|
const flatListRef = useAnimatedRef<FlatList>();
|
|
106
101
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
107
|
-
const
|
|
102
|
+
const prevItemCount = useRef(data.length);
|
|
103
|
+
|
|
104
|
+
const currentScrollEnabled = useSharedValue(scrollEnabled);
|
|
108
105
|
const gestureState = useSharedValue<State>(State.UNDETERMINED);
|
|
109
106
|
const currentY = useSharedValue(0);
|
|
110
107
|
const currentTranslationY = useSharedValue(0);
|
|
@@ -137,30 +134,23 @@ const ReorderableListCore = <T,>(
|
|
|
137
134
|
((from: number, to: number) => void)[][]
|
|
138
135
|
>([]);
|
|
139
136
|
const startY = useSharedValue(0);
|
|
140
|
-
const duration = useSharedValue(animationDuration);
|
|
141
137
|
const scaleDefault = useSharedValue(1);
|
|
142
138
|
const opacityDefault = useSharedValue(1);
|
|
143
139
|
const dragDirection = useSharedValue(0);
|
|
144
140
|
const lastDragDirectionPivot = useSharedValue<number | null>(null);
|
|
145
|
-
|
|
146
|
-
const
|
|
141
|
+
|
|
142
|
+
const scrollEnabledProp = usePropAsSharedValue(scrollEnabled);
|
|
143
|
+
const animationDurationProp = usePropAsSharedValue(animationDuration);
|
|
144
|
+
const autoscrollActivationDeltaProp = usePropAsSharedValue(
|
|
145
|
+
autoscrollActivationDelta,
|
|
146
|
+
);
|
|
147
|
+
const dragEnabledProp = usePropAsSharedValue(dragEnabled ?? true);
|
|
147
148
|
|
|
148
149
|
// Position of the list relative to the scroll container
|
|
149
150
|
const nestedFlatListPositionY = useDerivedValue(
|
|
150
151
|
() => flatListPageY.value - (scrollViewPageY?.value || 0),
|
|
151
152
|
);
|
|
152
153
|
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
duration.value = animationDuration;
|
|
155
|
-
autoscrollDelta.value = autoscrollActivationDelta;
|
|
156
|
-
}, [
|
|
157
|
-
duration,
|
|
158
|
-
animationDuration,
|
|
159
|
-
autoscrollDelta,
|
|
160
|
-
autoscrollActivationDelta,
|
|
161
|
-
itemCount,
|
|
162
|
-
]);
|
|
163
|
-
|
|
164
154
|
useEffect(() => {
|
|
165
155
|
itemCount.value = data.length;
|
|
166
156
|
|
|
@@ -227,14 +217,14 @@ const ReorderableListCore = <T,>(
|
|
|
227
217
|
lastDragDirectionPivot.value = e.absoluteY;
|
|
228
218
|
} else if (
|
|
229
219
|
Math.abs(e.absoluteY - lastDragDirectionPivot.value) >=
|
|
230
|
-
|
|
220
|
+
autoscrollActivationDeltaProp.value
|
|
231
221
|
) {
|
|
232
222
|
dragDirection.value = direction;
|
|
233
223
|
lastDragDirectionPivot.value = e.absoluteY;
|
|
234
224
|
}
|
|
235
225
|
}
|
|
236
226
|
},
|
|
237
|
-
[dragDirection, lastDragDirectionPivot,
|
|
227
|
+
[dragDirection, lastDragDirectionPivot, autoscrollActivationDeltaProp],
|
|
238
228
|
);
|
|
239
229
|
|
|
240
230
|
const setCurrentItemDragCenterY = useCallback(
|
|
@@ -349,30 +339,32 @@ const ReorderableListCore = <T,>(
|
|
|
349
339
|
|
|
350
340
|
const setScrollEnabled = useCallback(
|
|
351
341
|
(enabled: boolean) => {
|
|
352
|
-
//
|
|
353
|
-
if (
|
|
354
|
-
|
|
342
|
+
// When re-enabling the scroll of the flatlist we check whether its prop is set to true.
|
|
343
|
+
if ((enabled && scrollEnabledProp.value) || !enabled) {
|
|
344
|
+
currentScrollEnabled.value = enabled;
|
|
355
345
|
flatListRef.current?.setNativeProps({scrollEnabled: enabled});
|
|
356
346
|
}
|
|
357
347
|
|
|
358
348
|
if (
|
|
359
349
|
scrollViewContainerRef &&
|
|
360
|
-
|
|
361
|
-
|
|
350
|
+
scrollViewScrollEnabledProp &&
|
|
351
|
+
scrollViewCurrentScrollEnabled &&
|
|
352
|
+
// When re-enabling the scroll of the container we check whether its prop is set to true.
|
|
353
|
+
((enabled && scrollViewScrollEnabledProp?.value) || !enabled)
|
|
362
354
|
) {
|
|
363
|
-
|
|
355
|
+
scrollViewCurrentScrollEnabled.value = enabled;
|
|
364
356
|
scrollViewContainerRef.current?.setNativeProps({
|
|
365
357
|
scrollEnabled: enabled,
|
|
366
358
|
});
|
|
367
359
|
}
|
|
368
360
|
},
|
|
369
361
|
[
|
|
370
|
-
initialScrollEnabled,
|
|
371
362
|
flatListRef,
|
|
372
|
-
|
|
373
|
-
|
|
363
|
+
scrollEnabledProp,
|
|
364
|
+
currentScrollEnabled,
|
|
365
|
+
scrollViewScrollEnabledProp,
|
|
366
|
+
scrollViewCurrentScrollEnabled,
|
|
374
367
|
scrollViewContainerRef,
|
|
375
|
-
scrollViewScrollEnabled,
|
|
376
368
|
],
|
|
377
369
|
);
|
|
378
370
|
|
|
@@ -399,8 +391,8 @@ const ReorderableListCore = <T,>(
|
|
|
399
391
|
]);
|
|
400
392
|
|
|
401
393
|
const resetSharedValuesAfterAnimations = useCallback(() => {
|
|
402
|
-
setTimeout(runOnUI(resetSharedValues),
|
|
403
|
-
}, [resetSharedValues,
|
|
394
|
+
setTimeout(runOnUI(resetSharedValues), animationDurationProp.value);
|
|
395
|
+
}, [resetSharedValues, animationDurationProp]);
|
|
404
396
|
|
|
405
397
|
const reorder = (fromIndex: number, toIndex: number) => {
|
|
406
398
|
runOnUI(resetSharedValues)();
|
|
@@ -571,7 +563,7 @@ const ReorderableListCore = <T,>(
|
|
|
571
563
|
dragY.value = withTiming(
|
|
572
564
|
newTopPosition,
|
|
573
565
|
{
|
|
574
|
-
duration:
|
|
566
|
+
duration: animationDurationProp.value,
|
|
575
567
|
easing: Easing.out(Easing.ease),
|
|
576
568
|
},
|
|
577
569
|
() => {
|
|
@@ -799,7 +791,7 @@ const ReorderableListCore = <T,>(
|
|
|
799
791
|
// checking if the list is not scrollable instead of the scrolling state
|
|
800
792
|
// fixes a bug on iOS where the item is shifted after autoscrolling and then
|
|
801
793
|
// moving away from autoscroll area
|
|
802
|
-
if (!
|
|
794
|
+
if (!currentScrollEnabled.value) {
|
|
803
795
|
dragScrollTranslationY.value =
|
|
804
796
|
flatListScrollOffsetY.value - dragInitialScrollOffsetY.value;
|
|
805
797
|
}
|
|
@@ -822,10 +814,10 @@ const ReorderableListCore = <T,>(
|
|
|
822
814
|
useAnimatedReaction(
|
|
823
815
|
() => scrollViewScrollOffsetY?.value,
|
|
824
816
|
value => {
|
|
825
|
-
if (value &&
|
|
817
|
+
if (value && scrollViewCurrentScrollEnabled) {
|
|
826
818
|
// checking if the list is not scrollable instead of the scrolling state
|
|
827
819
|
// fixes a bug on iOS where the item is shifted after autoscrolling and moving away from the area
|
|
828
|
-
if (!
|
|
820
|
+
if (!scrollViewCurrentScrollEnabled.value) {
|
|
829
821
|
scrollViewDragScrollTranslationY.value =
|
|
830
822
|
value - scrollViewDragInitialScrollOffsetY.value;
|
|
831
823
|
}
|
|
@@ -848,6 +840,10 @@ const ReorderableListCore = <T,>(
|
|
|
848
840
|
(index: number) => {
|
|
849
841
|
'worklet';
|
|
850
842
|
|
|
843
|
+
if (!dragEnabledProp.value) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
|
|
851
847
|
// allow new drag when item is completely released
|
|
852
848
|
if (state.value === ReorderableListState.IDLE) {
|
|
853
849
|
// resetting shared values again fixes a flickeing bug in nested lists where
|
|
@@ -875,6 +871,7 @@ const ReorderableListCore = <T,>(
|
|
|
875
871
|
}
|
|
876
872
|
},
|
|
877
873
|
[
|
|
874
|
+
dragEnabledProp,
|
|
878
875
|
resetSharedValues,
|
|
879
876
|
shouldUpdateActiveItem,
|
|
880
877
|
dragInitialScrollOffsetY,
|
|
@@ -906,7 +903,11 @@ const ReorderableListCore = <T,>(
|
|
|
906
903
|
return;
|
|
907
904
|
}
|
|
908
905
|
|
|
909
|
-
|
|
906
|
+
// We need to use pageY because the list might be nested into other views,
|
|
907
|
+
// It's important that we take the measurement of the list without any scroll offset
|
|
908
|
+
// from the scroll container.
|
|
909
|
+
flatListPageY.value =
|
|
910
|
+
measurement.pageY + (scrollViewScrollOffsetY?.value || 0);
|
|
910
911
|
})();
|
|
911
912
|
}, 100);
|
|
912
913
|
}
|
|
@@ -959,11 +960,18 @@ const ReorderableListCore = <T,>(
|
|
|
959
960
|
itemHeight={itemHeight}
|
|
960
961
|
dragY={dragY}
|
|
961
962
|
draggedIndex={draggedIndex}
|
|
962
|
-
animationDuration={
|
|
963
|
+
animationDuration={animationDurationProp}
|
|
963
964
|
startDrag={startDrag}
|
|
964
965
|
/>
|
|
965
966
|
),
|
|
966
|
-
[
|
|
967
|
+
[
|
|
968
|
+
itemOffset,
|
|
969
|
+
itemHeight,
|
|
970
|
+
dragY,
|
|
971
|
+
draggedIndex,
|
|
972
|
+
animationDurationProp,
|
|
973
|
+
startDrag,
|
|
974
|
+
],
|
|
967
975
|
);
|
|
968
976
|
|
|
969
977
|
return (
|
|
@@ -11,14 +11,18 @@ import Animated, {
|
|
|
11
11
|
useSharedValue,
|
|
12
12
|
} from 'react-native-reanimated';
|
|
13
13
|
|
|
14
|
-
import {ScrollViewContainerContext} from '../contexts
|
|
14
|
+
import {ScrollViewContainerContext} from '../contexts';
|
|
15
|
+
import {usePropAsSharedValue} from '../hooks';
|
|
15
16
|
import type {ScrollViewContainerProps} from '../types';
|
|
16
17
|
|
|
17
18
|
const ScrollViewContainerWithRef = (
|
|
18
|
-
{onLayout, onScroll,
|
|
19
|
+
{onLayout, onScroll, ...rest}: ScrollViewContainerProps,
|
|
19
20
|
ref: React.ForwardedRef<ScrollView>,
|
|
20
21
|
) => {
|
|
21
|
-
const
|
|
22
|
+
const scrollEnabled = rest.scrollEnabled ?? true;
|
|
23
|
+
|
|
24
|
+
const scrollViewScrollEnabledProp = usePropAsSharedValue(scrollEnabled);
|
|
25
|
+
const scrollViewCurrentScrollEnabled = useSharedValue(scrollEnabled);
|
|
22
26
|
const scrollViewContainerRef = useAnimatedRef<Animated.ScrollView>();
|
|
23
27
|
const scrollViewScrollOffsetY = useSharedValue(0);
|
|
24
28
|
const scrollViewPageY = useSharedValue(0);
|
|
@@ -57,18 +61,18 @@ const ScrollViewContainerWithRef = (
|
|
|
57
61
|
scrollViewPageY,
|
|
58
62
|
scrollViewHeightY,
|
|
59
63
|
scrollViewScrollOffsetY,
|
|
60
|
-
|
|
64
|
+
scrollViewScrollEnabledProp,
|
|
65
|
+
scrollViewCurrentScrollEnabled,
|
|
61
66
|
outerScrollGesture,
|
|
62
|
-
initialScrollViewScrollEnabled: scrollEnabled,
|
|
63
67
|
}),
|
|
64
68
|
[
|
|
65
69
|
scrollViewContainerRef,
|
|
66
70
|
scrollViewPageY,
|
|
67
71
|
scrollViewHeightY,
|
|
68
72
|
scrollViewScrollOffsetY,
|
|
69
|
-
|
|
73
|
+
scrollViewScrollEnabledProp,
|
|
74
|
+
scrollViewCurrentScrollEnabled,
|
|
70
75
|
outerScrollGesture,
|
|
71
|
-
scrollEnabled,
|
|
72
76
|
],
|
|
73
77
|
);
|
|
74
78
|
|
|
@@ -99,7 +103,6 @@ const ScrollViewContainerWithRef = (
|
|
|
99
103
|
ref={handleRef}
|
|
100
104
|
onScroll={composedScrollHandler}
|
|
101
105
|
onLayout={handleLayout}
|
|
102
|
-
scrollEnabled={scrollEnabled}
|
|
103
106
|
/>
|
|
104
107
|
</GestureDetector>
|
|
105
108
|
</ScrollViewContainerContext.Provider>
|
|
@@ -9,9 +9,9 @@ interface ScrollViewContainerContextData {
|
|
|
9
9
|
scrollViewPageY: SharedValue<number>;
|
|
10
10
|
scrollViewHeightY: SharedValue<number>;
|
|
11
11
|
scrollViewScrollOffsetY: SharedValue<number>;
|
|
12
|
-
|
|
12
|
+
scrollViewScrollEnabledProp: SharedValue<boolean>;
|
|
13
|
+
scrollViewCurrentScrollEnabled: SharedValue<boolean>;
|
|
13
14
|
outerScrollGesture: NativeGesture;
|
|
14
|
-
initialScrollViewScrollEnabled: boolean;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const ScrollViewContainerContext = React.createContext<
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export * from './useContext';
|
|
2
|
+
export * from './usePropAsSharedValue';
|
|
1
3
|
export * from './useIsActive';
|
|
2
4
|
export * from './useReorderableDrag';
|
|
3
|
-
export * from './useReorderableDragStart';
|
|
4
5
|
export * from './useReorderableDragEnd';
|
|
5
|
-
export * from './
|
|
6
|
+
export * from './useReorderableDragStart';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {useEffect} from 'react';
|
|
2
|
+
|
|
3
|
+
import {SharedValue, useSharedValue} from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
export const usePropAsSharedValue = <T>(value: T): SharedValue<T> => {
|
|
6
|
+
const sv = useSharedValue(value);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
sv.value = value;
|
|
10
|
+
}, [sv, value]);
|
|
11
|
+
|
|
12
|
+
return sv;
|
|
13
|
+
};
|
package/src/types/props.ts
CHANGED
|
@@ -107,6 +107,10 @@ export interface ReorderableListProps<T>
|
|
|
107
107
|
* Allows passing an object with values and/or shared values that can animate a cell, for example by using the `onDragStart` and `onDragEnd` events. Supports view style properties. Override opacity and/or transform to disable the default animation, e.g. `{opacity: 1, transform: []}`.
|
|
108
108
|
*/
|
|
109
109
|
cellAnimations?: ReorderableListCellAnimations;
|
|
110
|
+
/**
|
|
111
|
+
* Whether dragging items is enabled. Default: `true`.
|
|
112
|
+
*/
|
|
113
|
+
dragEnabled?: boolean;
|
|
110
114
|
/**
|
|
111
115
|
* Whether the active item should be updated. Enables usage of `useIsActive` hook. Default: `false`.
|
|
112
116
|
*/
|
|
@@ -116,7 +120,7 @@ export interface ReorderableListProps<T>
|
|
|
116
120
|
*/
|
|
117
121
|
panGesture?: PanGesture;
|
|
118
122
|
/**
|
|
119
|
-
*
|
|
123
|
+
* Whether the pan gestures necessary for dragging are enabled. Default: `true`.
|
|
120
124
|
*
|
|
121
125
|
* @deprecated In favor of `panGesture` prop.
|
|
122
126
|
*/
|