react-native-reorderable-list 0.13.1 → 0.14.1

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.
Files changed (54) hide show
  1. package/README.md +69 -9
  2. package/lib/commonjs/components/{ReorderableListCore/useReorderableListCore.js → ReorderableListCore.js} +117 -58
  3. package/lib/commonjs/components/ReorderableListCore.js.map +1 -0
  4. package/lib/commonjs/components/ScrollViewContainer.js +12 -4
  5. package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
  6. package/lib/commonjs/components/{ReorderableListCore/animationDefaults.js → constants.js} +26 -2
  7. package/lib/commonjs/components/constants.js.map +1 -0
  8. package/lib/module/components/{ReorderableListCore/useReorderableListCore.js → ReorderableListCore.js} +117 -56
  9. package/lib/module/components/ReorderableListCore.js.map +1 -0
  10. package/lib/module/components/ScrollViewContainer.js +13 -4
  11. package/lib/module/components/ScrollViewContainer.js.map +1 -1
  12. package/lib/module/components/constants.js +52 -0
  13. package/lib/module/components/constants.js.map +1 -0
  14. package/lib/typescript/components/{ReorderableListCore/ReorderableListCore.d.ts → ReorderableListCore.d.ts} +1 -1
  15. package/lib/typescript/components/ReorderableListCore.d.ts.map +1 -0
  16. package/lib/typescript/components/ScrollViewContainer.d.ts +2 -1
  17. package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
  18. package/lib/typescript/components/{ReorderableListCore/animationDefaults.d.ts → constants.d.ts} +6 -1
  19. package/lib/typescript/components/constants.d.ts.map +1 -0
  20. package/lib/typescript/types/props.d.ts +9 -0
  21. package/lib/typescript/types/props.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/components/{ReorderableListCore/useReorderableListCore.ts → ReorderableListCore.tsx} +189 -100
  24. package/src/components/ScrollViewContainer.tsx +22 -9
  25. package/src/components/{ReorderableListCore/animationDefaults.ts → constants.ts} +34 -0
  26. package/src/types/props.ts +9 -0
  27. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +0 -123
  28. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js.map +0 -1
  29. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js.map +0 -1
  30. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js +0 -31
  31. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +0 -1
  32. package/lib/commonjs/components/ReorderableListCore/index.js +0 -17
  33. package/lib/commonjs/components/ReorderableListCore/index.js.map +0 -1
  34. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js.map +0 -1
  35. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +0 -116
  36. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +0 -1
  37. package/lib/module/components/ReorderableListCore/animationDefaults.js +0 -28
  38. package/lib/module/components/ReorderableListCore/animationDefaults.js.map +0 -1
  39. package/lib/module/components/ReorderableListCore/autoscrollConfig.js +0 -25
  40. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +0 -1
  41. package/lib/module/components/ReorderableListCore/index.js +0 -2
  42. package/lib/module/components/ReorderableListCore/index.js.map +0 -1
  43. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +0 -1
  44. package/lib/typescript/components/ReorderableListCore/ReorderableListCore.d.ts.map +0 -1
  45. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts.map +0 -1
  46. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts +0 -6
  47. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts.map +0 -1
  48. package/lib/typescript/components/ReorderableListCore/index.d.ts +0 -2
  49. package/lib/typescript/components/ReorderableListCore/index.d.ts.map +0 -1
  50. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +0 -183
  51. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +0 -1
  52. package/src/components/ReorderableListCore/ReorderableListCore.tsx +0 -178
  53. package/src/components/ReorderableListCore/autoscrollConfig.ts +0 -31
  54. package/src/components/ReorderableListCore/index.ts +0 -1
@@ -1,183 +0,0 @@
1
- import React from 'react';
2
- import { FlatList, LayoutChangeEvent, ScrollView } from 'react-native';
3
- import { SharedValue } from 'react-native-reanimated';
4
- import { ReorderableListCellAnimations, ReorderableListDragEndEvent, ReorderableListDragStartEvent, ReorderableListIndexChangeEvent, ReorderableListReorderEvent } from '../../types';
5
- interface UseReorderableListCoreArgs<T> {
6
- ref: React.ForwardedRef<FlatList<T>>;
7
- autoscrollThreshold: number;
8
- autoscrollThresholdOffset: {
9
- top?: number;
10
- bottom?: number;
11
- } | undefined;
12
- autoscrollSpeedScale: number;
13
- autoscrollDelay: number;
14
- autoscrollActivationDelta: number;
15
- animationDuration: number;
16
- onReorder: (event: ReorderableListReorderEvent) => void;
17
- onDragStart?: (event: ReorderableListDragStartEvent) => void;
18
- onDragEnd?: (event: ReorderableListDragEndEvent) => void;
19
- onIndexChange?: (event: ReorderableListIndexChangeEvent) => void;
20
- onLayout?: (event: LayoutChangeEvent) => void;
21
- scrollViewContainerRef: React.RefObject<ScrollView> | undefined;
22
- scrollViewPageY: SharedValue<number> | undefined;
23
- scrollViewHeightY: SharedValue<number> | undefined;
24
- scrollViewScrollOffsetY: SharedValue<number> | undefined;
25
- scrollViewScrollEnabled: SharedValue<boolean> | undefined;
26
- scrollable: boolean | undefined;
27
- initialScrollEnabled: boolean | undefined;
28
- initialScrollViewScrollEnabled: boolean | undefined;
29
- cellAnimations: ReorderableListCellAnimations | undefined;
30
- shouldUpdateActiveItem: boolean | undefined;
31
- panEnabled: boolean;
32
- panActivateAfterLongPress: number | undefined;
33
- }
34
- export declare const useReorderableListCore: <T>({ ref, autoscrollThreshold, autoscrollThresholdOffset, autoscrollSpeedScale, autoscrollDelay, autoscrollActivationDelta, animationDuration, onReorder, onDragStart, onDragEnd, onLayout, onIndexChange, scrollViewContainerRef, scrollViewPageY, scrollViewHeightY, scrollViewScrollOffsetY, scrollViewScrollEnabled, scrollable, initialScrollEnabled, initialScrollViewScrollEnabled, cellAnimations, shouldUpdateActiveItem, panActivateAfterLongPress, panEnabled, }: UseReorderableListCoreArgs<T>) => {
35
- gestureHandler: import("react-native-gesture-handler/lib/typescript/handlers/gestures/gestureComposition").SimultaneousGesture;
36
- handleScroll: import("react-native-reanimated").ScrollHandlerProcessed<Record<string, unknown>>;
37
- handleFlatListLayout: (e: LayoutChangeEvent) => void;
38
- handleRef: (value: FlatList<T>) => void;
39
- startDrag: (index: number) => void;
40
- listContextValue: {
41
- draggedHeight: SharedValue<number>;
42
- currentIndex: SharedValue<number>;
43
- draggedIndex: SharedValue<number>;
44
- dragEndHandlers: SharedValue<((from: number, to: number) => void)[][]>;
45
- activeIndex: number;
46
- cellAnimations: {
47
- transform: readonly import("../../types").MaximumOneOf<import("../../types").SharedValueOrType<import("../../types").Transforms>>[] | undefined;
48
- opacity: number | SharedValue<number> | undefined;
49
- pointerEvents?: "box-none" | "none" | "box-only" | "auto" | SharedValue<"box-none" | "none" | "box-only" | "auto" | undefined> | undefined;
50
- filter?: string | readonly import("react-native").FilterFunction[] | SharedValue<string | readonly import("react-native").FilterFunction[] | undefined> | undefined;
51
- backfaceVisibility?: "visible" | "hidden" | SharedValue<"visible" | "hidden" | undefined> | undefined;
52
- backgroundColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
53
- borderBlockColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
54
- borderBlockEndColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
55
- borderBlockStartColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
56
- borderBottomColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
57
- borderBottomEndRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
58
- borderBottomLeftRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
59
- borderBottomRightRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
60
- borderBottomStartRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
61
- borderColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
62
- borderCurve?: "circular" | "continuous" | SharedValue<"circular" | "continuous" | undefined> | undefined;
63
- borderEndColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
64
- borderEndEndRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
65
- borderEndStartRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
66
- borderLeftColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
67
- borderRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
68
- borderRightColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
69
- borderStartColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
70
- borderStartEndRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
71
- borderStartStartRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
72
- borderStyle?: "solid" | "dotted" | "dashed" | SharedValue<"solid" | "dotted" | "dashed" | undefined> | undefined;
73
- borderTopColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
74
- borderTopEndRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
75
- borderTopLeftRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
76
- borderTopRightRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
77
- borderTopStartRadius?: string | import("react-native").AnimatableNumericValue | SharedValue<string | import("react-native").AnimatableNumericValue | undefined> | undefined;
78
- elevation?: number | SharedValue<number | undefined> | undefined;
79
- isolation?: "auto" | "isolate" | SharedValue<"auto" | "isolate" | undefined> | undefined;
80
- cursor?: import("react-native").CursorValue | SharedValue<import("react-native").CursorValue | undefined> | undefined;
81
- boxShadow?: string | readonly import("react-native").BoxShadowValue[] | SharedValue<string | readonly import("react-native").BoxShadowValue[] | undefined> | undefined;
82
- alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly" | SharedValue<"center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined> | undefined;
83
- alignItems?: import("react-native").FlexAlignType | SharedValue<import("react-native").FlexAlignType | undefined> | undefined;
84
- alignSelf?: "auto" | import("react-native").FlexAlignType | SharedValue<"auto" | import("react-native").FlexAlignType | undefined> | undefined;
85
- aspectRatio?: string | number | SharedValue<string | number | undefined> | undefined;
86
- borderBottomWidth?: number | SharedValue<number | undefined> | undefined;
87
- borderEndWidth?: number | SharedValue<number | undefined> | undefined;
88
- borderLeftWidth?: number | SharedValue<number | undefined> | undefined;
89
- borderRightWidth?: number | SharedValue<number | undefined> | undefined;
90
- borderStartWidth?: number | SharedValue<number | undefined> | undefined;
91
- borderTopWidth?: number | SharedValue<number | undefined> | undefined;
92
- borderWidth?: number | SharedValue<number | undefined> | undefined;
93
- bottom?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
94
- display?: "flex" | "none" | SharedValue<"flex" | "none" | undefined> | undefined;
95
- end?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
96
- flex?: number | SharedValue<number | undefined> | undefined;
97
- flexBasis?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
98
- flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | SharedValue<"row" | "column" | "row-reverse" | "column-reverse" | undefined> | undefined;
99
- rowGap?: string | number | SharedValue<string | number | undefined> | undefined;
100
- gap?: string | number | SharedValue<string | number | undefined> | undefined;
101
- columnGap?: string | number | SharedValue<string | number | undefined> | undefined;
102
- flexGrow?: number | SharedValue<number | undefined> | undefined;
103
- flexShrink?: number | SharedValue<number | undefined> | undefined;
104
- flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | SharedValue<"wrap" | "nowrap" | "wrap-reverse" | undefined> | undefined;
105
- height?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
106
- justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | SharedValue<"center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined> | undefined;
107
- left?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
108
- margin?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
109
- marginBottom?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
110
- marginEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
111
- marginHorizontal?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
112
- marginLeft?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
113
- marginRight?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
114
- marginStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
115
- marginTop?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
116
- marginVertical?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
117
- maxHeight?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
118
- maxWidth?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
119
- minHeight?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
120
- minWidth?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
121
- overflow?: "visible" | "hidden" | "scroll" | SharedValue<"visible" | "hidden" | "scroll" | undefined> | undefined;
122
- padding?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
123
- paddingBottom?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
124
- paddingEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
125
- paddingHorizontal?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
126
- paddingLeft?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
127
- paddingRight?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
128
- paddingStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
129
- paddingTop?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
130
- paddingVertical?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
131
- position?: "absolute" | "relative" | "static" | SharedValue<"absolute" | "relative" | "static" | undefined> | undefined;
132
- right?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
133
- start?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
134
- top?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
135
- width?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
136
- zIndex?: number | SharedValue<number | undefined> | undefined;
137
- direction?: "inherit" | "ltr" | "rtl" | SharedValue<"inherit" | "ltr" | "rtl" | undefined> | undefined;
138
- inset?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
139
- insetBlock?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
140
- insetBlockEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
141
- insetBlockStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
142
- insetInline?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
143
- insetInlineEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
144
- insetInlineStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
145
- marginBlock?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
146
- marginBlockEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
147
- marginBlockStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
148
- marginInline?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
149
- marginInlineEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
150
- marginInlineStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
151
- paddingBlock?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
152
- paddingBlockEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
153
- paddingBlockStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
154
- paddingInline?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
155
- paddingInlineEnd?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
156
- paddingInlineStart?: import("react-native").DimensionValue | SharedValue<import("react-native").DimensionValue | undefined> | undefined;
157
- shadowColor?: import("react-native").ColorValue | SharedValue<import("react-native").ColorValue | undefined> | undefined;
158
- shadowOffset?: Readonly<{
159
- width: number;
160
- height: number;
161
- }> | SharedValue<Readonly<{
162
- width: number;
163
- height: number;
164
- }> | undefined> | undefined;
165
- shadowOpacity?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
166
- shadowRadius?: number | SharedValue<number | undefined> | undefined;
167
- transformOrigin?: string | (string | number)[] | SharedValue<string | (string | number)[] | undefined> | undefined;
168
- transformMatrix?: number[] | SharedValue<number[] | undefined> | undefined;
169
- rotation?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
170
- scaleX?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
171
- scaleY?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
172
- translateX?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
173
- translateY?: import("react-native").AnimatableNumericValue | SharedValue<import("react-native").AnimatableNumericValue | undefined> | undefined;
174
- };
175
- };
176
- itemOffset: SharedValue<number[]>;
177
- itemHeight: SharedValue<number[]>;
178
- draggedIndex: SharedValue<number>;
179
- dragY: SharedValue<number>;
180
- duration: SharedValue<number>;
181
- };
182
- export {};
183
- //# sourceMappingURL=useReorderableListCore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReorderableListCore.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/useReorderableListCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,UAAU,EAEX,MAAM,cAAc,CAAC;AAQtB,OAAiB,EAGf,WAAW,EAYZ,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAE5B,MAAM,aAAa,CAAC;AAOrB,UAAU,0BAA0B,CAAC,CAAC;IACpC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,SAAS,CAAC;IACvE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACxD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,+BAA+B,KAAK,IAAI,CAAC;IACjE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,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,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC1D,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,8BAA8B,EAAE,OAAO,GAAG,SAAS,CAAC;IACpD,cAAc,EAAE,6BAA6B,GAAG,SAAS,CAAC;IAC1D,sBAAsB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED,eAAO,MAAM,sBAAsB;;;;;uBA8tBvB,MAAM;;;;;6CAvqBN,MAAM,MAAM,MAAM,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2wBtC,CAAC"}
@@ -1,178 +0,0 @@
1
- import React, {useCallback, useMemo} from 'react';
2
- import {
3
- CellRendererProps,
4
- FlatList,
5
- FlatListProps,
6
- Platform,
7
- ScrollView,
8
- } from 'react-native';
9
-
10
- import {
11
- Gesture,
12
- GestureDetector,
13
- NativeGesture,
14
- } from 'react-native-gesture-handler';
15
- import Animated, {
16
- SharedValue,
17
- useComposedEventHandler,
18
- } from 'react-native-reanimated';
19
-
20
- import {AUTOSCROLL_CONFIG} from './autoscrollConfig';
21
- import {useReorderableListCore} from './useReorderableListCore';
22
- import {ReorderableListContext} from '../../contexts';
23
- import type {ReorderableListProps} from '../../types';
24
- import {ReorderableListCell} from '../ReorderableListCell';
25
-
26
- const AnimatedFlatList = Animated.createAnimatedComponent(
27
- FlatList,
28
- ) as unknown as <T>(
29
- props: FlatListProps<T> & {ref?: React.Ref<FlatList<T>>},
30
- ) => React.ReactElement;
31
-
32
- interface ReorderableListCoreProps<T> extends ReorderableListProps<T> {
33
- // not optional but undefined to avoid forgetting to pass a prop
34
- scrollViewContainerRef: React.RefObject<ScrollView> | undefined;
35
- scrollViewPageY: SharedValue<number> | undefined;
36
- scrollViewHeightY: SharedValue<number> | undefined;
37
- scrollViewScrollOffsetY: SharedValue<number> | undefined;
38
- scrollViewScrollEnabled: SharedValue<boolean> | undefined;
39
- outerScrollGesture: NativeGesture | undefined;
40
- initialScrollViewScrollEnabled: boolean | undefined;
41
- scrollable: boolean | undefined;
42
- scrollEnabled: boolean | undefined;
43
- }
44
-
45
- const ReorderableListCore = <T,>(
46
- {
47
- autoscrollThreshold = 0.1,
48
- autoscrollThresholdOffset,
49
- autoscrollSpeedScale = 1,
50
- autoscrollDelay = AUTOSCROLL_CONFIG.delay,
51
- autoscrollActivationDelta = 5,
52
- animationDuration = 200,
53
- onLayout,
54
- onReorder,
55
- onScroll,
56
- onDragStart,
57
- onDragEnd,
58
- onIndexChange,
59
- scrollViewContainerRef,
60
- scrollViewPageY,
61
- scrollViewHeightY,
62
- scrollViewScrollOffsetY,
63
- scrollViewScrollEnabled,
64
- initialScrollViewScrollEnabled,
65
- scrollable,
66
- outerScrollGesture,
67
- cellAnimations,
68
- shouldUpdateActiveItem,
69
- panEnabled = true,
70
- panActivateAfterLongPress,
71
- ...rest
72
- }: ReorderableListCoreProps<T>,
73
- ref: React.ForwardedRef<FlatList<T>>,
74
- ) => {
75
- const {
76
- gestureHandler,
77
- handleScroll,
78
- handleFlatListLayout,
79
- handleRef,
80
- startDrag,
81
- listContextValue,
82
- itemOffset,
83
- itemHeight,
84
- dragY,
85
- draggedIndex,
86
- duration,
87
- } = useReorderableListCore({
88
- ref,
89
- autoscrollThreshold,
90
- autoscrollThresholdOffset,
91
- autoscrollSpeedScale,
92
- autoscrollDelay,
93
- autoscrollActivationDelta,
94
- animationDuration,
95
- onLayout,
96
- onReorder,
97
- onDragStart,
98
- onDragEnd,
99
- onIndexChange,
100
- scrollViewContainerRef,
101
- scrollViewPageY,
102
- scrollViewHeightY,
103
- scrollViewScrollOffsetY,
104
- scrollViewScrollEnabled,
105
- scrollable,
106
- // flatlist will default to true if we pass explicitly undefined,
107
- // but internally we would treat it as false, so we force true
108
- initialScrollEnabled:
109
- typeof rest.scrollEnabled === 'undefined' ? true : rest.scrollEnabled,
110
- initialScrollViewScrollEnabled:
111
- typeof initialScrollViewScrollEnabled === 'undefined'
112
- ? true
113
- : initialScrollViewScrollEnabled,
114
- cellAnimations,
115
- shouldUpdateActiveItem,
116
- panEnabled,
117
- panActivateAfterLongPress,
118
- });
119
-
120
- const combinedGesture = useMemo(() => {
121
- // android is able to handle nested scroll view, but not the full height ones like iOS
122
- if (outerScrollGesture && !(Platform.OS === 'android' && scrollable)) {
123
- return Gesture.Simultaneous(outerScrollGesture, gestureHandler);
124
- }
125
-
126
- return gestureHandler;
127
- }, [scrollable, outerScrollGesture, gestureHandler]);
128
-
129
- const composedScrollHandler = useComposedEventHandler([
130
- handleScroll,
131
- onScroll || null,
132
- ]);
133
-
134
- const renderAnimatedCell = useCallback(
135
- ({cellKey, ...props}: CellRendererProps<T>) => (
136
- <ReorderableListCell
137
- {...props}
138
- // forces remount with key change on reorder
139
- key={`${cellKey}+${props.index}`}
140
- itemOffset={itemOffset}
141
- itemHeight={itemHeight}
142
- dragY={dragY}
143
- draggedIndex={draggedIndex}
144
- animationDuration={duration}
145
- startDrag={startDrag}
146
- />
147
- ),
148
- [itemOffset, itemHeight, dragY, draggedIndex, duration, startDrag],
149
- );
150
-
151
- return (
152
- <ReorderableListContext.Provider value={listContextValue}>
153
- <GestureDetector gesture={combinedGesture}>
154
- <AnimatedFlatList
155
- {...rest}
156
- ref={handleRef}
157
- CellRendererComponent={renderAnimatedCell}
158
- onLayout={handleFlatListLayout}
159
- onScroll={composedScrollHandler}
160
- scrollEventThrottle={1}
161
- horizontal={false}
162
- removeClippedSubviews={false}
163
- numColumns={1}
164
- />
165
- </GestureDetector>
166
- </ReorderableListContext.Provider>
167
- );
168
- };
169
-
170
- const MemoizedReorderableListCore = React.memo(
171
- React.forwardRef(ReorderableListCore),
172
- ) as <T>(
173
- props: ReorderableListCoreProps<T> & {
174
- ref?: React.ForwardedRef<FlatList<T> | null>;
175
- },
176
- ) => React.ReactElement;
177
-
178
- export {MemoizedReorderableListCore as ReorderableListCore};
@@ -1,31 +0,0 @@
1
- import {Platform} from 'react-native';
2
-
3
- const IOS_CONFIG = {
4
- delay: 80,
5
- increment: 100,
6
- };
7
-
8
- const ANDROID_FABRIC_CONFIG = {
9
- delay: 50,
10
- increment: 80,
11
- };
12
-
13
- const ANDROID_PAPER_CONFIG = {
14
- delay: 10,
15
- increment: 4,
16
- };
17
-
18
- export const IS_FABRIC =
19
- global && typeof global === 'object' && 'nativeFabricUIManager' in global;
20
-
21
- export const AUTOSCROLL_CONFIG = Platform.select({
22
- // autoscroll behaves differently with Fabric and Paper on Android
23
- android: IS_FABRIC ? ANDROID_FABRIC_CONFIG : ANDROID_PAPER_CONFIG,
24
- ios: IOS_CONFIG,
25
-
26
- // unsupported platforms
27
- web: IOS_CONFIG,
28
- macos: IOS_CONFIG,
29
- windows: IOS_CONFIG,
30
- native: IOS_CONFIG,
31
- });
@@ -1 +0,0 @@
1
- export * from './ReorderableListCore';