react-native-reorderable-list 0.7.1 → 0.9.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.
Files changed (104) hide show
  1. package/README.md +131 -47
  2. package/lib/commonjs/components/ReorderableList.js +11 -13
  3. package/lib/commonjs/components/ReorderableList.js.map +1 -1
  4. package/lib/commonjs/components/ReorderableListCell.js +44 -31
  5. package/lib/commonjs/components/ReorderableListCell.js.map +1 -1
  6. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +18 -17
  7. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  8. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js +34 -0
  9. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js.map +1 -0
  10. package/lib/commonjs/components/ReorderableListCore/{constants.js → autoscrollConfig.js} +1 -1
  11. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  12. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js +82 -33
  13. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  14. package/lib/commonjs/components/ScrollViewContainer.js +2 -2
  15. package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
  16. package/lib/commonjs/components/index.js +0 -11
  17. package/lib/commonjs/components/index.js.map +1 -1
  18. package/lib/commonjs/contexts/ReorderableCellContext.js.map +1 -1
  19. package/lib/commonjs/contexts/ReorderableListContext.js.map +1 -1
  20. package/lib/commonjs/hooks/index.js +11 -0
  21. package/lib/commonjs/hooks/index.js.map +1 -1
  22. package/lib/commonjs/hooks/useIsActive.js +16 -0
  23. package/lib/commonjs/hooks/useIsActive.js.map +1 -0
  24. package/lib/commonjs/index.js +6 -6
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/types/misc.js +3 -3
  27. package/lib/module/components/ReorderableList.js +11 -13
  28. package/lib/module/components/ReorderableList.js.map +1 -1
  29. package/lib/module/components/ReorderableListCell.js +45 -32
  30. package/lib/module/components/ReorderableListCell.js.map +1 -1
  31. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +17 -15
  32. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  33. package/lib/module/components/ReorderableListCore/animationDefaults.js +28 -0
  34. package/lib/module/components/ReorderableListCore/animationDefaults.js.map +1 -0
  35. package/lib/module/components/ReorderableListCore/{constants.js → autoscrollConfig.js} +1 -1
  36. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  37. package/lib/module/components/ReorderableListCore/useReorderableListCore.js +82 -33
  38. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  39. package/lib/module/components/ScrollViewContainer.js +3 -3
  40. package/lib/module/components/ScrollViewContainer.js.map +1 -1
  41. package/lib/module/components/index.js +0 -1
  42. package/lib/module/components/index.js.map +1 -1
  43. package/lib/module/contexts/ReorderableCellContext.js.map +1 -1
  44. package/lib/module/contexts/ReorderableListContext.js.map +1 -1
  45. package/lib/module/hooks/index.js +1 -0
  46. package/lib/module/hooks/index.js.map +1 -1
  47. package/lib/module/hooks/useIsActive.js +9 -0
  48. package/lib/module/hooks/useIsActive.js.map +1 -0
  49. package/lib/module/index.js +3 -3
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/types/misc.js +3 -3
  52. package/lib/typescript/components/ReorderableList.d.ts.map +1 -1
  53. package/lib/typescript/components/ReorderableListCell.d.ts +1 -1
  54. package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -1
  55. package/lib/typescript/components/ReorderableListCore/ReorderableListCore.d.ts.map +1 -1
  56. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts +13 -0
  57. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts.map +1 -0
  58. package/lib/typescript/components/ReorderableListCore/{constants.d.ts → autoscrollConfig.d.ts} +1 -1
  59. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts.map +1 -0
  60. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +11 -4
  61. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +1 -1
  62. package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
  63. package/lib/typescript/components/index.d.ts +0 -1
  64. package/lib/typescript/components/index.d.ts.map +1 -1
  65. package/lib/typescript/contexts/ReorderableCellContext.d.ts +1 -0
  66. package/lib/typescript/contexts/ReorderableCellContext.d.ts.map +1 -1
  67. package/lib/typescript/contexts/ReorderableListContext.d.ts +3 -0
  68. package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -1
  69. package/lib/typescript/hooks/index.d.ts +1 -0
  70. package/lib/typescript/hooks/index.d.ts.map +1 -1
  71. package/lib/typescript/hooks/useIsActive.d.ts +2 -0
  72. package/lib/typescript/hooks/useIsActive.d.ts.map +1 -0
  73. package/lib/typescript/index.d.ts +4 -4
  74. package/lib/typescript/index.d.ts.map +1 -1
  75. package/lib/typescript/types/misc.d.ts +3 -3
  76. package/lib/typescript/types/misc.d.ts.map +1 -1
  77. package/lib/typescript/types/props.d.ts +31 -31
  78. package/lib/typescript/types/props.d.ts.map +1 -1
  79. package/package.json +5 -5
  80. package/src/components/ReorderableList.tsx +14 -16
  81. package/src/components/ReorderableListCell.tsx +38 -33
  82. package/src/components/ReorderableListCore/ReorderableListCore.tsx +22 -13
  83. package/src/components/ReorderableListCore/animationDefaults.ts +35 -0
  84. package/src/components/ReorderableListCore/useReorderableListCore.ts +117 -40
  85. package/src/components/ScrollViewContainer.tsx +7 -3
  86. package/src/components/index.ts +0 -1
  87. package/src/contexts/ReorderableCellContext.ts +1 -0
  88. package/src/contexts/ReorderableListContext.ts +3 -0
  89. package/src/hooks/index.ts +1 -0
  90. package/src/hooks/useIsActive.ts +7 -0
  91. package/src/index.ts +6 -6
  92. package/src/types/misc.ts +3 -3
  93. package/src/types/props.ts +32 -37
  94. package/lib/commonjs/components/ReorderableListCore/constants.js.map +0 -1
  95. package/lib/commonjs/components/ReorderableListItem.js +0 -87
  96. package/lib/commonjs/components/ReorderableListItem.js.map +0 -1
  97. package/lib/module/components/ReorderableListCore/constants.js.map +0 -1
  98. package/lib/module/components/ReorderableListItem.js +0 -78
  99. package/lib/module/components/ReorderableListItem.js.map +0 -1
  100. package/lib/typescript/components/ReorderableListCore/constants.d.ts.map +0 -1
  101. package/lib/typescript/components/ReorderableListItem.d.ts +0 -4
  102. package/lib/typescript/components/ReorderableListItem.d.ts.map +0 -1
  103. package/src/components/ReorderableListItem.tsx +0 -108
  104. /package/src/components/ReorderableListCore/{constants.ts → autoscrollConfig.ts} +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- ![NPM Downloads](https://img.shields.io/npm/dm/react-native-reorderable-list)
2
- ![GitHub License](https://img.shields.io/github/license/omahili/react-native-reorderable-list)
3
- ![NPM Version](https://img.shields.io/npm/v/react-native-reorderable-list)
1
+ [![NPM Downloads](https://img.shields.io/npm/dm/react-native-reorderable-list)](https://www.npmjs.com/package/react-native-reorderable-list)
2
+ [![GitHub License](https://img.shields.io/github/license/omahili/react-native-reorderable-list)](https://github.com/omahili/react-native-reorderable-list?tab=MIT-1-ov-file#readme)
3
+ [![NPM Version](https://img.shields.io/npm/v/react-native-reorderable-list)](https://www.npmjs.com/package/react-native-reorderable-list?activeTab=versions)
4
4
  <br />
5
5
  ![iOS](https://img.shields.io/badge/platform-iOS-000.svg?logo=apple)
6
6
  ![Android](https://img.shields.io/badge/platform-Android-3ddc84.svg?logo=android)
@@ -17,19 +17,23 @@ A reorderable list for React Native applications, powered by Reanimated 🚀
17
17
  - [Install](#install)
18
18
  - [Components](#components)
19
19
  - [ReorderableList](#reorderablelist)
20
- - [ReorderableListItem](#reorderablelistitem)
21
20
  - [ScrollViewContainer](#scrollviewcontainer)
22
21
  - [NestedReorderableList](#nestedreorderablelist)
23
22
  - [Hooks](#hooks)
24
23
  - [useReorderableDrag](#usereorderabledrag)
25
24
  - [useReorderableDragStart](#usereorderabledragstart)
26
25
  - [useReorderableDragEnd](#usereorderabledragend)
26
+ - [useIsActive](#useisactive)
27
27
  - [Utils](#utils)
28
+ - [Troubleshooting](#troubleshooting)
29
+ - [RefreshControl](#refreshcontrol)
28
30
  - [Example](#example)
29
31
  - [License](#license)
30
32
 
31
33
  ## Install
32
34
 
35
+ > **NOTE**: This package follows [semantic versioning](https://semver.org/). Versions 0.X.0 are safe to use but may introduce breaking changes, as the public API is not considered stable yet.
36
+
33
37
  Npm:
34
38
 
35
39
  ```bash
@@ -44,8 +48,8 @@ yarn add react-native-reorderable-list
44
48
 
45
49
  Then you need to install these two peer dependencies:
46
50
 
47
- - [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated) >=3.6.0
48
- - [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler) >=2.0.0
51
+ - [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated) >=3.12.0
52
+ - [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler) >=2.12.0
49
53
 
50
54
  ## Components
51
55
 
@@ -53,16 +57,21 @@ Then you need to install these two peer dependencies:
53
57
 
54
58
  This component uses a [FlatList](https://reactnative.dev/docs/flatlist) and it extends its props:
55
59
 
56
- | Props | Type | Required | Default | Description |
57
- | -------------------- | ------------------------------------------------ | -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
- | autoscrollThreshold | `number` | No | `0.1` | Threshold at the extremity of the list that triggers autoscroll when an item is dragged to it. A value of `0.1` means that 10% of the area at the top and 10% at the bottom will trigger autoscroll. Min value: `0`. Max value: `0.4`. |
59
- | autoscrollSpeedScale | `number` | No | `1` | Scales the autoscroll speed at which the list scrolls when an item is dragged to the scroll areas. |
60
- | autoscrollDelay | `number` | No | `0` (Android), `100` (iOS) | Delay in between autoscroll triggers. Can be used to tune the autoscroll smoothness. Default values differ between platforms: `0` for Android and `100` for iOS. |
61
- | dragReorderThreshold | `number` | No | `0.2` | Specifies the fraction of an item's size at which it will shift when a dragged item crosses over it. For example, `0.2` means the item shifts when the dragged item passes 20% of its height (in a vertical list). |
62
- | animationDuration | `number` | No | `200` | Duration of the animations in milliseconds. Users won't be able to drag a new item until the dragged item is released and its animation to its new position ends. |
63
- | onReorder | `(event: { from: number, to: number }) => void` | Yes | N/A | Event fired after an item is released and the list is reordered. |
64
- | onDragEnd | `(event: { from: number, to: number }) => void` | No | N/A | Event fired when the dragged item is released. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
65
- | onScroll | `(event: NativeScrollEvent) => void` | No | N/A | Event fired at most once per frame during scrolling. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
60
+ | Props | Type | Required | Default | Description |
61
+ | ------------------------- | -------------------------------------------------------------------------------- | -------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | autoscrollThreshold | `number` | No | `0.1` | Threshold at the extremity of the list that triggers autoscroll when an item is dragged to it. A value of `0.1` means that 10% of the area at the top and 10% at the bottom will trigger autoscroll. Min value: `0`. Max value: `0.4`. |
63
+ | autoscrollSpeedScale | `number` | No | `1` | Scales the autoscroll speed at which the list scrolls when an item is dragged to the scroll areas. |
64
+ | autoscrollDelay | `number` | No | `0` (Android), `100` (iOS) | Delay in between autoscroll triggers. Can be used to tune the autoscroll smoothness. Default values differ between platforms: `0` for Android and `100` for iOS. |
65
+ | dragReorderThreshold | `number` | No | `0.2` | Specifies the fraction of an item's size at which it will shift when a dragged item crosses over it. For example, `0.2` means the item shifts when the dragged item passes 20% of its height (in a vertical list). |
66
+ | animationDuration | `number` | No | `200` | Duration of the animations in milliseconds. Users won't be able to drag a new item until the dragged item is released and its animation to its new position ends. |
67
+ | cellAnimations | `{ scale: SharedValue<number> \| false, opacity: SharedValue<number> \| false }` | No | N/A | Allows passing an object with shared values that can animate a cell by using the `onDragStart` and `onDragEnd` events. Set the property in the object to false to disable the animation. Check the [examples](https://github.com/omahili/react-native-reorderable-list/tree/master/example) for more details. |
68
+ | shouldUpdateActiveItem | boolean | No | `false` | Whether the active item should be updated. Enables usage of `useIsActive` hook. |
69
+ | panEnabled | `boolean` | No | `true` | Wether the pan gestures necessary for dragging are enabled. |
70
+ | panActivateAfterLongPress | `number` | No | N/A | Duration in milliseconds a the long press on the list before pan gestures, necessary for dragging, are allowed to activate. |
71
+ | onReorder | `(event: { from: number, to: number }) => void` | Yes | N/A | Event fired after an item is released and the list is reordered. |
72
+ | onDragStart | `(event: { index: number }) => void` | No | N/A | Event fired when an item is dragged. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
73
+ | onDragEnd | `(event: { from: number, to: number }) => void` | No | N/A | Event fired when the dragged item is released. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
74
+ | onScroll | `ReturnType<typeof useAnimatedScrollHandler>` | No | N/A | An animated scroll handler created with useAnimatedScrollHandler. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
66
75
 
67
76
  The following props from FlatList are not supported:
68
77
 
@@ -72,22 +81,13 @@ The following props from FlatList are not supported:
72
81
  - CellRendererComponent
73
82
  - numColumns
74
83
 
75
- ### ReorderableListItem
76
-
77
- This component allows you to animate the item when it's dragged. It currently supports two animations: `scale` and `opacity`. Using this component is optional.
78
-
79
- | Props | Type | Required | Default | Description |
80
- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
81
- | scaleAnimationConfig | `{ enabled?: boolean, valueEnd?: number, valueStart?: number, easingEnd?: EasingFunction, easingStart?: EasingFunction, duration?: number }` | false | `{ enabled: true, valueEnd: 1, valueStart: 1.025, easingStart: Easing.in(Easing.ease), easingEnd: Easing.out(Easing.ease), duration: 200 }` | Configures the scale animation of the reorderable item. |
82
- | opacityAnimationConfig | `{ enabled?: boolean, valueEnd?: number, valueStart?: number, easingEnd?: EasingFunction, easingStart?: EasingFunction, duration?: number }` | false | `{ enabled: true, valueEnd: 1, valueStart: 0.75, easingStart: Easing.in(Easing.ease), easingEnd: Easing.out(Easing.ease), duration: 200, }` | Configures the opacity animation of the reorderable item. |
83
-
84
84
  ### ScrollViewContainer
85
85
 
86
86
  This component extends the [ScrollView](https://reactnative.dev/docs/scrollview) component and is used for nesting a [NestedReorderableList](#nestedreorderablelist) within a scrollable container:
87
87
 
88
- | Props | Type | Required | Default | Description |
89
- | -------- | ------------------------------------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
90
- | onScroll | `(event: NativeScrollEvent) => void` | No | N/A | Event fired at most once per frame during scrolling. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
88
+ | Props | Type | Required | Default | Description |
89
+ | -------- | --------------------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
90
+ | onScroll | `ReturnType<typeof useAnimatedScrollHandler>` | No | N/A | An animated scroll handler created with useAnimatedScrollHandler. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
91
91
 
92
92
  ### NestedReorderableList
93
93
 
@@ -109,19 +109,52 @@ This hook creates a function that triggers the drag of a list item. It's usually
109
109
 
110
110
  ### useReorderableDragStart
111
111
 
112
- This hook allows handling the drag start event of a list item. It receives a worklet callback that is called when the drag starts. It's recommended to wrap the handler function in a useCallback as follows: `useReorderableDragStart(useCallback(...))`. This hook can only be used inside of a list item component.
112
+ This hook allows handling the drag start event of a list item. This hook can only be used inside of a list item component. It receives a worklet callback that is called when the drag starts. It's recommended to wrap the handler function in a useCallback as follows:
113
113
 
114
- ##### Parameters
114
+ ```typescript
115
+ useReorderableDragStart(
116
+ useCallback((index: number) => {
117
+ 'worklet';
115
118
 
116
- - onStart: `(index: number) => void`
119
+ // ...
120
+ }, []),
121
+ );
122
+ ```
123
+
124
+ Using this hook in large lists is discouraged due to performance bottlenecks, prefer `onDragStart` on the ReorderableList instead.
117
125
 
118
126
  ### useReorderableDragEnd
119
127
 
120
- This hook allows handling the drag end event of a list item. It receives a worklet callback that is called when the drag ends. It's recommended to wrap the handler function in a useCallback as follows: `useReorderableDragEnd(useCallback(...))`. This hook can only be used inside of a list item component.
128
+ This hook allows handling the drag end event of a list item. This hook can only be used inside of a list item component. It receives a worklet callback that is called when the drag starts. It's recommended to wrap the handler function in a useCallback as follows:
129
+
130
+ ```typescript
131
+ useReorderableDragEnd(
132
+ useCallback((from: number, to: number) => {
133
+ 'worklet';
134
+
135
+ // ...
136
+ }, []),
137
+ );
138
+ ```
139
+
140
+ Using this hook in large lists is discouraged due to performance bottlenecks, prefer `onDragEnd` on the ReorderableList instead.
121
141
 
122
- ##### Parameters
142
+ ### useIsActive
123
143
 
124
- - onEnd: `(from: number, to: number) => void`
144
+ This hook returns a boolean indicating whether the current item is active. It will return true on drag start and false on drag end. This hook can only be used inside of a list item component.
145
+
146
+ ```typescript
147
+ const isActive = useIsActive();
148
+ ```
149
+
150
+ Additionally this hook requires setting `shouldUpdateActiveItem` to true on the ReorderableList:
151
+
152
+ ```typescript
153
+ <ReorderableList
154
+ // ...
155
+ shouldUpdateActiveItem
156
+ />
157
+ ```
125
158
 
126
159
  ## Utils
127
160
 
@@ -129,15 +162,69 @@ This hook allows handling the drag end event of a list item. It receives a workl
129
162
 
130
163
  This function receives an array of items, the index of the item to be moved, and the index of the new position and it returns a new array with the items reordered.
131
164
 
165
+ ## Troubleshooting
166
+
167
+ ### RefreshControl
168
+
169
+ If you want to use RefreshControl with ReorderableList you might encounter some issues on Android, where gestures are conflicting making one or both of the components non responsive. To overcome this issues you can delay the activation of pan gestures necessary for dragging items by using the `panActivateAfterLongPress` prop. This duration should be slightly longer than the long press delay necessary to drag your items. If you're using Pressable the `delayLongPress` is 500 ms by default.
170
+
171
+ ```typescript
172
+ <ReorderableList
173
+ // ...
174
+ panActivateAfterLongPress={Platform.OS === 'android' ? 520 : undefined}
175
+ />
176
+ ```
177
+
178
+ If you change `delayLongPress` on your Pressable, update this prop accordingly.
179
+
180
+ Another issue you'll encounter is that when you drag your items the RefreshControl might animate. To avoid this you can enable and disable it on drag start and drag end like so:
181
+
182
+ ```typescript
183
+ const [refreshEnabled, setRefreshEnabled] = useState(true);
184
+
185
+ const handleDragStart = useCallback(() => {
186
+ 'worklet';
187
+
188
+ // NOTE: if it's refreshing we don't want the refresh control to disappear
189
+ // and we can keep it enabled since it won't conflict with the drag
190
+ if (Platform.OS === 'android' && !refreshing) {
191
+ runOnJS(setRefreshEnabled)(false);
192
+ }
193
+ }, [refreshing]);
194
+
195
+ const handleDragEnd = useCallback(() => {
196
+ 'worklet';
197
+
198
+ // NOTE: if it's refreshing we don't want the refresh control to disappear
199
+ // and we can keep it enabled since it won't conflict with the drag
200
+ if (Platform.OS === 'android' && !refreshing) {
201
+ runOnJS(setRefreshEnabled)(true);
202
+ }
203
+ }, [refreshing]);
204
+
205
+ return (
206
+ <ReorderableList
207
+ // ...
208
+ onDragStart={handleDragStart}
209
+ onDragEnd={handleDragEnd}
210
+ refreshControl={
211
+ <RefreshControl
212
+ // ...
213
+ enabled={refreshEnabled}
214
+ />
215
+ }
216
+ />
217
+ );
218
+ ```
219
+
132
220
  ## Example
133
221
 
134
222
  Here is simple example of how to use this component. Examples of nested lists and much more can be found in the [example](https://github.com/omahili/react-native-reorderable-list/tree/feat/nested-lists/example) directory.
135
223
 
136
224
  ```typescript
137
- import React, {useState} from 'react';
225
+ import React, {memo, useState} from 'react';
138
226
  import {ListRenderItemInfo, Pressable, StyleSheet, Text} from 'react-native';
139
227
  import ReorderableList, {
140
- ReorderableListItem,
141
228
  ReorderableListReorderEvent,
142
229
  reorderItems,
143
230
  useReorderableDrag,
@@ -162,30 +249,27 @@ const list: CardProps[] = [
162
249
  {id: '9', color: 'seagreen', height: 90},
163
250
  ];
164
251
 
165
- const Card: React.FC<CardProps> = React.memo(({id, color, height}) => {
252
+ const Card: React.FC<CardProps> = memo(({id, color, height}) => {
166
253
  const drag = useReorderableDrag();
167
254
 
168
255
  return (
169
- <ReorderableListItem>
170
- <Pressable style={[styles.card, {height}]} onLongPress={drag}>
171
- <Text style={[styles.text, {color}]}>Card {id}</Text>
172
- </Pressable>
173
- </ReorderableListItem>
256
+ <Pressable style={[styles.card, {height}]} onLongPress={drag}>
257
+ <Text style={[styles.text, {color}]}>Card {id}</Text>
258
+ </Pressable>
174
259
  );
175
260
  });
176
261
 
177
262
  const Example = () => {
178
263
  const [data, setData] = useState(list);
179
264
 
265
+ const handleReorder = ({from, to}: ReorderableListReorderEvent) => {
266
+ setData(value => reorderItems(value, from, to));
267
+ };
268
+
180
269
  const renderItem = ({item}: ListRenderItemInfo<CardProps>) => (
181
270
  <Card {...item} />
182
271
  );
183
272
 
184
- const handleReorder = ({from, to}: ReorderableListReorderEvent) => {
185
- const newData = reorderItems(data, from, to);
186
- setData(newData);
187
- };
188
-
189
273
  return (
190
274
  <ReorderableList
191
275
  data={data}
@@ -12,18 +12,16 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
12
12
  const ReorderableListWithRef = ({
13
13
  scrollEnabled = true,
14
14
  ...rest
15
- }, ref) => {
16
- return /*#__PURE__*/_react.default.createElement(_ReorderableListCore.ReorderableListCore, _extends({}, rest, {
17
- ref: ref,
18
- scrollEnabled: scrollEnabled,
19
- initialScrollViewScrollEnabled: true,
20
- scrollable: true,
21
- scrollViewContainerRef: undefined,
22
- scrollViewScrollOffsetY: undefined,
23
- scrollViewHeightY: undefined,
24
- outerScrollGesture: undefined,
25
- scrollViewScrollEnabled: undefined
26
- }));
27
- };
15
+ }, ref) => /*#__PURE__*/_react.default.createElement(_ReorderableListCore.ReorderableListCore, _extends({}, rest, {
16
+ ref: ref,
17
+ scrollEnabled: scrollEnabled,
18
+ initialScrollViewScrollEnabled: true,
19
+ scrollable: true,
20
+ scrollViewContainerRef: undefined,
21
+ scrollViewScrollOffsetY: undefined,
22
+ scrollViewHeightY: undefined,
23
+ outerScrollGesture: undefined,
24
+ scrollViewScrollEnabled: undefined
25
+ }));
28
26
  const ReorderableList = exports.ReorderableList = /*#__PURE__*/(0, _react.forwardRef)(ReorderableListWithRef);
29
27
  //# sourceMappingURL=ReorderableList.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ReorderableListWithRef","scrollEnabled","rest","ref","createElement","ReorderableListCore","initialScrollViewScrollEnabled","scrollable","scrollViewContainerRef","undefined","scrollViewScrollOffsetY","scrollViewHeightY","outerScrollGesture","scrollViewScrollEnabled","ReorderableList","exports","forwardRef"],"sourceRoot":"../../../src","sources":["components/ReorderableList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAA0D,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAA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AU;IAClCC,uBAAuB,EAAED,SAAU;IACnCE,iBAAiB,EAAEF,SAAU;IAC7BG,kBAAkB,EAAEH,SAAU;IAC9BI,uBAAuB,EAAEJ;EAAU,EACpC,CAAC;AAEN,CAAC;AAEM,MAAMK,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,iBAAU,EAAChB,sBAAsB,CAEhD","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ReorderableListWithRef","scrollEnabled","rest","ref","createElement","ReorderableListCore","initialScrollViewScrollEnabled","scrollable","scrollViewContainerRef","undefined","scrollViewScrollOffsetY","scrollViewHeightY","outerScrollGesture","scrollViewScrollEnabled","ReorderableList","exports","forwardRef"],"sourceRoot":"../../../src","sources":["components/ReorderableList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAA0D,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAA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,8BAA8B,EAAE,IAAK;EACrCC,UAAU,EAAE,IAAK;EACjBC,sBAAsB,EAAEC,SAAU;EAClCC,uBAAuB,EAAED,SAAU;EACnCE,iBAAiB,EAAEF,SAAU;EAC7BG,kBAAkB,EAAEH,SAAU;EAC9BI,uBAAuB,EAAEJ;AAAU,EACpC,CACF;AAEM,MAAMK,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,iBAAU,EAAChB,sBAAsB,CAEhD","ignoreList":[]}
@@ -21,57 +21,70 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
21
21
  draggedIndex,
22
22
  animationDuration
23
23
  }) => {
24
- const dragHandler = (0, _react.useCallback)(() => {
25
- 'worklet';
26
-
27
- startDrag(index);
28
- }, [startDrag, index]);
29
- const contextValue = (0, _react.useMemo)(() => ({
30
- index,
31
- dragHandler,
32
- draggedIndex
33
- }), [index, dragHandler, draggedIndex]);
34
24
  const {
35
25
  currentIndex,
36
- draggedHeight
26
+ draggedHeight,
27
+ scale,
28
+ opacity,
29
+ activeIndex
37
30
  } = (0, _hooks.useContext)(_contexts.ReorderableListContext);
38
- const itemZIndex = (0, _reactNativeReanimated.useSharedValue)(0);
39
- const itemPositionY = (0, _reactNativeReanimated.useSharedValue)(0);
40
- const itemDragY = (0, _reactNativeReanimated.useSharedValue)(0);
41
- const itemIndex = (0, _reactNativeReanimated.useSharedValue)(index);
31
+ const dragHandler = (0, _react.useCallback)(() => (0, _reactNativeReanimated.runOnUI)(startDrag)(index), [startDrag, index]);
32
+ const isActive = activeIndex === index;
33
+ const contextValue = (0, _react.useMemo)(() => ({
34
+ index,
35
+ dragHandler,
36
+ draggedIndex,
37
+ isActive
38
+ }), [index, dragHandler, draggedIndex, isActive]);
39
+
40
+ // Keep separate animated reactions that update itemTranslateY
41
+ // otherwise animations might stutter if multiple are triggered
42
+ // (even in other cells, e.g. released item and reordering cells)
43
+ const itemTranslateY = (0, _reactNativeReanimated.useSharedValue)(0);
44
+ const isActiveCell = (0, _reactNativeReanimated.useDerivedValue)(() => draggedIndex.value === index);
42
45
  (0, _reactNativeReanimated.useAnimatedReaction)(() => dragY.value, () => {
43
- if (itemIndex.value === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
44
- itemDragY.value = dragY.value;
46
+ if (index === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
47
+ itemTranslateY.value = dragY.value;
45
48
  }
46
49
  });
47
50
  (0, _reactNativeReanimated.useAnimatedReaction)(() => currentIndex.value, () => {
48
- if (itemIndex.value !== draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
51
+ if (index !== draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
49
52
  const moveDown = currentIndex.value > draggedIndex.value;
50
53
  const startMove = Math.min(draggedIndex.value, currentIndex.value);
51
54
  const endMove = Math.max(draggedIndex.value, currentIndex.value);
52
55
  let newValue = 0;
53
- if (itemIndex.value >= startMove && itemIndex.value <= endMove) {
56
+ if (index >= startMove && index <= endMove) {
54
57
  newValue = moveDown ? -draggedHeight.value : draggedHeight.value;
55
58
  }
56
- if (newValue !== itemPositionY.value) {
57
- itemPositionY.value = (0, _reactNativeReanimated.withTiming)(newValue, {
59
+ if (newValue !== itemTranslateY.value) {
60
+ itemTranslateY.value = (0, _reactNativeReanimated.withTiming)(newValue, {
58
61
  duration: animationDuration.value,
59
62
  easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease)
60
63
  });
61
64
  }
62
65
  }
63
66
  });
64
- (0, _reactNativeReanimated.useAnimatedReaction)(() => draggedIndex.value === index, newValue => {
65
- itemZIndex.value = newValue ? 999 : 0;
67
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
68
+ if (isActiveCell.value) {
69
+ return {
70
+ transform: [{
71
+ translateY: itemTranslateY.value
72
+ }, {
73
+ scale: scale.value
74
+ }],
75
+ opacity: opacity.value,
76
+ zIndex: 999
77
+ };
78
+ }
79
+ return {
80
+ transform: [{
81
+ translateY: itemTranslateY.value
82
+ }],
83
+ // TODO: move to stylesheet when this is fixed
84
+ // https://github.com/software-mansion/react-native-reanimated/issues/6681#issuecomment-2514228447
85
+ zIndex: 0
86
+ };
66
87
  });
67
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
68
- zIndex: itemZIndex.value,
69
- transform: [{
70
- translateY: itemDragY.value
71
- }, {
72
- translateY: itemPositionY.value
73
- }]
74
- }));
75
88
  const handleLayout = e => {
76
89
  (0, _reactNativeReanimated.runOnUI)((y, height) => {
77
90
  itemOffset.value[index] = y;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_contexts","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ReorderableListCell","exports","memo","index","startDrag","children","onLayout","itemOffset","itemHeight","dragY","draggedIndex","animationDuration","dragHandler","useCallback","contextValue","useMemo","currentIndex","draggedHeight","useContext","ReorderableListContext","itemZIndex","useSharedValue","itemPositionY","itemDragY","itemIndex","useAnimatedReaction","value","moveDown","startMove","Math","min","endMove","max","newValue","withTiming","duration","easing","Easing","out","ease","animatedStyle","useAnimatedStyle","zIndex","transform","translateY","handleLayout","runOnUI","y","height","nativeEvent","layout","createElement","ReorderableCellContext","Provider","View","style"],"sourceRoot":"../../../src","sources":["components/ReorderableListCell.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAUA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAoC,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CA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AAW,CAACC,MAAM,CAACH,CAAC,EAAElE,CAAC,CAACoE,WAAW,CAACC,MAAM,CAACF,MAAM,CAAC;IAEvD1C,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAGzB,CAAC,CAAC;EACf,CAAC;EAED,oBACEP,MAAA,CAAAY,OAAA,CAAAiE,aAAA,CAACzE,SAAA,CAAA0E,sBAAsB,CAACC,QAAQ;IAAC3B,KAAK,EAAEZ;EAAa,gBACnDxC,MAAA,CAAAY,OAAA,CAAAiE,aAAA,CAAC1E,sBAAA,CAAAS,OAAQ,CAACoE,IAAI;IAACC,KAAK,EAAEf,aAAc;IAAClC,QAAQ,EAAEuC;EAAa,GACzDxC,QACY,CACgB,CAAC;AAEtC,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_contexts","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ReorderableListCell","exports","memo","index","startDrag","children","onLayout","itemOffset","itemHeight","dragY","draggedIndex","animationDuration","currentIndex","draggedHeight","scale","opacity","activeIndex","useContext","ReorderableListContext","dragHandler","useCallback","runOnUI","isActive","contextValue","useMemo","itemTranslateY","useSharedValue","isActiveCell","useDerivedValue","value","useAnimatedReaction","moveDown","startMove","Math","min","endMove","max","newValue","withTiming","duration","easing","Easing","out","ease","animatedStyle","useAnimatedStyle","transform","translateY","zIndex","handleLayout","y","height","nativeEvent","layout","createElement","ReorderableCellContext","Provider","View","style"],"sourceRoot":"../../../src","sources":["components/ReorderableListCell.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAWA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAoC,SAAAI,yBAAAC,CAAA,6BAAAC,O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,KAAK;MACrC5C,UAAU,CAACsB,KAAK,CAAC1B,KAAK,CAAC,GAAG+C,CAAC;MAC3B1C,UAAU,CAACqB,KAAK,CAAC1B,KAAK,CAAC,GAAGgD,MAAM;IAClC,CAAC,CAAC,CAACtE,CAAC,CAACuE,WAAW,CAACC,MAAM,CAACH,CAAC,EAAErE,CAAC,CAACuE,WAAW,CAACC,MAAM,CAACF,MAAM,CAAC;IAEvD7C,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAGzB,CAAC,CAAC;EACf,CAAC;EAED,oBACEP,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAC5E,SAAA,CAAA6E,sBAAsB,CAACC,QAAQ;IAAC3B,KAAK,EAAEN;EAAa,gBACnDjD,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAC7E,sBAAA,CAAAS,OAAQ,CAACuE,IAAI;IAACC,KAAK,EAAEd,aAAc;IAACtC,QAAQ,EAAE2C;EAAa,GACzD5C,QACY,CACgB,CAAC;AAEtC,CACF,CAAC","ignoreList":[]}
@@ -7,37 +7,37 @@ exports.ReorderableListCore = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _reactNativeGestureHandler = require("react-native-gesture-handler");
10
- var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
11
- var _constants = require("./constants");
10
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
+ var _autoscrollConfig = require("./autoscrollConfig");
12
12
  var _useReorderableListCore = require("./useReorderableListCore");
13
13
  var _contexts = require("../../contexts");
14
14
  var _ReorderableListCell = require("../ReorderableListCell");
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
17
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
19
18
  const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList);
20
19
  const ReorderableListCore = ({
21
- data,
22
20
  autoscrollThreshold = 0.1,
23
21
  autoscrollSpeedScale = 1,
24
- autoscrollDelay = _constants.AUTOSCROLL_CONFIG.delay,
22
+ autoscrollDelay = _autoscrollConfig.AUTOSCROLL_CONFIG.delay,
25
23
  animationDuration = 200,
26
24
  dragReorderThreshold = 0.2,
27
25
  onLayout,
28
26
  onReorder,
29
27
  onScroll,
28
+ onDragStart,
30
29
  onDragEnd,
31
- keyExtractor,
32
- extraData,
33
30
  scrollViewContainerRef,
34
31
  scrollViewHeightY,
35
32
  scrollViewScrollOffsetY,
36
33
  scrollViewScrollEnabled,
37
- scrollEnabled,
38
34
  initialScrollViewScrollEnabled,
39
35
  scrollable,
40
36
  outerScrollGesture,
37
+ cellAnimations,
38
+ shouldUpdateActiveItem,
39
+ panEnabled = true,
40
+ panActivateAfterLongPress,
41
41
  ...rest
42
42
  }, ref) => {
43
43
  const {
@@ -61,7 +61,7 @@ const ReorderableListCore = ({
61
61
  dragReorderThreshold,
62
62
  onLayout,
63
63
  onReorder,
64
- onScroll,
64
+ onDragStart,
65
65
  onDragEnd,
66
66
  scrollViewContainerRef,
67
67
  scrollViewHeightY,
@@ -69,9 +69,13 @@ const ReorderableListCore = ({
69
69
  scrollViewScrollEnabled,
70
70
  // flatlist will default to true if we pass explicitly undefined,
71
71
  // but internally we would treat it as false, so we force true
72
- initialScrollEnabled: typeof scrollEnabled === 'undefined' ? true : scrollEnabled,
72
+ initialScrollEnabled: typeof rest.scrollEnabled === 'undefined' ? true : rest.scrollEnabled,
73
73
  initialScrollViewScrollEnabled: typeof initialScrollViewScrollEnabled === 'undefined' ? true : initialScrollViewScrollEnabled,
74
- nestedScrollable: scrollable
74
+ nestedScrollable: scrollable,
75
+ cellAnimations,
76
+ shouldUpdateActiveItem,
77
+ panEnabled,
78
+ panActivateAfterLongPress
75
79
  });
76
80
  const combinedGesture = (0, _react.useMemo)(() => {
77
81
  // android is able to handle nested scroll view, but not the full height ones like iOS
@@ -80,6 +84,7 @@ const ReorderableListCore = ({
80
84
  }
81
85
  return gestureHandler;
82
86
  }, [scrollable, outerScrollGesture, gestureHandler]);
87
+ const composedScrollHandler = (0, _reactNativeReanimated.useComposedEventHandler)([handleScroll, onScroll || null]);
83
88
  const renderAnimatedCell = (0, _react.useCallback)(({
84
89
  cellKey,
85
90
  ...props
@@ -99,17 +104,13 @@ const ReorderableListCore = ({
99
104
  gesture: combinedGesture
100
105
  }, /*#__PURE__*/_react.default.createElement(AnimatedFlatList, _extends({}, rest, {
101
106
  ref: handleRef,
102
- data: data,
103
107
  CellRendererComponent: renderAnimatedCell,
104
108
  onLayout: handleFlatListLayout,
105
- onScroll: handleScroll,
109
+ onScroll: composedScrollHandler,
106
110
  scrollEventThrottle: 1,
107
111
  horizontal: false,
108
112
  removeClippedSubviews: false,
109
- keyExtractor: keyExtractor,
110
- extraData: extraData,
111
- numColumns: 1,
112
- scrollEnabled: scrollEnabled
113
+ numColumns: 1
113
114
  }))));
114
115
  };
115
116
  const MemoizedReorderableListCore = exports.ReorderableListCore = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef(ReorderableListCore));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_reactNativeReanimated","_interopRequireDefault","_constants","_useReorderableListCore","_contexts","_ReorderableListCell","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","AnimatedFlatList","Animated","createAnimatedComponent","FlatList","ReorderableListCore","data","autoscrollThreshold","autoscrollSpeedScale","autoscrollDelay","AUTOSCROLL_CONFIG","delay","animationDuration","dragReorderThreshold","onLayout","onReorder","onScroll","onDragEnd","keyExtractor","extraData","scrollViewContainerRef","scrollViewHeightY","scrollViewScrollOffsetY","scrollViewScrollEnabled","scrollEnabled","initialScrollViewScrollEnabled","scrollable","outerScrollGesture","rest","ref","gestureHandler","handleScroll","handleFlatListLayout","handleRef","startDrag","listContextValue","itemOffset","itemHeight","dragY","draggedIndex","duration","useReorderableListCore","initialScrollEnabled","nestedScrollable","combinedGesture","useMemo","Platform","OS","Gesture","Simultaneous","renderAnimatedCell","useCallback","cellKey","props","createElement","ReorderableListCell","key","index","ReorderableListContext","Provider","value","GestureDetector","gesture","CellRendererComponent","scrollEventThrottle","horizontal","removeClippedSubviews","numColumns","MemoizedReorderableListCore","exports","React","memo","forwardRef"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/ReorderableListCore.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,sBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,oBAAA,GAAAR,OAAA;AAA2D,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAA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AElB;EAAgB,gBACxChF,MAAA,CAAAa,OAAA,CAAA6E,aAAA,CAACrD,gBAAgB,EAAAN,QAAA,KACXiC,IAAI;IACRC,GAAG,EAAEI,SAAU;IACf3B,IAAI,EAAEA,IAAK;IACXyD,qBAAqB,EAAEb,kBAAmB;IAC1CpC,QAAQ,EAAEkB,oBAAqB;IAC/BhB,QAAQ,EAAEe,YAAa;IACvBiC,mBAAmB,EAAE,CAAE;IACvBC,UAAU,EAAE,KAAM;IAClBC,qBAAqB,EAAE,KAAM;IAC7BhD,YAAY,EAAEA,YAAa;IAC3BC,SAAS,EAAEA,SAAU;IACrBgD,UAAU,EAAE,CAAE;IACd3C,aAAa,EAAEA;EAAc,EAC9B,CACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAM4C,2BAA2B,GAAAC,OAAA,CAAAhE,mBAAA,gBAAGiE,cAAK,CAACC,IAAI,cAC5CD,cAAK,CAACE,UAAU,CAACnE,mBAAmB,CACtC,CAIuB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_reactNativeReanimated","_autoscrollConfig","_useReorderableListCore","_contexts","_ReorderableListCell","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","AnimatedFlatList","Animated","createAnimatedComponent","FlatList","ReorderableListCore","autoscrollThreshold","autoscrollSpeedScale","autoscrollDelay","AUTOSCROLL_CONFIG","delay","animationDuration","dragReorderThreshold","onLayout","onReorder","onScroll","onDragStart","onDragEnd","scrollViewContainerRef","scrollViewHeightY","scrollViewScrollOffsetY","scrollViewScrollEnabled","initialScrollViewScrollEnabled","scrollable","outerScrollGesture","cellAnimations","shouldUpdateActiveItem","panEnabled","panActivateAfterLongPress","rest","ref","gestureHandler","handleScroll","handleFlatListLayout","handleRef","startDrag","listContextValue","itemOffset","itemHeight","dragY","draggedIndex","duration","useReorderableListCore","initialScrollEnabled","scrollEnabled","nestedScrollable","combinedGesture","useMemo","Platform","OS","Gesture","Simultaneous","composedScrollHandler","useComposedEventHandler","renderAnimatedCell","useCallback","cellKey","props","createElement","ReorderableListCell","key","index","ReorderableListContext","Provider","value","GestureDetector","gesture","CellRendererComponent","scrollEventThrottle","horizontal","removeClippedSubviews","numColumns","MemoizedReorderableListCore","exports","React","memo","forwardRef"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/ReorderableListCore.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAKA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,oBAAA,GAAAP,OAAA;AAA2D,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,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