react-native-reorderable-list 0.8.0 → 0.10.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 (66) hide show
  1. package/README.md +104 -32
  2. package/lib/commonjs/components/ReorderableListCell.js +19 -14
  3. package/lib/commonjs/components/ReorderableListCell.js.map +1 -1
  4. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +11 -11
  5. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  6. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js +50 -22
  7. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  8. package/lib/commonjs/components/helpers.js +32 -0
  9. package/lib/commonjs/components/helpers.js.map +1 -0
  10. package/lib/commonjs/contexts/ReorderableCellContext.js.map +1 -1
  11. package/lib/commonjs/contexts/ReorderableListContext.js.map +1 -1
  12. package/lib/commonjs/hooks/index.js +11 -0
  13. package/lib/commonjs/hooks/index.js.map +1 -1
  14. package/lib/commonjs/hooks/useIsActive.js +16 -0
  15. package/lib/commonjs/hooks/useIsActive.js.map +1 -0
  16. package/lib/commonjs/index.js +6 -0
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/commonjs/types/misc.js.map +1 -1
  19. package/lib/module/components/ReorderableListCell.js +19 -14
  20. package/lib/module/components/ReorderableListCell.js.map +1 -1
  21. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +11 -11
  22. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  23. package/lib/module/components/ReorderableListCore/useReorderableListCore.js +51 -23
  24. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  25. package/lib/module/components/helpers.js +25 -0
  26. package/lib/module/components/helpers.js.map +1 -0
  27. package/lib/module/contexts/ReorderableCellContext.js.map +1 -1
  28. package/lib/module/contexts/ReorderableListContext.js.map +1 -1
  29. package/lib/module/hooks/index.js +1 -0
  30. package/lib/module/hooks/index.js.map +1 -1
  31. package/lib/module/hooks/useIsActive.js +9 -0
  32. package/lib/module/hooks/useIsActive.js.map +1 -0
  33. package/lib/module/index.js +2 -2
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/types/misc.js.map +1 -1
  36. package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -1
  37. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +138 -3
  38. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +1 -1
  39. package/lib/typescript/components/helpers.d.ts +11 -0
  40. package/lib/typescript/components/helpers.d.ts.map +1 -0
  41. package/lib/typescript/contexts/ReorderableCellContext.d.ts +1 -0
  42. package/lib/typescript/contexts/ReorderableCellContext.d.ts.map +1 -1
  43. package/lib/typescript/contexts/ReorderableListContext.d.ts +3 -2
  44. package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -1
  45. package/lib/typescript/hooks/index.d.ts +1 -0
  46. package/lib/typescript/hooks/index.d.ts.map +1 -1
  47. package/lib/typescript/hooks/useIsActive.d.ts +2 -0
  48. package/lib/typescript/hooks/useIsActive.d.ts.map +1 -0
  49. package/lib/typescript/index.d.ts +2 -2
  50. package/lib/typescript/index.d.ts.map +1 -1
  51. package/lib/typescript/types/misc.d.ts +9 -0
  52. package/lib/typescript/types/misc.d.ts.map +1 -1
  53. package/lib/typescript/types/props.d.ts +35 -8
  54. package/lib/typescript/types/props.d.ts.map +1 -1
  55. package/package.json +3 -1
  56. package/src/components/ReorderableListCell.tsx +24 -11
  57. package/src/components/ReorderableListCore/ReorderableListCore.tsx +9 -9
  58. package/src/components/ReorderableListCore/useReorderableListCore.ts +68 -20
  59. package/src/components/helpers.ts +36 -0
  60. package/src/contexts/ReorderableCellContext.ts +1 -0
  61. package/src/contexts/ReorderableListContext.ts +4 -2
  62. package/src/hooks/index.ts +1 -0
  63. package/src/hooks/useIsActive.ts +7 -0
  64. package/src/index.ts +2 -0
  65. package/src/types/misc.ts +10 -0
  66. package/src/types/props.ts +71 -8
package/README.md CHANGED
@@ -9,8 +9,7 @@
9
9
 
10
10
  A reorderable list for React Native applications, powered by Reanimated 🚀
11
11
 
12
- ![Playlist](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExM3JpY200bHoxeDVneGV1YTUxaHIxaGNuNjQ3ZjRlZWZ1NmluYjFlZSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/rk5aZKXYVMBktawoTr/giphy.gif)
13
- ![Example](https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExNzBhdWZoM3F4bGlnajB6NGdsbjA3MW54aHk5NGxkZnp3aXJrdDJ6ciZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/oJhSawgWA1OtR1IPgT/giphy.gif)
12
+ ![Demo](https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExanBuODMwN29scmxoNXY0MmZkcHpzZnFxYXE5eTVydzBsbHIyY3ZqMyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/T9uQrEnUCijeJOzSs9/giphy.gif)
14
13
 
15
14
  ## Index
16
15
 
@@ -23,7 +22,10 @@ A reorderable list for React Native applications, powered by Reanimated 🚀
23
22
  - [useReorderableDrag](#usereorderabledrag)
24
23
  - [useReorderableDragStart](#usereorderabledragstart)
25
24
  - [useReorderableDragEnd](#usereorderabledragend)
25
+ - [useIsActive](#useisactive)
26
26
  - [Utils](#utils)
27
+ - [Troubleshooting](#troubleshooting)
28
+ - [RefreshControl](#refreshcontrol)
27
29
  - [Example](#example)
28
30
  - [License](#license)
29
31
 
@@ -54,18 +56,22 @@ Then you need to install these two peer dependencies:
54
56
 
55
57
  This component uses a [FlatList](https://reactnative.dev/docs/flatlist) and it extends its props:
56
58
 
57
- | Props | Type | Required | Default | Description |
58
- | -------------------- | -------------------------------------------------------------------------------- | -------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
- | 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`. |
60
- | autoscrollSpeedScale | `number` | No | `1` | Scales the autoscroll speed at which the list scrolls when an item is dragged to the scroll areas. |
61
- | 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. |
62
- | 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). |
63
- | 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. |
64
- | 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. |
65
- | onReorder | `(event: { from: number, to: number }) => void` | Yes | N/A | Event fired after an item is released and the list is reordered. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info. |
66
- | 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. |
67
- | 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. |
68
- | 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. |
59
+ | Props | Type | Required | Default | Description |
60
+ | ------------------------- | ------------------------------------------------ | -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | 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`. |
62
+ | autoscrollThresholdOffset | `{top?: number; bottom?: number}` | No | `{top: 0, bottom: 0}` | Amount by which the threshold is offset at the extremety of the list. For example, setting `{top: 50}` will make the autoscroll trigger 50 pixels earlier at the top. |
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 | `ReorderableListCellAnimations` | No | N/A | 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: []}`. 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. |
69
75
 
70
76
  The following props from FlatList are not supported:
71
77
 
@@ -133,19 +139,90 @@ useReorderableDragEnd(
133
139
 
134
140
  Using this hook in large lists is discouraged due to performance bottlenecks, prefer `onDragEnd` on the ReorderableList instead.
135
141
 
142
+ ### useIsActive
143
+
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
+ ```
158
+
136
159
  ## Utils
137
160
 
138
161
  - **reorderItems**: `<T>(data: T[], from: number, to: number) => T[]`
139
162
 
140
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.
141
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
+ if (Platform.OS === 'android') {
199
+ runOnJS(setRefreshEnabled)(true);
200
+ }
201
+ }, []);
202
+
203
+ return (
204
+ <ReorderableList
205
+ // ...
206
+ onDragStart={handleDragStart}
207
+ onDragEnd={handleDragEnd}
208
+ refreshControl={
209
+ <RefreshControl
210
+ // ...
211
+ enabled={refreshEnabled}
212
+ />
213
+ }
214
+ />
215
+ );
216
+ ```
217
+
142
218
  ## Example
143
219
 
144
- 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.
220
+ 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/master/example) directory.
145
221
 
146
222
  ```typescript
147
223
  import React, {memo, useState} from 'react';
148
224
  import {ListRenderItemInfo, Pressable, StyleSheet, Text} from 'react-native';
225
+
149
226
  import ReorderableList, {
150
227
  ReorderableListReorderEvent,
151
228
  reorderItems,
@@ -158,18 +235,15 @@ interface CardProps {
158
235
  height: number;
159
236
  }
160
237
 
161
- const list: CardProps[] = [
162
- {id: '0', color: 'red', height: 100},
163
- {id: '1', color: 'blue', height: 150},
164
- {id: '2', color: 'green', height: 80},
165
- {id: '3', color: 'violet', height: 100},
166
- {id: '4', color: 'orange', height: 120},
167
- {id: '5', color: 'coral', height: 100},
168
- {id: '6', color: 'purple', height: 110},
169
- {id: '7', color: 'chocolate', height: 80},
170
- {id: '8', color: 'crimson', height: 90},
171
- {id: '9', color: 'seagreen', height: 90},
172
- ];
238
+ const rand = () => Math.floor(Math.random() * 256);
239
+
240
+ const seedData: CardProps[] = Array(20)
241
+ .fill(null)
242
+ .map((_, i) => ({
243
+ id: i.toString(),
244
+ color: `rgb(${rand()}, ${rand()}, ${rand()})`,
245
+ height: Math.max(60, Math.floor(Math.random() * 100)),
246
+ }));
173
247
 
174
248
  const Card: React.FC<CardProps> = memo(({id, color, height}) => {
175
249
  const drag = useReorderableDrag();
@@ -182,7 +256,7 @@ const Card: React.FC<CardProps> = memo(({id, color, height}) => {
182
256
  });
183
257
 
184
258
  const Example = () => {
185
- const [data, setData] = useState(list);
259
+ const [data, setData] = useState(seedData);
186
260
 
187
261
  const handleReorder = ({from, to}: ReorderableListReorderEvent) => {
188
262
  setData(value => reorderItems(value, from, to));
@@ -206,11 +280,9 @@ const styles = StyleSheet.create({
206
280
  card: {
207
281
  justifyContent: 'center',
208
282
  alignItems: 'center',
209
- margin: 6,
210
- borderRadius: 5,
211
283
  backgroundColor: 'white',
212
- borderWidth: 1,
213
- borderColor: '#ddd',
284
+ borderBottomWidth: 1,
285
+ borderBottomColor: '#ddd',
214
286
  },
215
287
  text: {
216
288
  fontSize: 20,
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
9
9
  var _contexts = require("../contexts");
10
10
  var _hooks = require("../hooks");
11
+ var _helpers = require("./helpers");
11
12
  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); }
12
13
  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; }
13
14
  const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _react.memo)(({
@@ -24,21 +25,23 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
24
25
  const {
25
26
  currentIndex,
26
27
  draggedHeight,
27
- scale,
28
- opacity
28
+ activeIndex,
29
+ cellAnimations
29
30
  } = (0, _hooks.useContext)(_contexts.ReorderableListContext);
30
31
  const dragHandler = (0, _react.useCallback)(() => (0, _reactNativeReanimated.runOnUI)(startDrag)(index), [startDrag, index]);
32
+ const isActive = activeIndex === index;
31
33
  const contextValue = (0, _react.useMemo)(() => ({
32
34
  index,
33
35
  dragHandler,
34
- draggedIndex
35
- }), [index, dragHandler, draggedIndex]);
36
+ draggedIndex,
37
+ isActive
38
+ }), [index, dragHandler, draggedIndex, isActive]);
36
39
 
37
40
  // Keep separate animated reactions that update itemTranslateY
38
41
  // otherwise animations might stutter if multiple are triggered
39
42
  // (even in other cells, e.g. released item and reordering cells)
40
43
  const itemTranslateY = (0, _reactNativeReanimated.useSharedValue)(0);
41
- const isActive = (0, _reactNativeReanimated.useDerivedValue)(() => draggedIndex.value === index);
44
+ const isActiveCell = (0, _reactNativeReanimated.useDerivedValue)(() => draggedIndex.value === index);
42
45
  (0, _reactNativeReanimated.useAnimatedReaction)(() => dragY.value, () => {
43
46
  if (index === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
44
47
  itemTranslateY.value = dragY.value;
@@ -62,16 +65,18 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
62
65
  }
63
66
  });
64
67
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
65
- if (isActive.value) {
66
- return {
67
- transform: [{
68
- translateY: itemTranslateY.value
69
- }, {
70
- scale: scale.value
71
- }],
72
- opacity: opacity.value,
68
+ if (isActiveCell.value) {
69
+ const transform = [{
70
+ translateY: itemTranslateY.value
71
+ }];
72
+ if (Array.isArray(cellAnimations.transform)) {
73
+ const customTransform = cellAnimations.transform.map(x => (0, _helpers.applyAnimatedStyles)({}, x));
74
+ transform.push(...customTransform);
75
+ }
76
+ return (0, _helpers.applyAnimatedStyles)({
77
+ transform,
73
78
  zIndex: 999
74
- };
79
+ }, cellAnimations, ['transform']);
75
80
  }
76
81
  return {
77
82
  transform: [{
@@ -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","currentIndex","draggedHeight","scale","opacity","useContext","ReorderableListContext","dragHandler","useCallback","runOnUI","contextValue","useMemo","itemTranslateY","useSharedValue","isActive","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,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA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,CAACH,CAAC,EAAEnE,CAAC,CAACqE,WAAW,CAACC,MAAM,CAACF,MAAM,CAAC;IAEvD3C,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAGzB,CAAC,CAAC;EACf,CAAC;EAED,oBACEP,MAAA,CAAAY,OAAA,CAAAkE,aAAA,CAAC1E,SAAA,CAAA2E,sBAAsB,CAACC,QAAQ;IAAC3B,KAAK,EAAEN;EAAa,gBACnD/C,MAAA,CAAAY,OAAA,CAAAkE,aAAA,CAAC3E,sBAAA,CAAAS,OAAQ,CAACqE,IAAI;IAACC,KAAK,EAAEd,aAAc;IAACpC,QAAQ,EAAEyC;EAAa,GACzD1C,QACY,CACgB,CAAC;AAEtC,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_contexts","_hooks","_helpers","_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","activeIndex","cellAnimations","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","Array","isArray","customTransform","map","x","applyAnimatedStyles","push","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;AACA,IAAAI,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ACV,CAAC,EACDvC,cAAc,EACd,CAAC,WAAW,CACd,CAAC;IACH;IAEA,OAAO;MACL8B,SAAS,EAAE,CAAC;QAACC,UAAU,EAAEtB,cAAc,CAACI;MAAK,CAAC,CAAC;MAC/C;MACA;MACA0B,MAAM,EAAE;IACV,CAAC;EACH,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAI1E,CAAoB,IAAK;IAC7C,IAAAuC,8BAAO,EAAC,CAACoC,CAAS,EAAEC,MAAc,KAAK;MACrClD,UAAU,CAACqB,KAAK,CAACzB,KAAK,CAAC,GAAGqD,CAAC;MAC3BhD,UAAU,CAACoB,KAAK,CAACzB,KAAK,CAAC,GAAGsD,MAAM;IAClC,CAAC,CAAC,CAAC5E,CAAC,CAAC6E,WAAW,CAACC,MAAM,CAACH,CAAC,EAAE3E,CAAC,CAAC6E,WAAW,CAACC,MAAM,CAACF,MAAM,CAAC;IAEvDnD,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAGzB,CAAC,CAAC;EACf,CAAC;EAED,oBACER,MAAA,CAAAa,OAAA,CAAA0E,aAAA,CAACnF,SAAA,CAAAoF,sBAAsB,CAACC,QAAQ;IAAClC,KAAK,EAAEN;EAAa,gBACnDjD,MAAA,CAAAa,OAAA,CAAA0E,aAAA,CAACpF,sBAAA,CAAAU,OAAQ,CAAC6E,IAAI;IAACC,KAAK,EAAErB,aAAc;IAACrC,QAAQ,EAAEiD;EAAa,GACzDlD,QACY,CACgB,CAAC;AAEtC,CACF,CAAC","ignoreList":[]}
@@ -17,8 +17,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
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); }
18
18
  const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList);
19
19
  const ReorderableListCore = ({
20
- data,
21
20
  autoscrollThreshold = 0.1,
21
+ autoscrollThresholdOffset,
22
22
  autoscrollSpeedScale = 1,
23
23
  autoscrollDelay = _autoscrollConfig.AUTOSCROLL_CONFIG.delay,
24
24
  animationDuration = 200,
@@ -28,17 +28,17 @@ const ReorderableListCore = ({
28
28
  onScroll,
29
29
  onDragStart,
30
30
  onDragEnd,
31
- keyExtractor,
32
- extraData,
33
31
  scrollViewContainerRef,
34
32
  scrollViewHeightY,
35
33
  scrollViewScrollOffsetY,
36
34
  scrollViewScrollEnabled,
37
- scrollEnabled,
38
35
  initialScrollViewScrollEnabled,
39
36
  scrollable,
40
37
  outerScrollGesture,
41
38
  cellAnimations,
39
+ shouldUpdateActiveItem,
40
+ panEnabled = true,
41
+ panActivateAfterLongPress,
42
42
  ...rest
43
43
  }, ref) => {
44
44
  const {
@@ -56,6 +56,7 @@ const ReorderableListCore = ({
56
56
  } = (0, _useReorderableListCore.useReorderableListCore)({
57
57
  ref,
58
58
  autoscrollThreshold,
59
+ autoscrollThresholdOffset,
59
60
  autoscrollSpeedScale,
60
61
  autoscrollDelay,
61
62
  animationDuration,
@@ -70,10 +71,13 @@ const ReorderableListCore = ({
70
71
  scrollViewScrollEnabled,
71
72
  // flatlist will default to true if we pass explicitly undefined,
72
73
  // but internally we would treat it as false, so we force true
73
- initialScrollEnabled: typeof scrollEnabled === 'undefined' ? true : scrollEnabled,
74
+ initialScrollEnabled: typeof rest.scrollEnabled === 'undefined' ? true : rest.scrollEnabled,
74
75
  initialScrollViewScrollEnabled: typeof initialScrollViewScrollEnabled === 'undefined' ? true : initialScrollViewScrollEnabled,
75
76
  nestedScrollable: scrollable,
76
- cellAnimations
77
+ cellAnimations,
78
+ shouldUpdateActiveItem,
79
+ panEnabled,
80
+ panActivateAfterLongPress
77
81
  });
78
82
  const combinedGesture = (0, _react.useMemo)(() => {
79
83
  // android is able to handle nested scroll view, but not the full height ones like iOS
@@ -102,17 +106,13 @@ const ReorderableListCore = ({
102
106
  gesture: combinedGesture
103
107
  }, /*#__PURE__*/_react.default.createElement(AnimatedFlatList, _extends({}, rest, {
104
108
  ref: handleRef,
105
- data: data,
106
109
  CellRendererComponent: renderAnimatedCell,
107
110
  onLayout: handleFlatListLayout,
108
111
  onScroll: composedScrollHandler,
109
112
  scrollEventThrottle: 1,
110
113
  horizontal: false,
111
114
  removeClippedSubviews: false,
112
- keyExtractor: keyExtractor,
113
- extraData: extraData,
114
- numColumns: 1,
115
- scrollEnabled: scrollEnabled
115
+ numColumns: 1
116
116
  }))));
117
117
  };
118
118
  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","_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","data","autoscrollThreshold","autoscrollSpeedScale","autoscrollDelay","AUTOSCROLL_CONFIG","delay","animationDuration","dragReorderThreshold","onLayout","onReorder","onScroll","onDragStart","onDragEnd","keyExtractor","extraData","scrollViewContainerRef","scrollViewHeightY","scrollViewScrollOffsetY","scrollViewScrollEnabled","scrollEnabled","initialScrollViewScrollEnabled","scrollable","outerScrollGesture","cellAnimations","rest","ref","gestureHandler","handleScroll","handleFlatListLayout","handleRef","startDrag","listContextValue","itemOffset","itemHeight","dragY","draggedIndex","duration","useReorderableListCore","initialScrollEnabled","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,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA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,GAAG,EAAE,GAAGJ,OAAO,IAAIC,KAAK,CAACI,KAAK,EAAG;IACjCvB,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3B7B,iBAAiB,EAAE8B,QAAS;IAC5BN,SAAS,EAAEA;EAAU,EACtB,CACF,EACD,CAACE,UAAU,EAAEC,UAAU,EAAEC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,EAAEN,SAAS,CACnE,CAAC;EAED,oBACEvE,MAAA,CAAAgB,OAAA,CAAA6E,aAAA,CAACrF,SAAA,CAAAyF,sBAAsB,CAACC,QAAQ;IAACC,KAAK,EAAE3B;EAAiB,gBACvDxE,MAAA,CAAAgB,OAAA,CAAA6E,aAAA,CAACzF,0BAAA,CAAAgG,eAAe;IAACC,OAAO,EAAEpB;EAAgB,gBACxCjF,MAAA,CAAAgB,OAAA,CAAA6E,aAAA,CAACzD,gBAAgB,EAAAN,QAAA,KACXmC,IAAI;IACRC,GAAG,EAAEI,SAAU;IACf7B,IAAI,EAAEA,IAAK;IACX6D,qBAAqB,EAAEb,kBAAmB;IAC1CxC,QAAQ,EAAEoB,oBAAqB;IAC/BlB,QAAQ,EAAEoC,qBAAsB;IAChCgB,mBAAmB,EAAE,CAAE;IACvBC,UAAU,EAAE,KAAM;IAClBC,qBAAqB,EAAE,KAAM;IAC7BnD,YAAY,EAAEA,YAAa;IAC3BC,SAAS,EAAEA,SAAU;IACrBmD,UAAU,EAAE,CAAE;IACd9C,aAAa,EAAEA;EAAc,EAC9B,CACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAM+C,2BAA2B,GAAAC,OAAA,CAAApE,mBAAA,gBAAGqE,cAAK,CAACC,IAAI,cAC5CD,cAAK,CAACE,UAAU,CAACvE,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","autoscrollThresholdOffset","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,m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ACtF,SAAA,CAAA0F,sBAAsB,CAACC,QAAQ;IAACC,KAAK,EAAE5B;EAAiB,gBACvDxE,MAAA,CAAAgB,OAAA,CAAA8E,aAAA,CAAC1F,0BAAA,CAAAiG,eAAe;IAACC,OAAO,EAAEpB;EAAgB,gBACxClF,MAAA,CAAAgB,OAAA,CAAA8E,aAAA,CAAC1D,gBAAgB,EAAAN,QAAA,KACXmC,IAAI;IACRC,GAAG,EAAEI,SAAU;IACfiC,qBAAqB,EAAEb,kBAAmB;IAC1CzC,QAAQ,EAAEoB,oBAAqB;IAC/BlB,QAAQ,EAAEqC,qBAAsB;IAChCgB,mBAAmB,EAAE,CAAE;IACvBC,UAAU,EAAE,KAAM;IAClBC,qBAAqB,EAAE,KAAM;IAC7BC,UAAU,EAAE;EAAE,EACf,CACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAMC,2BAA2B,GAAAC,OAAA,CAAArE,mBAAA,gBAAGsE,cAAK,CAACC,IAAI,cAC5CD,cAAK,CAACE,UAAU,CAACxE,mBAAmB,CACtC,CAIuB","ignoreList":[]}
@@ -18,6 +18,7 @@ const hasAutomaticBatching = version.length ? parseInt(version[0], 10) >= 18 : f
18
18
  const useReorderableListCore = ({
19
19
  ref,
20
20
  autoscrollThreshold,
21
+ autoscrollThresholdOffset,
21
22
  autoscrollSpeedScale,
22
23
  autoscrollDelay,
23
24
  animationDuration,
@@ -33,9 +34,13 @@ const useReorderableListCore = ({
33
34
  initialScrollEnabled,
34
35
  initialScrollViewScrollEnabled,
35
36
  nestedScrollable,
36
- cellAnimations
37
+ cellAnimations,
38
+ shouldUpdateActiveItem,
39
+ panActivateAfterLongPress,
40
+ panEnabled
37
41
  }) => {
38
42
  const flatListRef = (0, _reactNativeReanimated.useAnimatedRef)();
43
+ const [activeIndex, setActiveIndex] = (0, _react.useState)(-1);
39
44
  const scrollEnabled = (0, _reactNativeReanimated.useSharedValue)(initialScrollEnabled);
40
45
  const gestureState = (0, _reactNativeReanimated.useSharedValue)(_reactNativeGestureHandler.State.UNDETERMINED);
41
46
  const currentY = (0, _reactNativeReanimated.useSharedValue)(0);
@@ -64,10 +69,6 @@ const useReorderableListCore = ({
64
69
  const duration = (0, _reactNativeReanimated.useSharedValue)(animationDuration);
65
70
  const scaleDefault = (0, _reactNativeReanimated.useSharedValue)(1);
66
71
  const opacityDefault = (0, _reactNativeReanimated.useSharedValue)(1);
67
- const {
68
- scale,
69
- opacity
70
- } = cellAnimations || {};
71
72
  (0, _react.useEffect)(() => {
72
73
  duration.value = animationDuration;
73
74
  }, [duration, animationDuration]);
@@ -76,9 +77,15 @@ const useReorderableListCore = ({
76
77
  currentIndex,
77
78
  draggedIndex,
78
79
  dragEndHandlers,
79
- scale: scale || scaleDefault,
80
- opacity: opacity || opacityDefault
81
- }), [draggedHeight, currentIndex, draggedIndex, dragEndHandlers, scale, scaleDefault, opacity, opacityDefault]);
80
+ activeIndex,
81
+ cellAnimations: {
82
+ ...cellAnimations,
83
+ transform: cellAnimations && 'transform' in cellAnimations ? cellAnimations.transform : [{
84
+ scale: scaleDefault
85
+ }],
86
+ opacity: cellAnimations && 'opacity' in cellAnimations ? cellAnimations.opacity : opacityDefault
87
+ }
88
+ }), [draggedHeight, currentIndex, draggedIndex, dragEndHandlers, activeIndex, cellAnimations, scaleDefault, opacityDefault]);
82
89
  const panGestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Pan().onBegin(e => {
83
90
  // prevent new dragging until item is completely released
84
91
  if (state.value === _types.ReorderableListState.IDLE) {
@@ -96,7 +103,16 @@ const useReorderableListCore = ({
96
103
  gestureState.value = e.state;
97
104
  }
98
105
  }).onEnd(e => gestureState.value = e.state).onFinalize(e => gestureState.value = e.state), [currentTranslationY, currentY, dragScrollTranslationY, scrollViewDragScrollTranslationY, gestureState, dragY, startY, state]);
99
- const gestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Simultaneous(_reactNativeGestureHandler.Gesture.Native(), panGestureHandler), [panGestureHandler]);
106
+ const panGestureHandlerWithOptions = (0, _react.useMemo)(() => {
107
+ if (typeof panActivateAfterLongPress === 'number') {
108
+ panGestureHandler.activateAfterLongPress(panActivateAfterLongPress);
109
+ }
110
+ if (!panEnabled) {
111
+ panGestureHandler.enabled(panEnabled);
112
+ }
113
+ return panGestureHandler;
114
+ }, [panActivateAfterLongPress, panEnabled, panGestureHandler]);
115
+ const gestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Simultaneous(_reactNativeGestureHandler.Gesture.Native(), panGestureHandlerWithOptions), [panGestureHandlerWithOptions]);
100
116
  const setScrollEnabled = (0, _react.useCallback)(enabled => {
101
117
  // if scroll is enabled on list props then we can toggle it
102
118
  if (initialScrollEnabled) {
@@ -198,24 +214,27 @@ const useReorderableListCore = ({
198
214
  const runDefaultDragAnimations = (0, _react.useCallback)(type => {
199
215
  'worklet';
200
216
 
201
- // if animation is not disabled and not custom run the default
202
- if (scale !== false && !scale) {
217
+ // if no custom scale run default
218
+ if (!(cellAnimations && 'transformtra' in cellAnimations)) {
203
219
  const scaleConfig = _animationDefaults.SCALE_ANIMATION_CONFIG_DEFAULT[type];
204
220
  scaleDefault.value = (0, _reactNativeReanimated.withTiming)(scaleConfig.toValue, scaleConfig);
205
221
  }
206
222
 
207
- // if animation is not disabled and not custom run the default
208
- if (opacity !== false && !opacity) {
223
+ // if no custom opacity run the default
224
+ if (!(cellAnimations && 'opacity' in cellAnimations)) {
209
225
  const opacityConfig = _animationDefaults.OPACITY_ANIMATION_CONFIG_DEFAULT[type];
210
226
  opacityDefault.value = (0, _reactNativeReanimated.withTiming)(opacityConfig.toValue, opacityConfig);
211
227
  }
212
- }, [scale, scaleDefault, opacity, opacityDefault]);
228
+ }, [cellAnimations, scaleDefault, opacityDefault]);
213
229
  (0, _reactNativeReanimated.useAnimatedReaction)(() => gestureState.value, () => {
214
230
  if (gestureState.value !== _reactNativeGestureHandler.State.ACTIVE && gestureState.value !== _reactNativeGestureHandler.State.BEGAN && (state.value === _types.ReorderableListState.DRAGGED || state.value === _types.ReorderableListState.AUTOSCROLL)) {
215
231
  state.value = _types.ReorderableListState.RELEASED;
216
232
 
217
233
  // enable back scroll on releasing
218
234
  (0, _reactNativeReanimated.runOnJS)(setScrollEnabled)(true);
235
+ if (shouldUpdateActiveItem) {
236
+ (0, _reactNativeReanimated.runOnJS)(setActiveIndex)(-1);
237
+ }
219
238
 
220
239
  // trigger onDragEnd event
221
240
  let e = {
@@ -272,21 +291,27 @@ const useReorderableListCore = ({
272
291
  const calculateThresholdArea = (0, _react.useCallback)(hiddenArea => {
273
292
  'worklet';
274
293
 
294
+ const offsetTop = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.top) || 0);
295
+ const offsetBottom = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.bottom) || 0);
275
296
  const threshold = Math.max(0, Math.min(autoscrollThreshold, 0.4));
276
- const visibleHeight = flatListHeightY.value - (hiddenArea.top + hiddenArea.bottom);
277
- const top = visibleHeight * threshold;
278
- const bottom = flatListHeightY.value - top;
297
+ const visibleHeight = flatListHeightY.value - (hiddenArea.top + hiddenArea.bottom) - (offsetTop + offsetBottom);
298
+ const area = visibleHeight * threshold;
299
+ const top = area + offsetTop;
300
+ const bottom = flatListHeightY.value - area - offsetBottom;
279
301
  return {
280
302
  top,
281
303
  bottom
282
304
  };
283
- }, [autoscrollThreshold, flatListHeightY]);
305
+ }, [autoscrollThreshold, autoscrollThresholdOffset, flatListHeightY]);
284
306
  const calculateThresholdAreaParent = (0, _react.useCallback)(hiddenArea => {
285
307
  'worklet';
286
308
 
309
+ const offsetTop = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.top) || 0);
310
+ const offsetBottom = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.bottom) || 0);
287
311
  const threshold = Math.max(0, Math.min(autoscrollThreshold, 0.4));
288
- const top = flatListHeightY.value * threshold;
289
- const bottom = flatListHeightY.value - top;
312
+ const area = flatListHeightY.value * threshold;
313
+ const top = area + offsetTop;
314
+ const bottom = flatListHeightY.value - area - offsetBottom;
290
315
 
291
316
  // if the hidden area is 0 then we don't have a threshold area
292
317
  // we might have floating errors like 0.0001 which we should ignore
@@ -294,7 +319,7 @@ const useReorderableListCore = ({
294
319
  top: hiddenArea.top > 0.1 ? top + hiddenArea.top : 0,
295
320
  bottom: hiddenArea.bottom > 0.1 ? bottom - hiddenArea.bottom : 0
296
321
  };
297
- }, [autoscrollThreshold, flatListHeightY]);
322
+ }, [autoscrollThreshold, autoscrollThresholdOffset, flatListHeightY]);
298
323
  const shouldScrollParent = (0, _react.useCallback)(y => {
299
324
  'worklet';
300
325
 
@@ -408,6 +433,9 @@ const useReorderableListCore = ({
408
433
  // resetting shared values again fixes a flickeing bug in nested lists where
409
434
  // after scrolling the parent list it would offset the new dragged item in another nested list
410
435
  resetSharedValues();
436
+ if (shouldUpdateActiveItem) {
437
+ (0, _reactNativeReanimated.runOnJS)(setActiveIndex)(index);
438
+ }
411
439
  dragInitialScrollOffsetY.value = flatListScrollOffsetY.value;
412
440
  scrollViewDragInitialScrollOffsetY.value = scrollViewScrollOffsetY ? scrollViewScrollOffsetY.value : 0;
413
441
  draggedHeight.value = itemHeight.value[index];
@@ -423,7 +451,7 @@ const useReorderableListCore = ({
423
451
  index
424
452
  });
425
453
  }
426
- }, [resetSharedValues, dragInitialScrollOffsetY, scrollViewScrollOffsetY, scrollViewDragInitialScrollOffsetY, setScrollEnabled, currentIndex, previousIndex, draggedHeight, draggedIndex, state, flatListScrollOffsetY, itemHeight, onDragStart, runDefaultDragAnimations]);
454
+ }, [resetSharedValues, shouldUpdateActiveItem, dragInitialScrollOffsetY, scrollViewScrollOffsetY, scrollViewDragInitialScrollOffsetY, setScrollEnabled, currentIndex, previousIndex, draggedHeight, draggedIndex, state, flatListScrollOffsetY, itemHeight, onDragStart, runDefaultDragAnimations]);
427
455
  const handleFlatListLayout = (0, _react.useCallback)(e => {
428
456
  nestedFlatListPositionY.value = e.nativeEvent.layout.y;
429
457
  flatListHeightY.value = e.nativeEvent.layout.height;