react-native-reorderable-list 0.7.1 → 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 (85) 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/{constants.js → autoscrollConfig.js} +1 -1
  11. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  12. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js +61 -32
  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 +9 -5
  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/{constants.js → autoscrollConfig.js} +1 -1
  31. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  32. package/lib/module/components/ReorderableListCore/useReorderableListCore.js +60 -31
  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/{constants.d.ts → autoscrollConfig.d.ts} +1 -1
  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 +5 -5
  64. package/src/components/ReorderableList.tsx +14 -16
  65. package/src/components/ReorderableListCell.tsx +36 -32
  66. package/src/components/ReorderableListCore/ReorderableListCore.tsx +15 -4
  67. package/src/components/ReorderableListCore/animationDefaults.ts +35 -0
  68. package/src/components/ReorderableListCore/useReorderableListCore.ts +84 -37
  69. package/src/components/ScrollViewContainer.tsx +7 -3
  70. package/src/components/index.ts +0 -1
  71. package/src/contexts/ReorderableListContext.ts +2 -0
  72. package/src/index.ts +4 -6
  73. package/src/types/misc.ts +3 -3
  74. package/src/types/props.ts +26 -43
  75. package/lib/commonjs/components/ReorderableListCore/constants.js.map +0 -1
  76. package/lib/commonjs/components/ReorderableListItem.js +0 -87
  77. package/lib/commonjs/components/ReorderableListItem.js.map +0 -1
  78. package/lib/module/components/ReorderableListCore/constants.js.map +0 -1
  79. package/lib/module/components/ReorderableListItem.js +0 -78
  80. package/lib/module/components/ReorderableListItem.js.map +0 -1
  81. package/lib/typescript/components/ReorderableListCore/constants.d.ts.map +0 -1
  82. package/lib/typescript/components/ReorderableListItem.d.ts +0 -4
  83. package/lib/typescript/components/ReorderableListItem.d.ts.map +0 -1
  84. package/src/components/ReorderableListItem.tsx +0 -108
  85. /package/src/components/ReorderableListCore/{constants.ts → autoscrollConfig.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { FlatList, LayoutChangeEvent, NativeScrollEvent, ScrollView } from 'react-native';
2
+ import { FlatList, LayoutChangeEvent, ScrollView } from 'react-native';
3
3
  import { SharedValue } from 'react-native-reanimated';
4
- import { ReorderableListDragEndEvent } from '../../types';
4
+ import { ReorderableListCellAnimations, ReorderableListDragEndEvent, ReorderableListDragStartEvent } from '../../types';
5
5
  import type { ReorderableListReorderEvent } from '../../types';
6
6
  interface UseReorderableListCoreArgs<T> {
7
7
  ref: React.ForwardedRef<FlatList<T>>;
@@ -11,8 +11,8 @@ interface UseReorderableListCoreArgs<T> {
11
11
  animationDuration: number;
12
12
  dragReorderThreshold: number;
13
13
  onReorder: (event: ReorderableListReorderEvent) => void;
14
+ onDragStart?: (event: ReorderableListDragStartEvent) => void;
14
15
  onDragEnd?: (event: ReorderableListDragEndEvent) => void;
15
- onScroll?: (event: NativeScrollEvent) => void;
16
16
  onLayout?: (event: LayoutChangeEvent) => void;
17
17
  scrollViewContainerRef: React.RefObject<ScrollView> | undefined;
18
18
  scrollViewHeightY: SharedValue<number> | undefined;
@@ -21,8 +21,9 @@ interface UseReorderableListCoreArgs<T> {
21
21
  initialScrollEnabled: boolean | undefined;
22
22
  initialScrollViewScrollEnabled: boolean | undefined;
23
23
  nestedScrollable: boolean | undefined;
24
+ cellAnimations: ReorderableListCellAnimations | undefined;
24
25
  }
25
- export declare const useReorderableListCore: <T>({ ref, autoscrollThreshold, autoscrollSpeedScale, autoscrollDelay, animationDuration, dragReorderThreshold, onReorder, onDragEnd, onScroll, onLayout, scrollViewContainerRef, scrollViewHeightY, scrollViewScrollOffsetY, scrollViewScrollEnabled, initialScrollEnabled, initialScrollViewScrollEnabled, nestedScrollable, }: UseReorderableListCoreArgs<T>) => {
26
+ export declare const useReorderableListCore: <T>({ ref, autoscrollThreshold, autoscrollSpeedScale, autoscrollDelay, animationDuration, dragReorderThreshold, onReorder, onDragStart, onDragEnd, onLayout, scrollViewContainerRef, scrollViewHeightY, scrollViewScrollOffsetY, scrollViewScrollEnabled, initialScrollEnabled, initialScrollViewScrollEnabled, nestedScrollable, cellAnimations, }: UseReorderableListCoreArgs<T>) => {
26
27
  gestureHandler: import("react-native-gesture-handler/lib/typescript/handlers/gestures/gestureComposition").SimultaneousGesture;
27
28
  handleScroll: import("react-native-reanimated").ScrollHandlerProcessed<Record<string, unknown>>;
28
29
  handleFlatListLayout: (e: LayoutChangeEvent) => void;
@@ -33,6 +34,8 @@ export declare const useReorderableListCore: <T>({ ref, autoscrollThreshold, aut
33
34
  currentIndex: SharedValue<number>;
34
35
  draggedIndex: SharedValue<number>;
35
36
  dragEndHandlers: SharedValue<((from: number, to: number) => void)[][]>;
37
+ scale: SharedValue<number>;
38
+ opacity: SharedValue<number>;
36
39
  };
37
40
  itemOffset: SharedValue<number[]>;
38
41
  itemHeight: SharedValue<number[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"useReorderableListCore.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/useReorderableListCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAEX,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAGf,WAAW,EAUZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAC,2BAA2B,EAAuB,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAO7D,UAAU,0BAA0B,CAAC,CAAC;IACpC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACxD,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAChE,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACnD,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACzD,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC1D,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,8BAA8B,EAAE,OAAO,GAAG,SAAS,CAAC;IACpD,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,eAAO,MAAM,sBAAsB;;;;;uBA8hBvB,MAAM;;;;;6CAlfN,MAAM,MAAM,MAAM,KAAK,IAAI;;;;;;;CA0jBtC,CAAC"}
1
+ {"version":3,"file":"useReorderableListCore.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/useReorderableListCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,UAAU,EAEX,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAGf,WAAW,EAUZ,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAE9B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAO7D,UAAU,0BAA0B,CAAC,CAAC;IACpC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACxD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAChE,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACnD,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACzD,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC1D,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,8BAA8B,EAAE,OAAO,GAAG,SAAS,CAAC;IACpD,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,6BAA6B,GAAG,SAAS,CAAC;CAC3D;AAED,eAAO,MAAM,sBAAsB;;;;;uBA8jBvB,MAAM;;;;;6CAjhBN,MAAM,MAAM,MAAM,KAAK,IAAI;;;;;;;;;CA+lBtC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollViewContainer.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollViewContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4DlE,CAAC"}
1
+ {"version":3,"file":"ScrollViewContainer.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollViewContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAYrC,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA+DlE,CAAC"}
@@ -1,6 +1,5 @@
1
1
  export * from './ReorderableList';
2
2
  export * from './NestedReorderableList';
3
3
  export * from './ReorderableListCell';
4
- export * from './ReorderableListItem';
5
4
  export * from './ScrollViewContainer';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -4,6 +4,8 @@ interface ReorderableListContextData {
4
4
  currentIndex: SharedValue<number>;
5
5
  draggedHeight: SharedValue<number>;
6
6
  dragEndHandlers: SharedValue<((from: number, to: number) => void)[][]>;
7
+ scale: SharedValue<number>;
8
+ opacity: SharedValue<number>;
7
9
  }
8
10
  export declare const ReorderableListContext: React.Context<ReorderableListContextData | undefined>;
9
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ReorderableListContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ReorderableListContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEzD,UAAU,0BAA0B;IAClC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,sBAAsB,uDAEvB,CAAC"}
1
+ {"version":3,"file":"ReorderableListContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ReorderableListContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEzD,UAAU,0BAA0B;IAClC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACvE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,sBAAsB,uDAEvB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { NestedReorderableList, ReorderableList, ReorderableListItem, ScrollViewContainer } from './components';
1
+ import { NestedReorderableList, ReorderableList, ScrollViewContainer } from './components';
2
2
  import { useReorderableDrag, useReorderableDragEnd, useReorderableDragStart } from './hooks';
3
- import type { ReorderableListDragEndEvent, ReorderableListItemConfig, ReorderableListItemProps, ReorderableListProps, ReorderableListReorderEvent, ScrollViewContainerProps } from './types';
3
+ import type { ReorderableListCellAnimations, ReorderableListDragEndEvent, ReorderableListDragStartEvent, ReorderableListProps, ReorderableListReorderEvent, ScrollViewContainerProps } from './types';
4
4
  import { reorderItems } from './utils';
5
- export { useReorderableDrag, useReorderableDragStart, useReorderableDragEnd, ReorderableListProps, ReorderableListReorderEvent, ReorderableListDragEndEvent, ReorderableListItem, ReorderableListItemConfig, ReorderableListItemProps, ScrollViewContainer, ScrollViewContainerProps, NestedReorderableList, reorderItems, };
5
+ export { useReorderableDrag, useReorderableDragStart, useReorderableDragEnd, ReorderableListProps, ReorderableListReorderEvent, ReorderableListCellAnimations, ReorderableListDragStartEvent, ReorderableListDragEndEvent, ScrollViewContainer, ScrollViewContainerProps, NestedReorderableList, reorderItems, };
6
6
  export default ReorderableList;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,YAAY,GACb,CAAC;AACF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,EAC3B,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,YAAY,GACb,CAAC;AACF,eAAe,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export declare enum ReorderableListState {
2
2
  IDLE = 0,
3
- DRAGGING = 1,
4
- RELEASING = 2,
5
- AUTO_SCROLL = 3
3
+ DRAGGED = 1,
4
+ RELEASED = 2,
5
+ AUTOSCROLL = 3
6
6
  }
7
7
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/types/misc.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,IAAI,IAAI;IACR,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,WAAW,IAAA;CACZ"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/types/misc.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,IAAI,IAAI;IACR,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,UAAU,IAAA;CACX"}
@@ -1,5 +1,5 @@
1
- import type { FlatListProps, NativeScrollEvent, ScrollViewProps, ViewProps } from 'react-native';
2
- import { EasingFunction } from 'react-native-reanimated';
1
+ import type { FlatListProps, ScrollViewProps } from 'react-native';
2
+ import { SharedValue, useAnimatedScrollHandler } from 'react-native-reanimated';
3
3
  export interface ReorderableListReorderEvent {
4
4
  /**
5
5
  * Index of the dragged item.
@@ -10,6 +10,12 @@ export interface ReorderableListReorderEvent {
10
10
  */
11
11
  to: number;
12
12
  }
13
+ export interface ReorderableListDragStartEvent {
14
+ /**
15
+ * Index of the dragged item.
16
+ */
17
+ index: number;
18
+ }
13
19
  export interface ReorderableListDragEndEvent {
14
20
  /**
15
21
  * Index of the dragged item.
@@ -52,59 +58,41 @@ export interface ReorderableListProps<T> extends Omit<FlatListProps<T>, OmittedP
52
58
  */
53
59
  animationDuration?: number;
54
60
  /**
55
- * Event fired after an item is released and the list is reordered.
61
+ * Allows passing an object with shared values that can animate a cell by using the `onDragStart` and `onDragEnd` events.
56
62
  */
57
- onReorder: (event: ReorderableListReorderEvent) => void;
63
+ cellAnimations?: ReorderableListCellAnimations;
58
64
  /**
59
- * Event fired at most once per frame during scrolling. Needs to be a `worklet`. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info.
60
- */
61
- onScroll?: (event: NativeScrollEvent) => void;
62
- /**
63
- * 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.
64
- */
65
- onDragEnd?: (event: ReorderableListDragEndEvent) => void;
66
- }
67
- export interface ReorderableListItemConfig {
68
- /**
69
- * Value of the animated style on drag end.
70
- */
71
- enabled?: boolean;
72
- /**
73
- * Value of the animated style on drag end.
74
- */
75
- valueEnd?: number;
76
- /**
77
- * Value of the animated style on drag start.
65
+ * Event fired after an item is released and the list is reordered.
78
66
  */
79
- valueStart?: number;
67
+ onReorder: (event: ReorderableListReorderEvent) => void;
80
68
  /**
81
- * Easing function for the animation to the end value. Default: `Easing.in(Easing.ease)`.
69
+ * An animated scroll handler created with useAnimatedScrollHandler. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info.
82
70
  */
83
- easingEnd?: EasingFunction;
71
+ onScroll?: ReturnType<typeof useAnimatedScrollHandler>;
84
72
  /**
85
- * Easing function for the animation to the start value. Default: `Easing.out(Easing.ease)`.
73
+ * 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.
86
74
  */
87
- easingStart?: EasingFunction;
75
+ onDragStart?: (event: ReorderableListDragStartEvent) => void;
88
76
  /**
89
- * Duration of the animations in milliseconds. Default: `200`.
77
+ * 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.
90
78
  */
91
- duration?: number;
79
+ onDragEnd?: (event: ReorderableListDragEndEvent) => void;
92
80
  }
93
- export interface ReorderableListItemProps extends ViewProps {
81
+ export interface ReorderableListCellAnimations {
94
82
  /**
95
- * Config for the `opacity` animation. Enabled by default with custom default options.
83
+ * Shared value to animate the opacity of a dragged item. Set to false to disable default opacity animations.
96
84
  */
97
- opacityAnimationConfig?: ReorderableListItemConfig;
85
+ opacity?: SharedValue<number> | false;
98
86
  /**
99
- * Config for the `scale` animation. Enabled by default with custom default options.
87
+ * Shared value to animate the scale of a dragged item. Set to false to disable default scale animations.
100
88
  */
101
- scaleAnimationConfig?: ReorderableListItemConfig;
89
+ scale?: SharedValue<number> | false;
102
90
  }
103
91
  export interface ScrollViewContainerProps extends Omit<ScrollViewProps, 'onScroll'> {
104
92
  /**
105
- * 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.
93
+ * An animated scroll handler created with useAnimatedScrollHandler. See [Reanimated docs](https://docs.swmansion.com/react-native-reanimated) for further info.
106
94
  */
107
- onScroll?: (event: NativeScrollEvent) => void;
95
+ onScroll?: ReturnType<typeof useAnimatedScrollHandler>;
108
96
  }
109
97
  export interface NestedReorderableListProps<T> extends ReorderableListProps<T> {
110
98
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,KAAK,YAAY,GACb,YAAY,GACZ,UAAU,GACV,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,YAAY,CAAC;AAEjB,MAAM,WAAW,oBAAoB,CAAC,CAAC,CACrC,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;IAC5C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;CAC1D;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAyB,SAAQ,SAAS;IACzD;;OAEG;IACH,sBAAsB,CAAC,EAAE,yBAAyB,CAAC;IACnD;;OAEG;IACH,oBAAoB,CAAC,EAAE,yBAAyB,CAAC;CAClD;AAED,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAC5E;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAC,WAAW,EAAE,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AAE9E,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,KAAK,YAAY,GACb,YAAY,GACZ,UAAU,GACV,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,YAAY,CAAC;AAEjB,MAAM,WAAW,oBAAoB,CAAC,CAAC,CACrC,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;IAC5C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,6BAA6B,CAAC;IAC/C;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IACvD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;CAC1D;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;CACrC;AAED,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAC5E;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reorderable-list",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Reorderable list for React Native applications, powered by Reanimated",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -81,8 +81,8 @@
81
81
  "react": "18.3.1",
82
82
  "react-native": "0.76.5",
83
83
  "react-native-builder-bob": "^0.20.0",
84
- "react-native-gesture-handler": "^2.12.0",
85
- "react-native-reanimated": "^3.15.3",
84
+ "react-native-gesture-handler": "2.12.0",
85
+ "react-native-reanimated": "3.12.0",
86
86
  "release-it": "^17.6.0",
87
87
  "tsc": "^2.0.4",
88
88
  "typescript": "5.0.4"
@@ -90,8 +90,8 @@
90
90
  "peerDependencies": {
91
91
  "react": "*",
92
92
  "react-native": "*",
93
- "react-native-gesture-handler": ">=2.0.0",
94
- "react-native-reanimated": ">=3.6.0"
93
+ "react-native-gesture-handler": ">=2.12.0",
94
+ "react-native-reanimated": ">=3.12.0"
95
95
  },
96
96
  "engines": {
97
97
  "node": ">= 18.0.0"
@@ -7,22 +7,20 @@ import type {ReorderableListProps} from '../types';
7
7
  const ReorderableListWithRef = <T,>(
8
8
  {scrollEnabled = true, ...rest}: ReorderableListProps<T>,
9
9
  ref: React.Ref<FlatList<T>>,
10
- ) => {
11
- return (
12
- <ReorderableListCore
13
- {...rest}
14
- ref={ref}
15
- scrollEnabled={scrollEnabled}
16
- initialScrollViewScrollEnabled={true}
17
- scrollable={true}
18
- scrollViewContainerRef={undefined}
19
- scrollViewScrollOffsetY={undefined}
20
- scrollViewHeightY={undefined}
21
- outerScrollGesture={undefined}
22
- scrollViewScrollEnabled={undefined}
23
- />
24
- );
25
- };
10
+ ) => (
11
+ <ReorderableListCore
12
+ {...rest}
13
+ ref={ref}
14
+ scrollEnabled={scrollEnabled}
15
+ initialScrollViewScrollEnabled={true}
16
+ scrollable={true}
17
+ scrollViewContainerRef={undefined}
18
+ scrollViewScrollOffsetY={undefined}
19
+ scrollViewHeightY={undefined}
20
+ outerScrollGesture={undefined}
21
+ scrollViewScrollEnabled={undefined}
22
+ />
23
+ );
26
24
 
27
25
  export const ReorderableList = forwardRef(ReorderableListWithRef) as <T>(
28
26
  props: ReorderableListProps<T> & React.RefAttributes<FlatList<T>>,
@@ -1,5 +1,5 @@
1
1
  import React, {memo, useCallback, useMemo} from 'react';
2
- import type {CellRendererProps, LayoutChangeEvent} from 'react-native';
2
+ import {CellRendererProps, LayoutChangeEvent} from 'react-native';
3
3
 
4
4
  import Animated, {
5
5
  Easing,
@@ -7,6 +7,7 @@ import Animated, {
7
7
  runOnUI,
8
8
  useAnimatedReaction,
9
9
  useAnimatedStyle,
10
+ useDerivedValue,
10
11
  useSharedValue,
11
12
  withTiming,
12
13
  } from 'react-native-reanimated';
@@ -21,7 +22,6 @@ interface ReorderableListCellProps<T>
21
22
  itemHeight: SharedValue<number[]>;
22
23
  dragY: SharedValue<number>;
23
24
  draggedIndex: SharedValue<number>;
24
- // animation duration as a shared value allows to avoid re-renders on value change
25
25
  animationDuration: SharedValue<number>;
26
26
  }
27
27
 
@@ -37,11 +37,13 @@ export const ReorderableListCell = memo(
37
37
  draggedIndex,
38
38
  animationDuration,
39
39
  }: ReorderableListCellProps<T>) => {
40
- const dragHandler = useCallback(() => {
41
- 'worklet';
42
-
43
- startDrag(index);
44
- }, [startDrag, index]);
40
+ const {currentIndex, draggedHeight, scale, opacity} = useContext(
41
+ ReorderableListContext,
42
+ );
43
+ const dragHandler = useCallback(
44
+ () => runOnUI(startDrag)(index),
45
+ [startDrag, index],
46
+ );
45
47
 
46
48
  const contextValue = useMemo(
47
49
  () => ({
@@ -51,22 +53,22 @@ export const ReorderableListCell = memo(
51
53
  }),
52
54
  [index, dragHandler, draggedIndex],
53
55
  );
54
- const {currentIndex, draggedHeight} = useContext(ReorderableListContext);
55
56
 
56
- const itemZIndex = useSharedValue(0);
57
- const itemPositionY = useSharedValue(0);
58
- const itemDragY = useSharedValue(0);
59
- const itemIndex = useSharedValue(index);
57
+ // Keep separate animated reactions that update itemTranslateY
58
+ // otherwise animations might stutter if multiple are triggered
59
+ // (even in other cells, e.g. released item and reordering cells)
60
+ const itemTranslateY = useSharedValue(0);
61
+ const isActive = useDerivedValue(() => draggedIndex.value === index);
60
62
 
61
63
  useAnimatedReaction(
62
64
  () => dragY.value,
63
65
  () => {
64
66
  if (
65
- itemIndex.value === draggedIndex.value &&
67
+ index === draggedIndex.value &&
66
68
  currentIndex.value >= 0 &&
67
69
  draggedIndex.value >= 0
68
70
  ) {
69
- itemDragY.value = dragY.value;
71
+ itemTranslateY.value = dragY.value;
70
72
  }
71
73
  },
72
74
  );
@@ -75,7 +77,7 @@ export const ReorderableListCell = memo(
75
77
  () => currentIndex.value,
76
78
  () => {
77
79
  if (
78
- itemIndex.value !== draggedIndex.value &&
80
+ index !== draggedIndex.value &&
79
81
  currentIndex.value >= 0 &&
80
82
  draggedIndex.value >= 0
81
83
  ) {
@@ -84,12 +86,12 @@ export const ReorderableListCell = memo(
84
86
  const endMove = Math.max(draggedIndex.value, currentIndex.value);
85
87
  let newValue = 0;
86
88
 
87
- if (itemIndex.value >= startMove && itemIndex.value <= endMove) {
89
+ if (index >= startMove && index <= endMove) {
88
90
  newValue = moveDown ? -draggedHeight.value : draggedHeight.value;
89
91
  }
90
92
 
91
- if (newValue !== itemPositionY.value) {
92
- itemPositionY.value = withTiming(newValue, {
93
+ if (newValue !== itemTranslateY.value) {
94
+ itemTranslateY.value = withTiming(newValue, {
93
95
  duration: animationDuration.value,
94
96
  easing: Easing.out(Easing.ease),
95
97
  });
@@ -98,20 +100,22 @@ export const ReorderableListCell = memo(
98
100
  },
99
101
  );
100
102
 
101
- useAnimatedReaction(
102
- () => draggedIndex.value === index,
103
- newValue => {
104
- itemZIndex.value = newValue ? 999 : 0;
105
- },
106
- );
107
-
108
- const animatedStyle = useAnimatedStyle(() => ({
109
- zIndex: itemZIndex.value,
110
- transform: [
111
- {translateY: itemDragY.value},
112
- {translateY: itemPositionY.value},
113
- ],
114
- }));
103
+ const animatedStyle = useAnimatedStyle(() => {
104
+ if (isActive.value) {
105
+ return {
106
+ transform: [{translateY: itemTranslateY.value}, {scale: scale.value}],
107
+ opacity: opacity.value,
108
+ zIndex: 999,
109
+ };
110
+ }
111
+
112
+ return {
113
+ transform: [{translateY: itemTranslateY.value}],
114
+ // TODO: move to stylesheet when this is fixed
115
+ // https://github.com/software-mansion/react-native-reanimated/issues/6681#issuecomment-2514228447
116
+ zIndex: 0,
117
+ };
118
+ });
115
119
 
116
120
  const handleLayout = (e: LayoutChangeEvent) => {
117
121
  runOnUI((y: number, height: number) => {
@@ -12,9 +12,12 @@ import {
12
12
  GestureDetector,
13
13
  NativeGesture,
14
14
  } from 'react-native-gesture-handler';
15
- import Animated, {SharedValue} from 'react-native-reanimated';
15
+ import Animated, {
16
+ SharedValue,
17
+ useComposedEventHandler,
18
+ } from 'react-native-reanimated';
16
19
 
17
- import {AUTOSCROLL_CONFIG} from './constants';
20
+ import {AUTOSCROLL_CONFIG} from './autoscrollConfig';
18
21
  import {useReorderableListCore} from './useReorderableListCore';
19
22
  import {ReorderableListContext} from '../../contexts';
20
23
  import type {ReorderableListProps} from '../../types';
@@ -49,6 +52,7 @@ const ReorderableListCore = <T,>(
49
52
  onLayout,
50
53
  onReorder,
51
54
  onScroll,
55
+ onDragStart,
52
56
  onDragEnd,
53
57
  keyExtractor,
54
58
  extraData,
@@ -60,6 +64,7 @@ const ReorderableListCore = <T,>(
60
64
  initialScrollViewScrollEnabled,
61
65
  scrollable,
62
66
  outerScrollGesture,
67
+ cellAnimations,
63
68
  ...rest
64
69
  }: ReorderableListCoreProps<T>,
65
70
  ref: React.ForwardedRef<FlatList<T>>,
@@ -85,7 +90,7 @@ const ReorderableListCore = <T,>(
85
90
  dragReorderThreshold,
86
91
  onLayout,
87
92
  onReorder,
88
- onScroll,
93
+ onDragStart,
89
94
  onDragEnd,
90
95
  scrollViewContainerRef,
91
96
  scrollViewHeightY,
@@ -100,6 +105,7 @@ const ReorderableListCore = <T,>(
100
105
  ? true
101
106
  : initialScrollViewScrollEnabled,
102
107
  nestedScrollable: scrollable,
108
+ cellAnimations,
103
109
  });
104
110
 
105
111
  const combinedGesture = useMemo(() => {
@@ -111,6 +117,11 @@ const ReorderableListCore = <T,>(
111
117
  return gestureHandler;
112
118
  }, [scrollable, outerScrollGesture, gestureHandler]);
113
119
 
120
+ const composedScrollHandler = useComposedEventHandler([
121
+ handleScroll,
122
+ onScroll || null,
123
+ ]);
124
+
114
125
  const renderAnimatedCell = useCallback(
115
126
  ({cellKey, ...props}: CellRendererProps<T>) => (
116
127
  <ReorderableListCell
@@ -137,7 +148,7 @@ const ReorderableListCore = <T,>(
137
148
  data={data}
138
149
  CellRendererComponent={renderAnimatedCell}
139
150
  onLayout={handleFlatListLayout}
140
- onScroll={handleScroll}
151
+ onScroll={composedScrollHandler}
141
152
  scrollEventThrottle={1}
142
153
  horizontal={false}
143
154
  removeClippedSubviews={false}
@@ -0,0 +1,35 @@
1
+ import {Easing, WithTimingConfig} from 'react-native-reanimated';
2
+
3
+ const DURATION_START = 150;
4
+ const DURATION_END = 200;
5
+
6
+ interface AnimationConfig {
7
+ start: WithTimingConfig & {toValue: number};
8
+ end: WithTimingConfig & {toValue: number};
9
+ }
10
+
11
+ export const SCALE_ANIMATION_CONFIG_DEFAULT: AnimationConfig = {
12
+ start: {
13
+ toValue: 1.025,
14
+ easing: Easing.in(Easing.ease),
15
+ duration: DURATION_START,
16
+ },
17
+ end: {
18
+ toValue: 1,
19
+ easing: Easing.out(Easing.ease),
20
+ duration: DURATION_END,
21
+ },
22
+ };
23
+
24
+ export const OPACITY_ANIMATION_CONFIG_DEFAULT: AnimationConfig = {
25
+ start: {
26
+ toValue: 0.75,
27
+ easing: Easing.in(Easing.ease),
28
+ duration: DURATION_START,
29
+ },
30
+ end: {
31
+ toValue: 1,
32
+ easing: Easing.out(Easing.ease),
33
+ duration: DURATION_END,
34
+ },
35
+ };