react-native-reorderable-list 0.7.0 → 0.8.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 (96) hide show
  1. package/README.md +53 -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 +39 -29
  5. package/lib/commonjs/components/ReorderableListCell.js.map +1 -1
  6. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +10 -7
  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/autoscrollConfig.js +31 -0
  11. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  12. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js +66 -41
  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/ReorderableListContext.js.map +1 -1
  19. package/lib/commonjs/index.js +0 -6
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/types/misc.js +3 -3
  22. package/lib/module/components/ReorderableList.js +11 -13
  23. package/lib/module/components/ReorderableList.js.map +1 -1
  24. package/lib/module/components/ReorderableListCell.js +40 -30
  25. package/lib/module/components/ReorderableListCell.js.map +1 -1
  26. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +10 -6
  27. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  28. package/lib/module/components/ReorderableListCore/animationDefaults.js +28 -0
  29. package/lib/module/components/ReorderableListCore/animationDefaults.js.map +1 -0
  30. package/lib/module/components/ReorderableListCore/autoscrollConfig.js +25 -0
  31. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  32. package/lib/module/components/ReorderableListCore/useReorderableListCore.js +68 -43
  33. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  34. package/lib/module/components/ScrollViewContainer.js +3 -3
  35. package/lib/module/components/ScrollViewContainer.js.map +1 -1
  36. package/lib/module/components/index.js +0 -1
  37. package/lib/module/components/index.js.map +1 -1
  38. package/lib/module/contexts/ReorderableListContext.js.map +1 -1
  39. package/lib/module/index.js +2 -2
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/types/misc.js +3 -3
  42. package/lib/typescript/components/ReorderableList.d.ts.map +1 -1
  43. package/lib/typescript/components/ReorderableListCell.d.ts +1 -1
  44. package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -1
  45. package/lib/typescript/components/ReorderableListCore/ReorderableListCore.d.ts.map +1 -1
  46. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts +13 -0
  47. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts.map +1 -0
  48. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts +6 -0
  49. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts.map +1 -0
  50. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +7 -4
  51. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +1 -1
  52. package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
  53. package/lib/typescript/components/index.d.ts +0 -1
  54. package/lib/typescript/components/index.d.ts.map +1 -1
  55. package/lib/typescript/contexts/ReorderableListContext.d.ts +2 -0
  56. package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -1
  57. package/lib/typescript/index.d.ts +3 -3
  58. package/lib/typescript/index.d.ts.map +1 -1
  59. package/lib/typescript/types/misc.d.ts +3 -3
  60. package/lib/typescript/types/misc.d.ts.map +1 -1
  61. package/lib/typescript/types/props.d.ts +25 -37
  62. package/lib/typescript/types/props.d.ts.map +1 -1
  63. package/package.json +19 -11
  64. package/src/components/ReorderableList.tsx +14 -16
  65. package/src/components/ReorderableListCell.tsx +36 -32
  66. package/src/components/ReorderableListCore/ReorderableListCore.tsx +16 -5
  67. package/src/components/ReorderableListCore/animationDefaults.ts +35 -0
  68. package/src/components/ReorderableListCore/autoscrollConfig.ts +31 -0
  69. package/src/components/ReorderableListCore/useReorderableListCore.ts +94 -52
  70. package/src/components/ScrollViewContainer.tsx +7 -3
  71. package/src/components/index.ts +0 -1
  72. package/src/contexts/ReorderableListContext.ts +2 -0
  73. package/src/index.ts +4 -6
  74. package/src/types/misc.ts +3 -3
  75. package/src/types/props.ts +26 -43
  76. package/lib/commonjs/components/ReorderableListCore/constants.ios.js +0 -10
  77. package/lib/commonjs/components/ReorderableListCore/constants.ios.js.map +0 -1
  78. package/lib/commonjs/components/ReorderableListCore/constants.js +0 -10
  79. package/lib/commonjs/components/ReorderableListCore/constants.js.map +0 -1
  80. package/lib/commonjs/components/ReorderableListItem.js +0 -87
  81. package/lib/commonjs/components/ReorderableListItem.js.map +0 -1
  82. package/lib/module/components/ReorderableListCore/constants.ios.js +0 -4
  83. package/lib/module/components/ReorderableListCore/constants.ios.js.map +0 -1
  84. package/lib/module/components/ReorderableListCore/constants.js +0 -4
  85. package/lib/module/components/ReorderableListCore/constants.js.map +0 -1
  86. package/lib/module/components/ReorderableListItem.js +0 -78
  87. package/lib/module/components/ReorderableListItem.js.map +0 -1
  88. package/lib/typescript/components/ReorderableListCore/constants.d.ts +0 -3
  89. package/lib/typescript/components/ReorderableListCore/constants.d.ts.map +0 -1
  90. package/lib/typescript/components/ReorderableListCore/constants.ios.d.ts +0 -3
  91. package/lib/typescript/components/ReorderableListCore/constants.ios.d.ts.map +0 -1
  92. package/lib/typescript/components/ReorderableListItem.d.ts +0 -4
  93. package/lib/typescript/components/ReorderableListItem.d.ts.map +0 -1
  94. package/src/components/ReorderableListCore/constants.ios.ts +0 -3
  95. package/src/components/ReorderableListCore/constants.ts +0 -3
  96. package/src/components/ReorderableListItem.tsx +0 -108
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,7 +17,6 @@ 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)
@@ -30,6 +29,8 @@ A reorderable list for React Native applications, powered by Reanimated 🚀
30
29
 
31
30
  ## Install
32
31
 
32
+ > **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.
33
+
33
34
  Npm:
34
35
 
35
36
  ```bash
@@ -44,8 +45,8 @@ yarn add react-native-reorderable-list
44
45
 
45
46
  Then you need to install these two peer dependencies:
46
47
 
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
48
+ - [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated) >=3.12.0
49
+ - [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler) >=2.12.0
49
50
 
50
51
  ## Components
51
52
 
@@ -53,16 +54,18 @@ Then you need to install these two peer dependencies:
53
54
 
54
55
  This component uses a [FlatList](https://reactnative.dev/docs/flatlist) and it extends its props:
55
56
 
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. |
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. |
66
69
 
67
70
  The following props from FlatList are not supported:
68
71
 
@@ -72,22 +75,13 @@ The following props from FlatList are not supported:
72
75
  - CellRendererComponent
73
76
  - numColumns
74
77
 
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
78
  ### ScrollViewContainer
85
79
 
86
80
  This component extends the [ScrollView](https://reactnative.dev/docs/scrollview) component and is used for nesting a [NestedReorderableList](#nestedreorderablelist) within a scrollable container:
87
81
 
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. |
82
+ | Props | Type | Required | Default | Description |
83
+ | -------- | --------------------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
84
+ | 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
85
 
92
86
  ### NestedReorderableList
93
87
 
@@ -109,19 +103,35 @@ This hook creates a function that triggers the drag of a list item. It's usually
109
103
 
110
104
  ### useReorderableDragStart
111
105
 
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.
106
+ 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
107
 
114
- ##### Parameters
108
+ ```typescript
109
+ useReorderableDragStart(
110
+ useCallback((index: number) => {
111
+ 'worklet';
112
+
113
+ // ...
114
+ }, []),
115
+ );
116
+ ```
115
117
 
116
- - onStart: `(index: number) => void`
118
+ Using this hook in large lists is discouraged due to performance bottlenecks, prefer `onDragStart` on the ReorderableList instead.
117
119
 
118
120
  ### useReorderableDragEnd
119
121
 
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.
122
+ 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:
123
+
124
+ ```typescript
125
+ useReorderableDragEnd(
126
+ useCallback((from: number, to: number) => {
127
+ 'worklet';
121
128
 
122
- ##### Parameters
129
+ // ...
130
+ }, []),
131
+ );
132
+ ```
123
133
 
124
- - onEnd: `(from: number, to: number) => void`
134
+ Using this hook in large lists is discouraged due to performance bottlenecks, prefer `onDragEnd` on the ReorderableList instead.
125
135
 
126
136
  ## Utils
127
137
 
@@ -134,10 +144,9 @@ This hook allows handling the drag end event of a list item. It receives a workl
134
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.
135
145
 
136
146
  ```typescript
137
- import React, {useState} from 'react';
147
+ import React, {memo, useState} from 'react';
138
148
  import {ListRenderItemInfo, Pressable, StyleSheet, Text} from 'react-native';
139
149
  import ReorderableList, {
140
- ReorderableListItem,
141
150
  ReorderableListReorderEvent,
142
151
  reorderItems,
143
152
  useReorderableDrag,
@@ -162,30 +171,27 @@ const list: CardProps[] = [
162
171
  {id: '9', color: 'seagreen', height: 90},
163
172
  ];
164
173
 
165
- const Card: React.FC<CardProps> = React.memo(({id, color, height}) => {
174
+ const Card: React.FC<CardProps> = memo(({id, color, height}) => {
166
175
  const drag = useReorderableDrag();
167
176
 
168
177
  return (
169
- <ReorderableListItem>
170
- <Pressable style={[styles.card, {height}]} onLongPress={drag}>
171
- <Text style={[styles.text, {color}]}>Card {id}</Text>
172
- </Pressable>
173
- </ReorderableListItem>
178
+ <Pressable style={[styles.card, {height}]} onLongPress={drag}>
179
+ <Text style={[styles.text, {color}]}>Card {id}</Text>
180
+ </Pressable>
174
181
  );
175
182
  });
176
183
 
177
184
  const Example = () => {
178
185
  const [data, setData] = useState(list);
179
186
 
187
+ const handleReorder = ({from, to}: ReorderableListReorderEvent) => {
188
+ setData(value => reorderItems(value, from, to));
189
+ };
190
+
180
191
  const renderItem = ({item}: ListRenderItemInfo<CardProps>) => (
181
192
  <Card {...item} />
182
193
  );
183
194
 
184
- const handleReorder = ({from, to}: ReorderableListReorderEvent) => {
185
- const newData = reorderItems(data, from, to);
186
- setData(newData);
187
- };
188
-
189
195
  return (
190
196
  <ReorderableList
191
197
  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,CAA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AA,CAAAN,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAM,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAG1D,MAAMG,sBAAsB,GAAGA,CAC7B;EAACC,aAAa,GAAG,IAAI;EAAE,GAAGC;AAA6B,CAAC,EACxDC,GAA2B,KACxB;EACH,oBACEjC,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,oBAAA,CAAAgC,mBAAmB,EAAAX,QAAA,KACdQ,IAAI;IACRC,GAAG,EAAEA,GAAI;IACTF,aAAa,EAAEA,aAAc;IAC7BK,8BAA8B,EAAE,IAAK;IACrCC,UAAU,EAAE,IAAK;IACjBC,sBAAsB,EAAEC,SAAU;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,IAAA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AAA,IAAAC,CAAA,OAAAY,cAAA,CAAAC,IAAA,CAAAb,CAAA,EAAAD,CAAA,MAAAM,CAAA,CAAAN,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAM,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAG1D,MAAMG,sBAAsB,GAAGA,CAC7B;EAACC,aAAa,GAAG,IAAI;EAAE,GAAGC;AAA6B,CAAC,EACxDC,GAA2B,kBAE3BjC,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,oBAAA,CAAAgC,mBAAmB,EAAAX,QAAA,KACdQ,IAAI;EACRC,GAAG,EAAEA,GAAI;EACTF,aAAa,EAAEA,aAAc;EAC7BK,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,67 @@ 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]);
24
+ const {
25
+ currentIndex,
26
+ draggedHeight,
27
+ scale,
28
+ opacity
29
+ } = (0, _hooks.useContext)(_contexts.ReorderableListContext);
30
+ const dragHandler = (0, _react.useCallback)(() => (0, _reactNativeReanimated.runOnUI)(startDrag)(index), [startDrag, index]);
29
31
  const contextValue = (0, _react.useMemo)(() => ({
30
32
  index,
31
33
  dragHandler,
32
34
  draggedIndex
33
35
  }), [index, dragHandler, draggedIndex]);
34
- const {
35
- currentIndex,
36
- draggedHeight
37
- } = (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);
36
+
37
+ // Keep separate animated reactions that update itemTranslateY
38
+ // otherwise animations might stutter if multiple are triggered
39
+ // (even in other cells, e.g. released item and reordering cells)
40
+ const itemTranslateY = (0, _reactNativeReanimated.useSharedValue)(0);
41
+ const isActive = (0, _reactNativeReanimated.useDerivedValue)(() => draggedIndex.value === index);
42
42
  (0, _reactNativeReanimated.useAnimatedReaction)(() => dragY.value, () => {
43
- if (itemIndex.value === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
44
- itemDragY.value = dragY.value;
43
+ if (index === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
44
+ itemTranslateY.value = dragY.value;
45
45
  }
46
46
  });
47
47
  (0, _reactNativeReanimated.useAnimatedReaction)(() => currentIndex.value, () => {
48
- if (itemIndex.value !== draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
48
+ if (index !== draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
49
49
  const moveDown = currentIndex.value > draggedIndex.value;
50
50
  const startMove = Math.min(draggedIndex.value, currentIndex.value);
51
51
  const endMove = Math.max(draggedIndex.value, currentIndex.value);
52
52
  let newValue = 0;
53
- if (itemIndex.value >= startMove && itemIndex.value <= endMove) {
53
+ if (index >= startMove && index <= endMove) {
54
54
  newValue = moveDown ? -draggedHeight.value : draggedHeight.value;
55
55
  }
56
- if (newValue !== itemPositionY.value) {
57
- itemPositionY.value = (0, _reactNativeReanimated.withTiming)(newValue, {
56
+ if (newValue !== itemTranslateY.value) {
57
+ itemTranslateY.value = (0, _reactNativeReanimated.withTiming)(newValue, {
58
58
  duration: animationDuration.value,
59
59
  easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease)
60
60
  });
61
61
  }
62
62
  }
63
63
  });
64
- (0, _reactNativeReanimated.useAnimatedReaction)(() => draggedIndex.value === index, newValue => {
65
- itemZIndex.value = newValue ? 999 : 0;
64
+ 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,
73
+ zIndex: 999
74
+ };
75
+ }
76
+ return {
77
+ transform: [{
78
+ translateY: itemTranslateY.value
79
+ }],
80
+ // TODO: move to stylesheet when this is fixed
81
+ // https://github.com/software-mansion/react-native-reanimated/issues/6681#issuecomment-2514228447
82
+ zIndex: 0
83
+ };
66
84
  });
67
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
68
- zIndex: itemZIndex.value,
69
- transform: [{
70
- translateY: itemDragY.value
71
- }, {
72
- translateY: itemPositionY.value
73
- }]
74
- }));
75
85
  const handleLayout = e => {
76
86
  (0, _reactNativeReanimated.runOnUI)((y, height) => {
77
87
  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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AAK,CAAC,EAC7B;MAACkB,UAAU,EAAEtB,aAAa,CAACI;IAAK,CAAC;EAErC,CAAC,CAAC,CAAC;EAEH,MAAMmB,YAAY,GAAIhE,CAAoB,IAAK;IAC7C,IAAAiE,8BAAO,EAAC,CAACC,CAAS,EAAEC,MAAc,KAAK;MACrCzC,UAAU,CAACmB,KAAK,CAACvB,KAAK,CAAC,GAAG4C,CAAC;MAC3BvC,UAAU,CAACkB,KAAK,CAACvB,KAAK,CAAC,GAAG6C,MAAM;IAClC,CAAC,CAAC,CAACnE,CAAC,CAACoE,WAAW,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","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,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,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,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAA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;MACLF,SAAS,EAAE,CAAC;QAACC,UAAU,EAAEtB,cAAc,CAACI;MAAK,CAAC,CAAC;MAC/C;MACA;MACAmB,MAAM,EAAE;IACV,CAAC;EACH,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAIlE,CAAoB,IAAK;IAC7C,IAAAuC,8BAAO,EAAC,CAAC4B,CAAS,EAAEC,MAAc,KAAK;MACrC1C,UAAU,CAACoB,KAAK,CAACxB,KAAK,CAAC,GAAG6C,CAAC;MAC3BxC,UAAU,CAACmB,KAAK,CAACxB,KAAK,CAAC,GAAG8C,MAAM;IAClC,CAAC,CAAC,CAACpE,CAAC,CAACqE,WAAW,CAACC,MAAM,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":[]}
@@ -7,12 +7,11 @@ 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); }
@@ -21,12 +20,13 @@ const ReorderableListCore = ({
21
20
  data,
22
21
  autoscrollThreshold = 0.1,
23
22
  autoscrollSpeedScale = 1,
24
- autoscrollDelay = _constants.AUTOSCROLL_DELAY,
23
+ autoscrollDelay = _autoscrollConfig.AUTOSCROLL_CONFIG.delay,
25
24
  animationDuration = 200,
26
25
  dragReorderThreshold = 0.2,
27
26
  onLayout,
28
27
  onReorder,
29
28
  onScroll,
29
+ onDragStart,
30
30
  onDragEnd,
31
31
  keyExtractor,
32
32
  extraData,
@@ -38,6 +38,7 @@ const ReorderableListCore = ({
38
38
  initialScrollViewScrollEnabled,
39
39
  scrollable,
40
40
  outerScrollGesture,
41
+ cellAnimations,
41
42
  ...rest
42
43
  }, ref) => {
43
44
  const {
@@ -61,7 +62,7 @@ const ReorderableListCore = ({
61
62
  dragReorderThreshold,
62
63
  onLayout,
63
64
  onReorder,
64
- onScroll,
65
+ onDragStart,
65
66
  onDragEnd,
66
67
  scrollViewContainerRef,
67
68
  scrollViewHeightY,
@@ -71,7 +72,8 @@ const ReorderableListCore = ({
71
72
  // but internally we would treat it as false, so we force true
72
73
  initialScrollEnabled: typeof scrollEnabled === 'undefined' ? true : scrollEnabled,
73
74
  initialScrollViewScrollEnabled: typeof initialScrollViewScrollEnabled === 'undefined' ? true : initialScrollViewScrollEnabled,
74
- nestedScrollable: scrollable
75
+ nestedScrollable: scrollable,
76
+ cellAnimations
75
77
  });
76
78
  const combinedGesture = (0, _react.useMemo)(() => {
77
79
  // android is able to handle nested scroll view, but not the full height ones like iOS
@@ -80,6 +82,7 @@ const ReorderableListCore = ({
80
82
  }
81
83
  return gestureHandler;
82
84
  }, [scrollable, outerScrollGesture, gestureHandler]);
85
+ const composedScrollHandler = (0, _reactNativeReanimated.useComposedEventHandler)([handleScroll, onScroll || null]);
83
86
  const renderAnimatedCell = (0, _react.useCallback)(({
84
87
  cellKey,
85
88
  ...props
@@ -102,7 +105,7 @@ const ReorderableListCore = ({
102
105
  data: data,
103
106
  CellRendererComponent: renderAnimatedCell,
104
107
  onLayout: handleFlatListLayout,
105
- onScroll: handleScroll,
108
+ onScroll: composedScrollHandler,
106
109
  scrollEventThrottle: 1,
107
110
  horizontal: false,
108
111
  removeClippedSubviews: false,
@@ -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_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,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAA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Aa,EAAEA;EAAc,EAC9B,CACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAM4C,2BAA2B,GAAAC,OAAA,CAAA/D,mBAAA,gBAAGgE,cAAK,CAACC,IAAI,cAC5CD,cAAK,CAACE,UAAU,CAAClE,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","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,O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C,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":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SCALE_ANIMATION_CONFIG_DEFAULT = exports.OPACITY_ANIMATION_CONFIG_DEFAULT = void 0;
7
+ var _reactNativeReanimated = require("react-native-reanimated");
8
+ const DURATION_START = 150;
9
+ const DURATION_END = 200;
10
+ const SCALE_ANIMATION_CONFIG_DEFAULT = exports.SCALE_ANIMATION_CONFIG_DEFAULT = {
11
+ start: {
12
+ toValue: 1.025,
13
+ easing: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease),
14
+ duration: DURATION_START
15
+ },
16
+ end: {
17
+ toValue: 1,
18
+ easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease),
19
+ duration: DURATION_END
20
+ }
21
+ };
22
+ const OPACITY_ANIMATION_CONFIG_DEFAULT = exports.OPACITY_ANIMATION_CONFIG_DEFAULT = {
23
+ start: {
24
+ toValue: 0.75,
25
+ easing: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease),
26
+ duration: DURATION_START
27
+ },
28
+ end: {
29
+ toValue: 1,
30
+ easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease),
31
+ duration: DURATION_END
32
+ }
33
+ };
34
+ //# sourceMappingURL=animationDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNativeReanimated","require","DURATION_START","DURATION_END","SCALE_ANIMATION_CONFIG_DEFAULT","exports","start","toValue","easing","Easing","in","ease","duration","end","out","OPACITY_ANIMATION_CONFIG_DEFAULT"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/animationDefaults.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAG,GAAG;AAC1B,MAAMC,YAAY,GAAG,GAAG;AAOjB,MAAMC,8BAA+C,GAAAC,OAAA,CAAAD,8BAAA,GAAG;EAC7DE,KAAK,EAAE;IACLC,OAAO,EAAE,KAAK;IACdC,MAAM,EAAEC,6BAAM,CAACC,EAAE,CAACD,6BAAM,CAACE,IAAI,CAAC;IAC9BC,QAAQ,EAAEV;EACZ,CAAC;EACDW,GAAG,EAAE;IACHN,OAAO,EAAE,CAAC;IACVC,MAAM,EAAEC,6BAAM,CAACK,GAAG,CAACL,6BAAM,CAACE,IAAI,CAAC;IAC/BC,QAAQ,EAAET;EACZ;AACF,CAAC;AAEM,MAAMY,gCAAiD,GAAAV,OAAA,CAAAU,gCAAA,GAAG;EAC/DT,KAAK,EAAE;IACLC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAEC,6BAAM,CAACC,EAAE,CAACD,6BAAM,CAACE,IAAI,CAAC;IAC9BC,QAAQ,EAAEV;EACZ,CAAC;EACDW,GAAG,EAAE;IACHN,OAAO,EAAE,CAAC;IACVC,MAAM,EAAEC,6BAAM,CAACK,GAAG,CAACL,6BAAM,CAACE,IAAI,CAAC;IAC/BC,QAAQ,EAAET;EACZ;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IS_FABRIC = exports.AUTOSCROLL_CONFIG = void 0;
7
+ var _reactNative = require("react-native");
8
+ const IOS_CONFIG = {
9
+ delay: 80,
10
+ increment: 100
11
+ };
12
+ const ANDROID_FABRIC_CONFIG = {
13
+ delay: 50,
14
+ increment: 80
15
+ };
16
+ const ANDROID_PAPER_CONFIG = {
17
+ delay: 10,
18
+ increment: 4
19
+ };
20
+ const IS_FABRIC = exports.IS_FABRIC = global && typeof global === 'object' && 'nativeFabricUIManager' in global;
21
+ const AUTOSCROLL_CONFIG = exports.AUTOSCROLL_CONFIG = _reactNative.Platform.select({
22
+ // autoscroll behaves differently with Fabric and Paper on Android
23
+ android: IS_FABRIC ? ANDROID_FABRIC_CONFIG : ANDROID_PAPER_CONFIG,
24
+ ios: IOS_CONFIG,
25
+ // unsupported platforms
26
+ web: IOS_CONFIG,
27
+ macos: IOS_CONFIG,
28
+ windows: IOS_CONFIG,
29
+ native: IOS_CONFIG
30
+ });
31
+ //# sourceMappingURL=autoscrollConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","IOS_CONFIG","delay","increment","ANDROID_FABRIC_CONFIG","ANDROID_PAPER_CONFIG","IS_FABRIC","exports","global","AUTOSCROLL_CONFIG","Platform","select","android","ios","web","macos","windows","native"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/autoscrollConfig.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE;AACb,CAAC;AAED,MAAMC,qBAAqB,GAAG;EAC5BF,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE;AACb,CAAC;AAED,MAAME,oBAAoB,GAAG;EAC3BH,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE;AACb,CAAC;AAEM,MAAMG,SAAS,GAAAC,OAAA,CAAAD,SAAA,GACpBE,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,uBAAuB,IAAIA,MAAM;AAEpE,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAGC,qBAAQ,CAACC,MAAM,CAAC;EAC/C;EACAC,OAAO,EAAEN,SAAS,GAAGF,qBAAqB,GAAGC,oBAAoB;EACjEQ,GAAG,EAAEZ,UAAU;EAEf;EACAa,GAAG,EAAEb,UAAU;EACfc,KAAK,EAAEd,UAAU;EACjBe,OAAO,EAAEf,UAAU;EACnBgB,MAAM,EAAEhB;AACV,CAAC,CAAC","ignoreList":[]}