react-native-reorderable-list 0.13.0 → 0.14.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 (71) hide show
  1. package/README.md +69 -9
  2. package/lib/commonjs/components/NestedReorderableList.js +2 -0
  3. package/lib/commonjs/components/NestedReorderableList.js.map +1 -1
  4. package/lib/commonjs/components/ReorderableList.js +4 -3
  5. package/lib/commonjs/components/ReorderableList.js.map +1 -1
  6. package/lib/commonjs/components/{ReorderableListCore/useReorderableListCore.js → ReorderableListCore.js} +187 -96
  7. package/lib/commonjs/components/ReorderableListCore.js.map +1 -0
  8. package/lib/commonjs/components/ScrollViewContainer.js +26 -7
  9. package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
  10. package/lib/commonjs/components/{ReorderableListCore/animationDefaults.js → constants.js} +26 -2
  11. package/lib/commonjs/components/constants.js.map +1 -0
  12. package/lib/commonjs/contexts/ScrollViewContainerContext.js.map +1 -1
  13. package/lib/module/components/NestedReorderableList.js +2 -0
  14. package/lib/module/components/NestedReorderableList.js.map +1 -1
  15. package/lib/module/components/ReorderableList.js +4 -3
  16. package/lib/module/components/ReorderableList.js.map +1 -1
  17. package/lib/module/components/{ReorderableListCore/useReorderableListCore.js → ReorderableListCore.js} +188 -95
  18. package/lib/module/components/ReorderableListCore.js.map +1 -0
  19. package/lib/module/components/ScrollViewContainer.js +28 -8
  20. package/lib/module/components/ScrollViewContainer.js.map +1 -1
  21. package/lib/module/components/constants.js +52 -0
  22. package/lib/module/components/constants.js.map +1 -0
  23. package/lib/module/contexts/ScrollViewContainerContext.js.map +1 -1
  24. package/lib/typescript/components/NestedReorderableList.d.ts.map +1 -1
  25. package/lib/typescript/components/ReorderableList.d.ts.map +1 -1
  26. package/lib/typescript/components/{ReorderableListCore/ReorderableListCore.d.ts → ReorderableListCore.d.ts} +2 -1
  27. package/lib/typescript/components/ReorderableListCore.d.ts.map +1 -0
  28. package/lib/typescript/components/ScrollViewContainer.d.ts +2 -1
  29. package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
  30. package/lib/typescript/components/{ReorderableListCore/animationDefaults.d.ts → constants.d.ts} +6 -1
  31. package/lib/typescript/components/constants.d.ts.map +1 -0
  32. package/lib/typescript/contexts/ScrollViewContainerContext.d.ts +1 -0
  33. package/lib/typescript/contexts/ScrollViewContainerContext.d.ts.map +1 -1
  34. package/lib/typescript/types/props.d.ts +9 -0
  35. package/lib/typescript/types/props.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/NestedReorderableList.tsx +2 -0
  38. package/src/components/ReorderableList.tsx +3 -2
  39. package/src/components/{ReorderableListCore/useReorderableListCore.ts → ReorderableListCore.tsx} +321 -184
  40. package/src/components/ScrollViewContainer.tsx +44 -13
  41. package/src/components/{ReorderableListCore/animationDefaults.ts → constants.ts} +34 -0
  42. package/src/contexts/ScrollViewContainerContext.ts +1 -0
  43. package/src/types/props.ts +9 -0
  44. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +0 -121
  45. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js.map +0 -1
  46. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js.map +0 -1
  47. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js +0 -31
  48. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +0 -1
  49. package/lib/commonjs/components/ReorderableListCore/index.js +0 -17
  50. package/lib/commonjs/components/ReorderableListCore/index.js.map +0 -1
  51. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js.map +0 -1
  52. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +0 -114
  53. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +0 -1
  54. package/lib/module/components/ReorderableListCore/animationDefaults.js +0 -28
  55. package/lib/module/components/ReorderableListCore/animationDefaults.js.map +0 -1
  56. package/lib/module/components/ReorderableListCore/autoscrollConfig.js +0 -25
  57. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +0 -1
  58. package/lib/module/components/ReorderableListCore/index.js +0 -2
  59. package/lib/module/components/ReorderableListCore/index.js.map +0 -1
  60. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +0 -1
  61. package/lib/typescript/components/ReorderableListCore/ReorderableListCore.d.ts.map +0 -1
  62. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts.map +0 -1
  63. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts +0 -6
  64. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts.map +0 -1
  65. package/lib/typescript/components/ReorderableListCore/index.d.ts +0 -2
  66. package/lib/typescript/components/ReorderableListCore/index.d.ts.map +0 -1
  67. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +0 -183
  68. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +0 -1
  69. package/src/components/ReorderableListCore/ReorderableListCore.tsx +0 -175
  70. package/src/components/ReorderableListCore/autoscrollConfig.ts +0 -31
  71. package/src/components/ReorderableListCore/index.ts +0 -1
@@ -3,43 +3,51 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useReorderableListCore = void 0;
6
+ 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 = require("react-native-reanimated");
11
- var _animationDefaults = require("./animationDefaults");
12
- var _autoscrollConfig = require("./autoscrollConfig");
13
- var _types = require("../../types");
10
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
+ var _contexts = require("../contexts");
12
+ var _types = require("../types");
13
+ var _constants = require("./constants");
14
+ var _ReorderableListCell = require("./ReorderableListCell");
14
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); }
15
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; }
16
- const version = _react.default.version.split('.');
17
- const hasAutomaticBatching = version.length ? parseInt(version[0], 10) >= 18 : false;
18
- const useReorderableListCore = ({
19
- ref,
20
- autoscrollThreshold,
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
+ const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList);
19
+ const ReorderableListCore = ({
20
+ autoscrollThreshold = 0.1,
21
21
  autoscrollThresholdOffset,
22
- autoscrollSpeedScale,
23
- autoscrollDelay,
24
- autoscrollActivationDelta,
25
- animationDuration,
22
+ autoscrollSpeedScale = 1,
23
+ autoscrollDelay = _constants.AUTOSCROLL_CONFIG.delay,
24
+ autoscrollActivationDelta = 5,
25
+ animationDuration = 200,
26
+ onLayout,
26
27
  onReorder,
28
+ onScroll,
27
29
  onDragStart,
28
30
  onDragEnd,
29
- onLayout,
30
31
  onIndexChange,
31
32
  scrollViewContainerRef,
33
+ scrollViewPageY,
32
34
  scrollViewHeightY,
33
35
  scrollViewScrollOffsetY,
34
36
  scrollViewScrollEnabled,
35
- initialScrollEnabled,
36
- initialScrollViewScrollEnabled,
37
- nestedScrollable,
37
+ scrollable,
38
+ outerScrollGesture,
38
39
  cellAnimations,
39
40
  shouldUpdateActiveItem,
41
+ panGesture,
42
+ panEnabled = true,
40
43
  panActivateAfterLongPress,
41
- panEnabled
42
- }) => {
44
+ data,
45
+ ...rest
46
+ }, ref) => {
47
+ // FlatList will default to true if we pass explicitly undefined,
48
+ // but internally we would treat it as false, so we force true.
49
+ const initialScrollEnabled = typeof rest.scrollEnabled === 'undefined' ? true : rest.scrollEnabled;
50
+ const initialScrollViewScrollEnabled = typeof rest.initialScrollViewScrollEnabled === 'undefined' ? true : rest.initialScrollViewScrollEnabled;
43
51
  const flatListRef = (0, _reactNativeReanimated.useAnimatedRef)();
44
52
  const [activeIndex, setActiveIndex] = (0, _react.useState)(-1);
45
53
  const scrollEnabled = (0, _reactNativeReanimated.useSharedValue)(initialScrollEnabled);
@@ -50,7 +58,7 @@ const useReorderableListCore = ({
50
58
  const startItemDragCenterY = (0, _reactNativeReanimated.useSharedValue)(0);
51
59
  const flatListScrollOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
52
60
  const flatListHeightY = (0, _reactNativeReanimated.useSharedValue)(0);
53
- const nestedFlatListPositionY = (0, _reactNativeReanimated.useSharedValue)(0);
61
+ const flatListPageY = (0, _reactNativeReanimated.useSharedValue)(0);
54
62
  // The scroll y translation of the list since drag start
55
63
  const dragScrollTranslationY = (0, _reactNativeReanimated.useSharedValue)(0);
56
64
  // The initial scroll offset y of the list on drag start
@@ -62,6 +70,9 @@ const useReorderableListCore = ({
62
70
  const draggedHeight = (0, _reactNativeReanimated.useSharedValue)(0);
63
71
  const itemOffset = (0, _reactNativeReanimated.useSharedValue)([]);
64
72
  const itemHeight = (0, _reactNativeReanimated.useSharedValue)([]);
73
+ // We need to track data length since itemOffset and itemHeight might contain more data than we need.
74
+ // e.g. items are removed from the list, in which case layout data for those items is set to 0.
75
+ const itemCount = (0, _reactNativeReanimated.useSharedValue)(data.length);
65
76
  const autoscrollTrigger = (0, _reactNativeReanimated.useSharedValue)(-1);
66
77
  const lastAutoscrollTrigger = (0, _reactNativeReanimated.useSharedValue)(-1);
67
78
  const dragY = (0, _reactNativeReanimated.useSharedValue)(0);
@@ -76,10 +87,30 @@ const useReorderableListCore = ({
76
87
  const dragDirection = (0, _reactNativeReanimated.useSharedValue)(0);
77
88
  const lastDragDirectionPivot = (0, _reactNativeReanimated.useSharedValue)(null);
78
89
  const autoscrollDelta = (0, _reactNativeReanimated.useSharedValue)(autoscrollActivationDelta);
90
+ const prevItemCount = (0, _react.useRef)(data.length);
91
+
92
+ // Position of the list relative to the scroll container
93
+ const nestedFlatListPositionY = (0, _reactNativeReanimated.useDerivedValue)(() => flatListPageY.value - ((scrollViewPageY === null || scrollViewPageY === void 0 ? void 0 : scrollViewPageY.value) || 0));
79
94
  (0, _react.useEffect)(() => {
80
95
  duration.value = animationDuration;
81
96
  autoscrollDelta.value = autoscrollActivationDelta;
82
- }, [duration, animationDuration, autoscrollDelta, autoscrollActivationDelta]);
97
+ }, [duration, animationDuration, autoscrollDelta, autoscrollActivationDelta, itemCount]);
98
+ (0, _react.useEffect)(() => {
99
+ itemCount.value = data.length;
100
+
101
+ // This could be done unmount of the removed cell, however it leads to bugs.
102
+ // Surprisingly the unmount gets sometimes called after the onLayout event
103
+ // setting all layout data to 0 and breaking the list. So we solve it like this.
104
+ if (data.length < prevItemCount.current) {
105
+ for (let i = data.length; i < prevItemCount.current; i++) {
106
+ (0, _reactNativeReanimated.runOnUI)(() => {
107
+ itemHeight.value[i] = 0;
108
+ itemOffset.value[i] = 0;
109
+ })();
110
+ }
111
+ }
112
+ prevItemCount.current = data.length;
113
+ }, [data.length, itemHeight, itemOffset, itemCount]);
83
114
  const listContextValue = (0, _react.useMemo)(() => ({
84
115
  draggedHeight,
85
116
  currentIndex,
@@ -131,7 +162,9 @@ const useReorderableListCore = ({
131
162
  currentItemDragCenterY.value = startItemDragCenterY.value + e.translationY;
132
163
  }
133
164
  }, [currentItemDragCenterY, currentIndex, startItemDragCenterY, itemOffset, itemHeight, flatListScrollOffsetY, scrollViewDragScrollTranslationY]);
134
- const panGestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Pan().onBegin(e => {
165
+ const panGestureHandler = (0, _react.useMemo)(() => (panGesture || _reactNativeGestureHandler.Gesture.Pan()).onBegin(e => {
166
+ 'worklet';
167
+
135
168
  // prevent new dragging until item is completely released
136
169
  if (state.value === _types.ReorderableListState.IDLE) {
137
170
  startY.value = e.y;
@@ -141,6 +174,8 @@ const useReorderableListCore = ({
141
174
  gestureState.value = e.state;
142
175
  }
143
176
  }).onUpdate(e => {
177
+ 'worklet';
178
+
144
179
  if (state.value === _types.ReorderableListState.DRAGGED) {
145
180
  setDragDirection(e);
146
181
  }
@@ -151,8 +186,16 @@ const useReorderableListCore = ({
151
186
  dragY.value = e.translationY + dragScrollTranslationY.value + scrollViewDragScrollTranslationY.value;
152
187
  gestureState.value = e.state;
153
188
  }
154
- }).onEnd(e => gestureState.value = e.state).onFinalize(e => gestureState.value = e.state), [state, startY, currentY, currentTranslationY, dragY, gestureState, dragScrollTranslationY, scrollViewDragScrollTranslationY, setDragDirection, setCurrentItemDragCenterY]);
155
- const panGestureHandlerWithOptions = (0, _react.useMemo)(() => {
189
+ }).onEnd(e => {
190
+ 'worklet';
191
+
192
+ gestureState.value = e.state;
193
+ }).onFinalize(e => {
194
+ 'worklet';
195
+
196
+ gestureState.value = e.state;
197
+ }), [panGesture, state, startY, currentY, currentTranslationY, dragY, gestureState, dragScrollTranslationY, scrollViewDragScrollTranslationY, setDragDirection, setCurrentItemDragCenterY]);
198
+ const panGestureHandlerWithPropOptions = (0, _react.useMemo)(() => {
156
199
  if (typeof panActivateAfterLongPress === 'number') {
157
200
  panGestureHandler.activateAfterLongPress(panActivateAfterLongPress);
158
201
  }
@@ -161,7 +204,7 @@ const useReorderableListCore = ({
161
204
  }
162
205
  return panGestureHandler;
163
206
  }, [panActivateAfterLongPress, panEnabled, panGestureHandler]);
164
- const gestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Simultaneous(_reactNativeGestureHandler.Gesture.Native(), panGestureHandlerWithOptions), [panGestureHandlerWithOptions]);
207
+ const gestureHandler = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Simultaneous(_reactNativeGestureHandler.Gesture.Native(), panGestureHandlerWithPropOptions), [panGestureHandlerWithPropOptions]);
165
208
  const setScrollEnabled = (0, _react.useCallback)(enabled => {
166
209
  // if scroll is enabled on list props then we can toggle it
167
210
  if (initialScrollEnabled) {
@@ -197,17 +240,10 @@ const useReorderableListCore = ({
197
240
  const reorder = (fromIndex, toIndex) => {
198
241
  (0, _reactNativeReanimated.runOnUI)(resetSharedValues)();
199
242
  if (fromIndex !== toIndex) {
200
- const updateState = () => {
201
- onReorder({
202
- from: fromIndex,
203
- to: toIndex
204
- });
205
- };
206
- if (!hasAutomaticBatching) {
207
- (0, _reactNative.unstable_batchedUpdates)(updateState);
208
- } else {
209
- updateState();
210
- }
243
+ onReorder({
244
+ from: fromIndex,
245
+ to: toIndex
246
+ });
211
247
  }
212
248
  };
213
249
  const recomputeLayout = (0, _react.useCallback)((from, to) => {
@@ -245,7 +281,7 @@ const useReorderableListCore = ({
245
281
  const currentOffset = itemOffset.value[currentIndex.value];
246
282
  const currentHeight = itemHeight.value[currentIndex.value];
247
283
  const currentCenter = currentOffset + currentHeight * 0.5;
248
- const max = itemOffset.value.length;
284
+ const max = itemCount.value;
249
285
  const possibleIndex = relativeDragCenterY < currentCenter ? Math.max(0, currentIndex.value - 1) : Math.min(max - 1, currentIndex.value + 1);
250
286
  if (currentIndex.value !== possibleIndex) {
251
287
  let possibleOffset = itemOffset.value[possibleIndex];
@@ -258,7 +294,7 @@ const useReorderableListCore = ({
258
294
  return distanceFromCurrent <= distanceFromPossible ? currentIndex.value : possibleIndex;
259
295
  }
260
296
  return currentIndex.value;
261
- }, [currentIndex, currentItemDragCenterY, itemOffset, itemHeight, flatListScrollOffsetY, scrollViewDragScrollTranslationY]);
297
+ }, [currentIndex, currentItemDragCenterY, itemCount, itemOffset, itemHeight, flatListScrollOffsetY, scrollViewDragScrollTranslationY]);
262
298
  const setCurrentIndex = (0, _react.useCallback)(() => {
263
299
  'worklet';
264
300
 
@@ -276,13 +312,13 @@ const useReorderableListCore = ({
276
312
 
277
313
  // if no custom scale run default
278
314
  if (!(cellAnimations && 'transform' in cellAnimations)) {
279
- const scaleConfig = _animationDefaults.SCALE_ANIMATION_CONFIG_DEFAULT[type];
315
+ const scaleConfig = _constants.SCALE_ANIMATION_CONFIG_DEFAULT[type];
280
316
  scaleDefault.value = (0, _reactNativeReanimated.withTiming)(scaleConfig.toValue, scaleConfig);
281
317
  }
282
318
 
283
319
  // if no custom opacity run the default
284
320
  if (!(cellAnimations && 'opacity' in cellAnimations)) {
285
- const opacityConfig = _animationDefaults.OPACITY_ANIMATION_CONFIG_DEFAULT[type];
321
+ const opacityConfig = _constants.OPACITY_ANIMATION_CONFIG_DEFAULT[type];
286
322
  opacityDefault.value = (0, _reactNativeReanimated.withTiming)(opacityConfig.toValue, opacityConfig);
287
323
  }
288
324
  }, [cellAnimations, scaleDefault, opacityDefault]);
@@ -330,7 +366,7 @@ const useReorderableListCore = ({
330
366
  }
331
367
  }
332
368
  });
333
- const calculateHiddenArea = (0, _react.useCallback)(() => {
369
+ const computeHiddenArea = (0, _react.useCallback)(() => {
334
370
  'worklet';
335
371
 
336
372
  if (!scrollViewScrollOffsetY || !scrollViewHeightY) {
@@ -348,9 +384,10 @@ const useReorderableListCore = ({
348
384
  bottom
349
385
  };
350
386
  }, [scrollViewScrollOffsetY, scrollViewHeightY, nestedFlatListPositionY, flatListHeightY]);
351
- const calculateThresholdArea = (0, _react.useCallback)(hiddenArea => {
387
+ const computeThresholdArea = (0, _react.useCallback)(() => {
352
388
  'worklet';
353
389
 
390
+ const hiddenArea = computeHiddenArea();
354
391
  const offsetTop = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.top) || 0);
355
392
  const offsetBottom = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.bottom) || 0);
356
393
  const threshold = Math.max(0, Math.min(autoscrollThreshold, 0.4));
@@ -362,58 +399,73 @@ const useReorderableListCore = ({
362
399
  top,
363
400
  bottom
364
401
  };
365
- }, [autoscrollThreshold, autoscrollThresholdOffset, flatListHeightY]);
366
- const calculateThresholdAreaParent = (0, _react.useCallback)(hiddenArea => {
402
+ }, [computeHiddenArea, autoscrollThreshold, autoscrollThresholdOffset, flatListHeightY]);
403
+ const computeContainerThresholdArea = (0, _react.useCallback)(() => {
367
404
  'worklet';
368
405
 
406
+ if (!scrollViewHeightY) {
407
+ return {
408
+ top: -Infinity,
409
+ bottom: Infinity
410
+ };
411
+ }
369
412
  const offsetTop = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.top) || 0);
370
413
  const offsetBottom = Math.max(0, (autoscrollThresholdOffset === null || autoscrollThresholdOffset === void 0 ? void 0 : autoscrollThresholdOffset.bottom) || 0);
371
414
  const threshold = Math.max(0, Math.min(autoscrollThreshold, 0.4));
372
- const area = flatListHeightY.value * threshold;
415
+ const visibleHeight = scrollViewHeightY.value - (offsetTop + offsetBottom);
416
+ const area = visibleHeight * threshold;
373
417
  const top = area + offsetTop;
374
- const bottom = flatListHeightY.value - area - offsetBottom;
375
-
376
- // if the hidden area is 0 then we don't have a threshold area
377
- // we might have floating errors like 0.0001 which we should ignore
418
+ const bottom = visibleHeight - area - offsetBottom;
378
419
  return {
379
- top: hiddenArea.top > 0.1 ? top + hiddenArea.top : 0,
380
- bottom: hiddenArea.bottom > 0.1 ? bottom - hiddenArea.bottom : 0
420
+ top,
421
+ bottom
381
422
  };
382
- }, [autoscrollThreshold, autoscrollThresholdOffset, flatListHeightY]);
383
- const shouldScrollParent = (0, _react.useCallback)(y => {
423
+ }, [autoscrollThreshold, autoscrollThresholdOffset, scrollViewHeightY]);
424
+ const shouldScrollContainer = (0, _react.useCallback)(y => {
384
425
  'worklet';
385
426
 
386
- const hiddenArea = calculateHiddenArea();
387
- const thresholdAreaParent = calculateThresholdAreaParent(hiddenArea);
427
+ const containerThresholdArea = computeContainerThresholdArea();
428
+ const nestedListHiddenArea = computeHiddenArea();
429
+
430
+ // We should scroll the container if there's a hidden part of the nested list.
431
+ // We might have floating errors like 0.0001 which we should ignore.
432
+ return nestedListHiddenArea.top > 0.01 && y <= containerThresholdArea.top || nestedListHiddenArea.bottom > 0.01 && y >= containerThresholdArea.bottom;
433
+ }, [computeHiddenArea, computeContainerThresholdArea]);
434
+ const getRelativeContainerY = (0, _react.useCallback)(() => {
435
+ 'worklet';
388
436
 
389
- // we might have floating errors like 0.0001 which we should ignore
390
- return hiddenArea.top > 0.1 && y <= thresholdAreaParent.top || hiddenArea.bottom > 0.1 && y >= thresholdAreaParent.bottom;
391
- }, [calculateHiddenArea, calculateThresholdAreaParent]);
392
- const scrollDirection = (0, _react.useCallback)(y => {
437
+ return currentY.value + nestedFlatListPositionY.value - scrollViewDragInitialScrollOffsetY.value;
438
+ }, [currentY, nestedFlatListPositionY, scrollViewDragInitialScrollOffsetY]);
439
+ const getRelativeListY = (0, _react.useCallback)(() => {
393
440
  'worklet';
394
441
 
395
- const hiddenArea = calculateHiddenArea();
396
- if (shouldScrollParent(y)) {
397
- const thresholdAreaParent = calculateThresholdAreaParent(hiddenArea);
398
- if (y <= thresholdAreaParent.top) {
442
+ return currentY.value + scrollViewDragScrollTranslationY.value;
443
+ }, [currentY, scrollViewDragScrollTranslationY]);
444
+ const scrollDirection = (0, _react.useCallback)(() => {
445
+ 'worklet';
446
+
447
+ const relativeContainerY = getRelativeContainerY();
448
+ if (shouldScrollContainer(relativeContainerY)) {
449
+ const containerThresholdArea = computeContainerThresholdArea();
450
+ if (relativeContainerY <= containerThresholdArea.top) {
399
451
  return -1;
400
452
  }
401
- if (y >= thresholdAreaParent.bottom) {
453
+ if (relativeContainerY >= containerThresholdArea.bottom) {
402
454
  return 1;
403
455
  }
404
- return 0;
405
- } else if (nestedScrollable) {
406
- const thresholdArea = calculateThresholdArea(hiddenArea);
407
- if (y <= thresholdArea.top) {
456
+ } else if (scrollable) {
457
+ const relativeListY = getRelativeListY();
458
+ const thresholdArea = computeThresholdArea();
459
+ if (relativeListY <= thresholdArea.top) {
408
460
  return -1;
409
461
  }
410
- if (y >= thresholdArea.bottom) {
462
+ if (relativeListY >= thresholdArea.bottom) {
411
463
  return 1;
412
464
  }
413
465
  }
414
466
  return 0;
415
- }, [nestedScrollable, shouldScrollParent, calculateHiddenArea, calculateThresholdArea, calculateThresholdAreaParent]);
416
- (0, _reactNativeReanimated.useAnimatedReaction)(() => currentY.value + scrollViewDragScrollTranslationY.value, y => {
467
+ }, [shouldScrollContainer, computeThresholdArea, computeContainerThresholdArea, getRelativeContainerY, getRelativeListY, scrollable]);
468
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => currentY.value, () => {
417
469
  if (state.value === _types.ReorderableListState.DRAGGED || state.value === _types.ReorderableListState.AUTOSCROLL) {
418
470
  setCurrentIndex();
419
471
 
@@ -421,7 +473,7 @@ const useReorderableListCore = ({
421
473
  // 1. Within the threshold area (top or bottom of list)
422
474
  // 2. Have dragged in the same direction as the scroll
423
475
  // 3. Not already in autoscroll mode
424
- if (dragDirection.value === scrollDirection(y)) {
476
+ if (dragDirection.value === scrollDirection()) {
425
477
  // When the first two conditions are met and it's already in autoscroll mode, we let it continue (no-op)
426
478
  if (state.value !== _types.ReorderableListState.AUTOSCROLL) {
427
479
  state.value = _types.ReorderableListState.AUTOSCROLL;
@@ -435,12 +487,15 @@ const useReorderableListCore = ({
435
487
  });
436
488
  (0, _reactNativeReanimated.useAnimatedReaction)(() => autoscrollTrigger.value, () => {
437
489
  if (autoscrollTrigger.value !== lastAutoscrollTrigger.value && state.value === _types.ReorderableListState.AUTOSCROLL) {
438
- let y = currentY.value + scrollViewDragScrollTranslationY.value;
439
- const autoscrollIncrement = scrollDirection(y) * _autoscrollConfig.AUTOSCROLL_CONFIG.increment * autoscrollSpeedScale;
490
+ const autoscrollIncrement = dragDirection.value * _constants.AUTOSCROLL_CONFIG.increment * autoscrollSpeedScale;
440
491
  if (autoscrollIncrement !== 0) {
441
492
  let scrollOffset = flatListScrollOffsetY.value;
442
493
  let listRef = flatListRef;
443
- if (shouldScrollParent(y) && scrollViewScrollOffsetY) {
494
+
495
+ // Checking on every autoscroll whether to scroll the container,
496
+ // this allows to smoothly pass the scroll from the container to the nested list
497
+ // without any gesture input.
498
+ if (scrollViewScrollOffsetY && shouldScrollContainer(getRelativeContainerY())) {
444
499
  scrollOffset = scrollViewScrollOffsetY.value;
445
500
  listRef = scrollViewContainerRef;
446
501
  }
@@ -472,7 +527,7 @@ const useReorderableListCore = ({
472
527
  }
473
528
  });
474
529
 
475
- // parent scroll handler
530
+ // container scroll handler
476
531
  (0, _reactNativeReanimated.useAnimatedReaction)(() => scrollViewScrollOffsetY === null || scrollViewScrollOffsetY === void 0 ? void 0 : scrollViewScrollOffsetY.value, value => {
477
532
  if (value && scrollViewScrollEnabled) {
478
533
  // checking if the list is not scrollable instead of the scrolling state
@@ -516,31 +571,67 @@ const useReorderableListCore = ({
516
571
  }
517
572
  }, [resetSharedValues, shouldUpdateActiveItem, dragInitialScrollOffsetY, scrollViewScrollOffsetY, scrollViewDragInitialScrollOffsetY, setScrollEnabled, currentIndex, draggedHeight, draggedIndex, state, flatListScrollOffsetY, itemHeight, onDragStart, runDefaultDragAnimations]);
518
573
  const handleFlatListLayout = (0, _react.useCallback)(e => {
519
- nestedFlatListPositionY.value = e.nativeEvent.layout.y;
520
574
  flatListHeightY.value = e.nativeEvent.layout.height;
575
+
576
+ // If nested in a scroll container.
577
+ if (scrollViewScrollOffsetY) {
578
+ // Timeout fixes a bug where measure returns height 0.
579
+ setTimeout(() => {
580
+ (0, _reactNativeReanimated.runOnUI)(() => {
581
+ const measurement = (0, _reactNativeReanimated.measure)(flatListRef);
582
+ if (!measurement) {
583
+ return;
584
+ }
585
+ flatListPageY.value = measurement.pageY;
586
+ })();
587
+ }, 100);
588
+ }
521
589
  onLayout === null || onLayout === void 0 || onLayout(e);
522
- }, [nestedFlatListPositionY, flatListHeightY, onLayout]);
523
- const handleRef = value => {
590
+ }, [flatListRef, flatListPageY, flatListHeightY, scrollViewScrollOffsetY, onLayout]);
591
+ const handleRef = (0, _react.useCallback)(value => {
524
592
  flatListRef(value);
525
593
  if (typeof ref === 'function') {
526
594
  ref(value);
527
595
  } else if (ref) {
528
596
  ref.current = value;
529
597
  }
530
- };
531
- return {
532
- gestureHandler,
533
- handleScroll,
534
- handleFlatListLayout,
535
- handleRef,
536
- startDrag,
537
- listContextValue,
538
- itemOffset,
539
- itemHeight,
540
- draggedIndex,
541
- dragY,
542
- duration
543
- };
598
+ }, [flatListRef, ref]);
599
+ const combinedGesture = (0, _react.useMemo)(() => {
600
+ // android is able to handle nested scroll view, but not the full height ones like iOS
601
+ if (outerScrollGesture && !(_reactNative.Platform.OS === 'android' && scrollable)) {
602
+ return _reactNativeGestureHandler.Gesture.Simultaneous(outerScrollGesture, gestureHandler);
603
+ }
604
+ return gestureHandler;
605
+ }, [scrollable, outerScrollGesture, gestureHandler]);
606
+ const composedScrollHandler = (0, _reactNativeReanimated.useComposedEventHandler)([handleScroll, onScroll || null]);
607
+ const renderAnimatedCell = (0, _react.useCallback)(({
608
+ cellKey,
609
+ ...props
610
+ }) => /*#__PURE__*/_react.default.createElement(_ReorderableListCell.ReorderableListCell, _extends({}, props, {
611
+ // forces remount with key change on reorder
612
+ key: `${cellKey}+${props.index}`,
613
+ itemOffset: itemOffset,
614
+ itemHeight: itemHeight,
615
+ dragY: dragY,
616
+ draggedIndex: draggedIndex,
617
+ animationDuration: duration,
618
+ startDrag: startDrag
619
+ })), [itemOffset, itemHeight, dragY, draggedIndex, duration, startDrag]);
620
+ return /*#__PURE__*/_react.default.createElement(_contexts.ReorderableListContext.Provider, {
621
+ value: listContextValue
622
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.GestureDetector, {
623
+ gesture: combinedGesture
624
+ }, /*#__PURE__*/_react.default.createElement(AnimatedFlatList, _extends({}, rest, {
625
+ ref: handleRef,
626
+ data: data,
627
+ CellRendererComponent: renderAnimatedCell,
628
+ onLayout: handleFlatListLayout,
629
+ onScroll: composedScrollHandler,
630
+ scrollEventThrottle: 1,
631
+ horizontal: false,
632
+ removeClippedSubviews: false,
633
+ numColumns: 1
634
+ }))));
544
635
  };
545
- exports.useReorderableListCore = useReorderableListCore;
546
- //# sourceMappingURL=useReorderableListCore.js.map
636
+ const MemoizedReorderableListCore = exports.ReorderableListCore = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef(ReorderableListCore));
637
+ //# sourceMappingURL=ReorderableListCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_reactNativeReanimated","_contexts","_types","_constants","_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","autoscrollActivationDelta","animationDuration","onLayout","onReorder","onScroll","onDragStart","onDragEnd","onIndexChange","scrollViewContainerRef","scrollViewPageY","scrollViewHeightY","scrollViewScrollOffsetY","scrollViewScrollEnabled","scrollable","outerScrollGesture","cellAnimations","shouldUpdateActiveItem","panGesture","panEnabled","panActivateAfterLongPress","data","rest","ref","initialScrollEnabled","scrollEnabled","initialScrollViewScrollEnabled","flatListRef","useAnimatedRef","activeIndex","setActiveIndex","useState","useSharedValue","gestureState","State","UNDETERMINED","currentY","currentTranslationY","currentItemDragCenterY","startItemDragCenterY","flatListScrollOffsetY","flatListHeightY","flatListPageY","dragScrollTranslationY","dragInitialScrollOffsetY","scrollViewDragScrollTranslationY","scrollViewDragInitialScrollOffsetY","draggedHeight","itemOffset","itemHeight","itemCount","autoscrollTrigger","lastAutoscrollTrigger","dragY","currentIndex","draggedIndex","state","ReorderableListState","IDLE","dragEndHandlers","startY","duration","scaleDefault","opacityDefault","dragDirection","lastDragDirectionPivot","autoscrollDelta","prevItemCount","useRef","nestedFlatListPositionY","useDerivedValue","value","useEffect","current","runOnUI","listContextValue","useMemo","transform","scale","opacity","setDragDirection","useCallback","direction","velocityY","absoluteY","Math","abs","setCurrentItemDragCenterY","itemCenter","itemY","translationY","panGestureHandler","Gesture","Pan","onBegin","y","onUpdate","DRAGGED","RELEASED","onEnd","onFinalize","panGestureHandlerWithPropOptions","activateAfterLongPress","enabled","gestureHandler","Simultaneous","Native","setScrollEnabled","_flatListRef$current","setNativeProps","_scrollViewContainerR","resetSharedValues","resetSharedValuesAfterAnimations","setTimeout","reorder","fromIndex","toIndex","from","to","recomputeLayout","itemDirection","index1","index2","newOffset1","newHeight1","newOffset2","newHeight2","computeCurrentIndex","relativeDragCenterY","currentOffset","currentHeight","currentCenter","max","possibleIndex","min","possibleOffset","possibleCenter","distanceFromCurrent","distanceFromPossible","setCurrentIndex","newIndex","index","runDefaultDragAnimations","type","scaleConfig","SCALE_ANIMATION_CONFIG_DEFAULT","withTiming","toValue","opacityConfig","OPACITY_ANIMATION_CONFIG_DEFAULT","useAnimatedReaction","ACTIVE","BEGAN","AUTOSCROLL","runOnJS","handlers","Array","isArray","forEach","fn","currentItemOffset","currentItemHeight","draggedItemOffset","draggedItemHeight","newTopPosition","easing","Easing","out","ease","computeHiddenArea","top","bottom","computeThresholdArea","hiddenArea","offsetTop","offsetBottom","threshold","visibleHeight","area","computeContainerThresholdArea","Infinity","shouldScrollContainer","containerThresholdArea","nestedListHiddenArea","getRelativeContainerY","getRelativeListY","scrollDirection","relativeContainerY","relativeListY","thresholdArea","autoscrollIncrement","increment","scrollOffset","listRef","scrollTo","handleScroll","useAnimatedScrollHandler","contentOffset","withDelay","startDrag","handleFlatListLayout","nativeEvent","layout","height","measurement","measure","pageY","handleRef","combinedGesture","Platform","OS","composedScrollHandler","useComposedEventHandler","renderAnimatedCell","cellKey","props","createElement","ReorderableListCell","key","ReorderableListContext","Provider","GestureDetector","gesture","CellRendererComponent","scrollEventThrottle","horizontal","removeClippedSubviews","numColumns","MemoizedReorderableListCore","exports","React","memo","forwardRef"],"sourceRoot":"../../../src","sources":["components/ReorderableListCore.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,0BAAA,GAAAF,OAAA;AAQA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAkBA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,oBAAA,GAAAP,OAAA;AAA0D,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,C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ACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAMC,2BAA2B,GAAAC,OAAA,CAAA3O,mBAAA,gBAAG4O,cAAK,CAACC,IAAI,cAC5CD,cAAK,CAACE,UAAU,CAAC9O,mBAAmB,CACtC,CAIuB","ignoreList":[]}
@@ -11,16 +11,25 @@ var _ScrollViewContainerContext = require("../contexts/ScrollViewContainerContex
11
11
  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
12
  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
13
  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); }
14
- const ScrollViewContainer = ({
14
+ const ScrollViewContainerWithRef = ({
15
15
  onLayout,
16
16
  onScroll,
17
17
  scrollEnabled = true,
18
18
  ...rest
19
- }) => {
19
+ }, ref) => {
20
20
  const scrollViewScrollEnabled = (0, _reactNativeReanimated.useSharedValue)(scrollEnabled);
21
21
  const scrollViewContainerRef = (0, _reactNativeReanimated.useAnimatedRef)();
22
22
  const scrollViewScrollOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
23
+ const scrollViewPageY = (0, _reactNativeReanimated.useSharedValue)(0);
23
24
  const scrollViewHeightY = (0, _reactNativeReanimated.useSharedValue)(0);
25
+ const handleRef = (0, _react.useCallback)(value => {
26
+ scrollViewContainerRef(value);
27
+ if (typeof ref === 'function') {
28
+ ref(value);
29
+ } else if (ref) {
30
+ ref.current = value;
31
+ }
32
+ }, [scrollViewContainerRef, ref]);
24
33
  const outerScrollGesture = (0, _react.useMemo)(() => _reactNativeGestureHandler.Gesture.Native(), []);
25
34
  const handleScroll = (0, _reactNativeReanimated.useAnimatedScrollHandler)(e => {
26
35
  scrollViewScrollOffsetY.value = e.contentOffset.y;
@@ -28,26 +37,36 @@ const ScrollViewContainer = ({
28
37
  const composedScrollHandler = (0, _reactNativeReanimated.useComposedEventHandler)([handleScroll, onScroll || null]);
29
38
  const contextValue = (0, _react.useMemo)(() => ({
30
39
  scrollViewContainerRef,
40
+ scrollViewPageY,
31
41
  scrollViewHeightY,
32
42
  scrollViewScrollOffsetY,
33
43
  scrollViewScrollEnabled,
34
44
  outerScrollGesture,
35
45
  initialScrollViewScrollEnabled: scrollEnabled
36
- }), [scrollViewContainerRef, scrollViewHeightY, scrollViewScrollOffsetY, scrollViewScrollEnabled, outerScrollGesture, scrollEnabled]);
37
- const handleLayout = e => {
46
+ }), [scrollViewContainerRef, scrollViewPageY, scrollViewHeightY, scrollViewScrollOffsetY, scrollViewScrollEnabled, outerScrollGesture, scrollEnabled]);
47
+ const handleLayout = (0, _react.useCallback)(e => {
38
48
  scrollViewHeightY.value = e.nativeEvent.layout.height;
49
+
50
+ // measuring pageY allows wrapping nested lists in other views
51
+ (0, _reactNativeReanimated.runOnUI)(() => {
52
+ const measurement = (0, _reactNativeReanimated.measure)(scrollViewContainerRef);
53
+ if (!measurement) {
54
+ return;
55
+ }
56
+ scrollViewPageY.value = measurement.pageY;
57
+ })();
39
58
  onLayout === null || onLayout === void 0 || onLayout(e);
40
- };
59
+ }, [onLayout, scrollViewContainerRef, scrollViewHeightY, scrollViewPageY]);
41
60
  return /*#__PURE__*/_react.default.createElement(_ScrollViewContainerContext.ScrollViewContainerContext.Provider, {
42
61
  value: contextValue
43
62
  }, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.GestureDetector, {
44
63
  gesture: outerScrollGesture
45
64
  }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.ScrollView, _extends({}, rest, {
46
- ref: scrollViewContainerRef,
65
+ ref: handleRef,
47
66
  onScroll: composedScrollHandler,
48
67
  onLayout: handleLayout,
49
68
  scrollEnabled: scrollEnabled
50
69
  }))));
51
70
  };
52
- exports.ScrollViewContainer = ScrollViewContainer;
71
+ const ScrollViewContainer = exports.ScrollViewContainer = /*#__PURE__*/(0, _react.forwardRef)(ScrollViewContainerWithRef);
53
72
  //# sourceMappingURL=ScrollViewContainer.js.map