react-native-reorderable-list 0.4.0 → 0.5.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 (162) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +118 -60
  3. package/lib/commonjs/components/ReorderableList/ReorderableList.js +99 -0
  4. package/lib/commonjs/components/ReorderableList/ReorderableList.js.map +1 -0
  5. package/lib/commonjs/components/ReorderableList/constants.ios.js +10 -0
  6. package/lib/commonjs/components/ReorderableList/constants.ios.js.map +1 -0
  7. package/lib/commonjs/components/ReorderableList/constants.js +10 -0
  8. package/lib/commonjs/components/ReorderableList/constants.js.map +1 -0
  9. package/lib/commonjs/components/ReorderableList/index.js +17 -0
  10. package/lib/commonjs/components/ReorderableList/index.js.map +1 -0
  11. package/lib/commonjs/components/ReorderableList/useReorderableList.js +311 -0
  12. package/lib/commonjs/components/ReorderableList/useReorderableList.js.map +1 -0
  13. package/lib/commonjs/components/ReorderableListCell.js +93 -0
  14. package/lib/commonjs/components/ReorderableListCell.js.map +1 -0
  15. package/lib/commonjs/components/ReorderableListItem.js +87 -0
  16. package/lib/commonjs/components/ReorderableListItem.js.map +1 -0
  17. package/lib/commonjs/components/index.js +39 -0
  18. package/lib/commonjs/components/index.js.map +1 -0
  19. package/lib/commonjs/contexts/ReorderableCellContext.js +10 -0
  20. package/lib/commonjs/contexts/ReorderableCellContext.js.map +1 -0
  21. package/lib/commonjs/contexts/ReorderableListContext.js +10 -0
  22. package/lib/commonjs/contexts/ReorderableListContext.js.map +1 -0
  23. package/lib/commonjs/contexts/index.js +28 -0
  24. package/lib/commonjs/contexts/index.js.map +1 -0
  25. package/lib/commonjs/hooks/index.js +50 -0
  26. package/lib/commonjs/hooks/index.js.map +1 -0
  27. package/lib/commonjs/hooks/useContext.js +16 -0
  28. package/lib/commonjs/hooks/useContext.js.map +1 -0
  29. package/lib/commonjs/hooks/useReorderableDrag.js +16 -0
  30. package/lib/commonjs/hooks/useReorderableDrag.js.map +1 -0
  31. package/lib/commonjs/hooks/useReorderableDragEnd.js +28 -0
  32. package/lib/commonjs/hooks/useReorderableDragEnd.js.map +1 -0
  33. package/lib/commonjs/hooks/useReorderableDragStart.js +22 -0
  34. package/lib/commonjs/hooks/useReorderableDragStart.js.map +1 -0
  35. package/lib/commonjs/index.js +41 -0
  36. package/lib/commonjs/index.js.map +1 -0
  37. package/lib/commonjs/types/index.js +28 -0
  38. package/lib/commonjs/types/index.js.map +1 -0
  39. package/lib/commonjs/types/misc.js +14 -0
  40. package/lib/commonjs/types/misc.js.map +1 -0
  41. package/lib/commonjs/types/props.js +6 -0
  42. package/lib/commonjs/types/props.js.map +1 -0
  43. package/lib/commonjs/utils.js +23 -0
  44. package/lib/commonjs/utils.js.map +1 -0
  45. package/lib/module/components/ReorderableList/ReorderableList.js +91 -0
  46. package/lib/module/components/ReorderableList/ReorderableList.js.map +1 -0
  47. package/lib/module/components/ReorderableList/constants.ios.js +4 -0
  48. package/lib/module/components/ReorderableList/constants.ios.js.map +1 -0
  49. package/lib/module/components/ReorderableList/constants.js +4 -0
  50. package/lib/module/components/ReorderableList/constants.js.map +1 -0
  51. package/lib/module/components/ReorderableList/index.js +2 -0
  52. package/lib/module/components/ReorderableList/index.js.map +1 -0
  53. package/lib/module/components/ReorderableList/useReorderableList.js +302 -0
  54. package/lib/module/components/ReorderableList/useReorderableList.js.map +1 -0
  55. package/lib/module/components/ReorderableListCell.js +85 -0
  56. package/lib/module/components/ReorderableListCell.js.map +1 -0
  57. package/lib/module/components/ReorderableListItem.js +78 -0
  58. package/lib/module/components/ReorderableListItem.js.map +1 -0
  59. package/lib/module/components/index.js +4 -0
  60. package/lib/module/components/index.js.map +1 -0
  61. package/lib/module/contexts/ReorderableCellContext.js +3 -0
  62. package/lib/module/contexts/ReorderableCellContext.js.map +1 -0
  63. package/lib/module/contexts/ReorderableListContext.js +3 -0
  64. package/lib/module/contexts/ReorderableListContext.js.map +1 -0
  65. package/lib/module/contexts/index.js +3 -0
  66. package/lib/module/contexts/index.js.map +1 -0
  67. package/lib/module/hooks/index.js +5 -0
  68. package/lib/module/hooks/index.js.map +1 -0
  69. package/lib/module/hooks/useContext.js +9 -0
  70. package/lib/module/hooks/useContext.js.map +1 -0
  71. package/lib/module/hooks/useReorderableDrag.js +9 -0
  72. package/lib/module/hooks/useReorderableDrag.js.map +1 -0
  73. package/lib/module/hooks/useReorderableDragEnd.js +21 -0
  74. package/lib/module/hooks/useReorderableDragEnd.js.map +1 -0
  75. package/lib/module/hooks/useReorderableDragStart.js +15 -0
  76. package/lib/module/hooks/useReorderableDragStart.js.map +1 -0
  77. package/lib/module/index.js +6 -0
  78. package/lib/module/index.js.map +1 -0
  79. package/lib/module/types/index.js +3 -0
  80. package/lib/module/types/index.js.map +1 -0
  81. package/lib/module/types/misc.js +8 -0
  82. package/lib/module/types/misc.js.map +1 -0
  83. package/lib/module/types/props.js +2 -0
  84. package/lib/module/types/props.js.map +1 -0
  85. package/lib/module/utils.js +16 -0
  86. package/lib/module/utils.js.map +1 -0
  87. package/lib/typescript/components/ReorderableList/ReorderableList.d.ts +8 -0
  88. package/lib/typescript/components/ReorderableList/ReorderableList.d.ts.map +1 -0
  89. package/lib/typescript/components/ReorderableList/constants.d.ts +3 -0
  90. package/lib/typescript/components/ReorderableList/constants.d.ts.map +1 -0
  91. package/lib/typescript/components/ReorderableList/constants.ios.d.ts +3 -0
  92. package/lib/typescript/components/ReorderableList/constants.ios.d.ts.map +1 -0
  93. package/lib/typescript/components/ReorderableList/index.d.ts +2 -0
  94. package/lib/typescript/components/ReorderableList/index.d.ts.map +1 -0
  95. package/lib/typescript/components/ReorderableList/useReorderableList.d.ts +34 -0
  96. package/lib/typescript/components/ReorderableList/useReorderableList.d.ts.map +1 -0
  97. package/lib/typescript/components/ReorderableListCell.d.ts +20 -0
  98. package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -0
  99. package/lib/typescript/components/ReorderableListItem.d.ts +4 -0
  100. package/lib/typescript/components/ReorderableListItem.d.ts.map +1 -0
  101. package/lib/typescript/components/index.d.ts +4 -0
  102. package/lib/typescript/components/index.d.ts.map +1 -0
  103. package/lib/typescript/contexts/ReorderableCellContext.d.ts +11 -0
  104. package/lib/typescript/contexts/ReorderableCellContext.d.ts.map +1 -0
  105. package/lib/typescript/contexts/ReorderableListContext.d.ts +9 -0
  106. package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -0
  107. package/lib/typescript/contexts/index.d.ts +3 -0
  108. package/lib/typescript/contexts/index.d.ts.map +1 -0
  109. package/lib/typescript/hooks/index.d.ts +5 -0
  110. package/lib/typescript/hooks/index.d.ts.map +1 -0
  111. package/lib/typescript/hooks/useContext.d.ts +3 -0
  112. package/lib/typescript/hooks/useContext.d.ts.map +1 -0
  113. package/lib/typescript/hooks/useReorderableDrag.d.ts +2 -0
  114. package/lib/typescript/hooks/useReorderableDrag.d.ts.map +1 -0
  115. package/lib/typescript/hooks/useReorderableDragEnd.d.ts +2 -0
  116. package/lib/typescript/hooks/useReorderableDragEnd.d.ts.map +1 -0
  117. package/lib/typescript/hooks/useReorderableDragStart.d.ts +2 -0
  118. package/lib/typescript/hooks/useReorderableDragStart.d.ts.map +1 -0
  119. package/lib/typescript/index.d.ts +7 -0
  120. package/lib/typescript/index.d.ts.map +1 -0
  121. package/lib/typescript/types/index.d.ts +3 -0
  122. package/lib/typescript/types/index.d.ts.map +1 -0
  123. package/lib/typescript/types/misc.d.ts +7 -0
  124. package/lib/typescript/types/misc.d.ts.map +1 -0
  125. package/lib/typescript/types/props.d.ts +90 -0
  126. package/lib/typescript/types/props.d.ts.map +1 -0
  127. package/lib/typescript/utils.d.ts +12 -0
  128. package/lib/typescript/utils.d.ts.map +1 -0
  129. package/package.json +199 -39
  130. package/src/components/ReorderableList/ReorderableList.tsx +123 -0
  131. package/src/components/ReorderableList/constants.ios.ts +3 -0
  132. package/src/components/ReorderableList/constants.ts +3 -0
  133. package/src/components/ReorderableList/index.ts +1 -0
  134. package/src/components/ReorderableList/useReorderableList.ts +487 -0
  135. package/src/components/ReorderableListCell.tsx +143 -0
  136. package/src/components/ReorderableListItem.tsx +108 -0
  137. package/src/components/index.ts +3 -0
  138. package/src/contexts/ReorderableCellContext.ts +14 -0
  139. package/src/contexts/ReorderableListContext.ts +12 -0
  140. package/src/contexts/index.ts +2 -0
  141. package/src/hooks/index.ts +4 -0
  142. package/src/hooks/useContext.ts +11 -0
  143. package/src/hooks/useReorderableDrag.ts +7 -0
  144. package/src/hooks/useReorderableDragEnd.ts +25 -0
  145. package/src/hooks/useReorderableDragStart.ts +18 -0
  146. package/src/index.ts +26 -0
  147. package/src/types/index.ts +2 -0
  148. package/src/types/misc.ts +6 -0
  149. package/src/types/props.ts +101 -0
  150. package/src/utils.ts +15 -0
  151. package/dist/components/ReorderableList.d.ts +0 -7
  152. package/dist/components/ReorderableList.js +0 -314
  153. package/dist/components/ReorderableListItem.d.ts +0 -14
  154. package/dist/components/ReorderableListItem.js +0 -57
  155. package/dist/hooks/useAnimatedSharedValues.d.ts +0 -3
  156. package/dist/hooks/useAnimatedSharedValues.js +0 -33
  157. package/dist/index.d.ts +0 -4
  158. package/dist/index.js +0 -2
  159. package/dist/types/misc.d.ts +0 -15
  160. package/dist/types/misc.js +0 -7
  161. package/dist/types/props.d.ts +0 -29
  162. package/dist/types/props.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReorderableList","ReorderableListItem","useReorderableDrag","useReorderableDragEnd","useReorderableDragStart","reorderItems"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAAQA,eAAe,EAAEC,mBAAmB,QAAO,cAAc;AACjE,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,uBAAuB,QAClB,SAAS;AAOhB,SAAQC,YAAY,QAAO,SAAS;AAEpC,SACEH,kBAAkB,EAClBE,uBAAuB,EACvBD,qBAAqB,EAGrBF,mBAAmB,EAGnBI,YAAY;AAEd,eAAeL,eAAe","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export * from './props';
2
+ export * from './misc';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,QAAQ","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ export let ReorderableListState = /*#__PURE__*/function (ReorderableListState) {
2
+ ReorderableListState[ReorderableListState["IDLE"] = 0] = "IDLE";
3
+ ReorderableListState[ReorderableListState["DRAGGING"] = 1] = "DRAGGING";
4
+ ReorderableListState[ReorderableListState["RELEASING"] = 2] = "RELEASING";
5
+ ReorderableListState[ReorderableListState["AUTO_SCROLL"] = 3] = "AUTO_SCROLL";
6
+ return ReorderableListState;
7
+ }({});
8
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReorderableListState"],"sourceRoot":"../../../src","sources":["types/misc.ts"],"mappings":"AAAA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/props.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Moves an item in an array to a new index.
3
+ *
4
+ * @template T - The type of elements in the array.
5
+ * @param data - The array of items.
6
+ * @param from - The index of the item to move.
7
+ * @param to - The index to move the item to.
8
+ *
9
+ * @returns A new array with the two items swapped.
10
+ */
11
+ export const reorderItems = (data, from, to) => {
12
+ const newData = [...data];
13
+ newData.splice(to, 0, newData.splice(from, 1)[0]);
14
+ return newData;
15
+ };
16
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reorderItems","data","from","to","newData","splice"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAGA,CAAIC,IAAS,EAAEC,IAAY,EAAEC,EAAU,KAAU;EAC3E,MAAMC,OAAO,GAAG,CAAC,GAAGH,IAAI,CAAC;EACzBG,OAAO,CAACC,MAAM,CAACF,EAAE,EAAE,CAAC,EAAEC,OAAO,CAACC,MAAM,CAACH,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACjD,OAAOE,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { FlatListProps } from 'react-native';
3
+ import type { ReorderableListProps } from '../../types';
4
+ declare const MemoizedReorderableList: <T>(props: ReorderableListProps<T> & {
5
+ ref?: React.ForwardedRef<FlatListProps<T>> | undefined;
6
+ }) => React.ReactElement;
7
+ export { MemoizedReorderableList as ReorderableList };
8
+ //# sourceMappingURL=ReorderableList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReorderableList.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableList/ReorderableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAA8B,aAAa,EAAC,MAAM,cAAc,CAAC;AAQxE,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAyGtD,QAAA,MAAM,uBAAuB;;MAMxB,MAAM,YAAY,CAAC;AAExB,OAAO,EAAC,uBAAuB,IAAI,eAAe,EAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const AUTOSCROLL_INCREMENT = 5;
2
+ export declare const AUTOSCROLL_DELAY = 0;
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableList/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,gBAAgB,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const AUTOSCROLL_INCREMENT = 80;
2
+ export declare const AUTOSCROLL_DELAY = 100;
3
+ //# sourceMappingURL=constants.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.ios.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableList/constants.ios.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,gBAAgB,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './ReorderableList';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableList/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { FlatList, LayoutChangeEvent, NativeScrollEvent } from 'react-native';
3
+ import type { ReorderableListReorderEvent } from '../../types';
4
+ interface UseReorderableListArgs<T> {
5
+ ref: React.ForwardedRef<FlatList<T>>;
6
+ autoscrollThreshold: number;
7
+ autoscrollSpeedScale: number;
8
+ autoscrollDelay: number;
9
+ animationDuration: number;
10
+ dragReorderThreshold: number;
11
+ onReorder: (event: ReorderableListReorderEvent) => void;
12
+ onScroll?: (event: NativeScrollEvent) => void;
13
+ onLayout?: (e: LayoutChangeEvent) => void;
14
+ }
15
+ export declare const useReorderableList: <T>({ ref, autoscrollThreshold, autoscrollSpeedScale, autoscrollDelay, animationDuration, dragReorderThreshold, onLayout, onReorder, onScroll, }: UseReorderableListArgs<T>) => {
16
+ gestureHandler: import("react-native-gesture-handler/lib/typescript/handlers/gestures/gestureComposition").SimultaneousGesture;
17
+ handleScroll: import("react-native-reanimated").ScrollHandlerProcessed<Record<string, unknown>>;
18
+ handleFlatListLayout: (e: LayoutChangeEvent) => void;
19
+ handleRef: (value: FlatList<T>) => void;
20
+ startDrag: (index: number) => void;
21
+ listContextValue: {
22
+ draggedHeight: import("react-native-reanimated").SharedValue<number>;
23
+ currentIndex: import("react-native-reanimated").SharedValue<number>;
24
+ draggedIndex: import("react-native-reanimated").SharedValue<number>;
25
+ };
26
+ itemOffset: import("react-native-reanimated").SharedValue<number[]>;
27
+ itemHeight: import("react-native-reanimated").SharedValue<number[]>;
28
+ draggedIndex: import("react-native-reanimated").SharedValue<number>;
29
+ releasedIndex: import("react-native-reanimated").SharedValue<number>;
30
+ dragY: import("react-native-reanimated").SharedValue<number>;
31
+ duration: import("react-native-reanimated").SharedValue<number>;
32
+ };
33
+ export {};
34
+ //# sourceMappingURL=useReorderableList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReorderableList.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableList/useReorderableList.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,cAAc,CAAC;AAqBtB,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAO7D,UAAU,sBAAsB,CAAC,CAAC;IAChC,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,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,kBAAkB;;;;;uBAkWnB,MAAM;;;;;;;;;;;;CAsFjB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { LayoutChangeEvent } from 'react-native';
3
+ import { SharedValue } from 'react-native-reanimated';
4
+ interface ReorderableListCellProps<T, U> {
5
+ index: number;
6
+ startDrag: (index: number) => void;
7
+ itemOffset: SharedValue<number[]>;
8
+ itemHeight: SharedValue<number[]>;
9
+ dragY: SharedValue<number>;
10
+ draggedIndex: SharedValue<number>;
11
+ releasedIndex: SharedValue<number>;
12
+ children: React.ReactNode;
13
+ onLayout?: (e: LayoutChangeEvent) => void;
14
+ animationDuration: SharedValue<number>;
15
+ item: T;
16
+ extraData: U;
17
+ }
18
+ export declare const ReorderableListCell: React.MemoExoticComponent<(<T, U>({ index, startDrag, children, onLayout, itemOffset, itemHeight, dragY, draggedIndex, releasedIndex, animationDuration, }: ReorderableListCellProps<T, U>) => React.JSX.Element)>;
19
+ export {};
20
+ //# sourceMappingURL=ReorderableListCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReorderableListCell.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableListCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAEpD,OAAiB,EAEf,WAAW,EAMZ,MAAM,yBAAyB,CAAC;AAKjC,UAAU,wBAAwB,CAAC,CAAC,EAAE,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE1C,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC;IACR,SAAS,EAAE,CAAC,CAAC;CACd;AAED,eAAO,MAAM,mBAAmB,oNA8G/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ReorderableListItemProps } from '../types';
3
+ export declare const ReorderableListItem: React.FC<ReorderableListItemProps>;
4
+ //# sourceMappingURL=ReorderableListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReorderableListItem.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAUlD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,UAAU,CAAC;AAoBvD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA6ElE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './ReorderableList';
2
+ export * from './ReorderableListCell';
3
+ export * from './ReorderableListItem';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { SharedValue } from 'react-native-reanimated';
3
+ interface ReorderableCellContextData {
4
+ index: number;
5
+ dragHandler: () => void;
6
+ draggedIndex: SharedValue<number>;
7
+ releasedIndex: SharedValue<number>;
8
+ }
9
+ export declare const ReorderableCellContext: React.Context<ReorderableCellContextData | undefined>;
10
+ export {};
11
+ //# sourceMappingURL=ReorderableCellContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReorderableCellContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ReorderableCellContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEzD,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,sBAAsB,uDAEvB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { SharedValue } from 'react-native-reanimated';
3
+ interface ReorderableListContextData {
4
+ currentIndex: SharedValue<number>;
5
+ draggedHeight: SharedValue<number>;
6
+ }
7
+ export declare const ReorderableListContext: React.Context<ReorderableListContextData | undefined>;
8
+ export {};
9
+ //# sourceMappingURL=ReorderableListContext.d.ts.map
@@ -0,0 +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;CACpC;AAED,eAAO,MAAM,sBAAsB,uDAEvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './ReorderableCellContext';
2
+ export * from './ReorderableListContext';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './useReorderableDrag';
2
+ export * from './useReorderableDragStart';
3
+ export * from './useReorderableDragEnd';
4
+ export * from './useContext';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const useContext: <T>(context: import("react").Context<T | undefined>) => T & ({} | null);
3
+ //# sourceMappingURL=useContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContext.d.ts","sourceRoot":"","sources":["../../../src/hooks/useContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,UAAU,yEAQtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const useReorderableDrag: () => () => void;
2
+ //# sourceMappingURL=useReorderableDrag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReorderableDrag.d.ts","sourceRoot":"","sources":["../../../src/hooks/useReorderableDrag.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,kBAG9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const useReorderableDragEnd: (onEnd: (from: number, to: number) => void) => void;
2
+ //# sourceMappingURL=useReorderableDragEnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReorderableDragEnd.d.ts","sourceRoot":"","sources":["../../../src/hooks/useReorderableDragEnd.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,iBAClB,MAAM,MAAM,MAAM,KAAK,IAAI,SAkB1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const useReorderableDragStart: (onStart: (index: number) => void) => void;
2
+ //# sourceMappingURL=useReorderableDragStart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReorderableDragStart.d.ts","sourceRoot":"","sources":["../../../src/hooks/useReorderableDragStart.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,oBAAqB,MAAM,KAAK,IAAI,SAYvE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ReorderableList, ReorderableListItem } from './components';
2
+ import { useReorderableDrag, useReorderableDragEnd, useReorderableDragStart } from './hooks';
3
+ import type { ReorderableListItemConfig, ReorderableListItemProps, ReorderableListProps, ReorderableListReorderEvent } from './types';
4
+ import { reorderItems } from './utils';
5
+ export { useReorderableDrag, useReorderableDragStart, useReorderableDragEnd, ReorderableListProps, ReorderableListReorderEvent, ReorderableListItem, ReorderableListItemConfig, ReorderableListItemProps, reorderItems, };
6
+ export default ReorderableList;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,YAAY,GACb,CAAC;AACF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './props';
2
+ export * from './misc';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare enum ReorderableListState {
2
+ IDLE = 0,
3
+ DRAGGING = 1,
4
+ RELEASING = 2,
5
+ AUTO_SCROLL = 3
6
+ }
7
+ //# sourceMappingURL=misc.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,90 @@
1
+ import type { FlatListProps, NativeScrollEvent, ViewProps } from 'react-native';
2
+ import { EasingFunction } from 'react-native-reanimated';
3
+ export interface ReorderableListReorderEvent {
4
+ /**
5
+ * Index of the dragged item.
6
+ */
7
+ from: number;
8
+ /**
9
+ * Index where the dragged item was released.
10
+ */
11
+ to: number;
12
+ }
13
+ type OmittedProps = 'horizontal' | 'onScroll' | 'scrollEventThrottle' | 'removeClippedSubviews' | 'CellRendererComponent' | 'numColumns';
14
+ export interface ReorderableListProps<T> extends Omit<FlatListProps<T>, OmittedProps> {
15
+ data: T[];
16
+ /**
17
+ * Threshold at the extremety of the list which triggers autoscroll when an item is dragged to it.
18
+ * A value of 0.1 means that 10% of the area at the top and 10% at the bottom of the list will trigger autoscroll
19
+ * when an item is dragged to it. Min value: `0`. Max value: `0.4`. Default: `0.1`.
20
+ */
21
+ autoscrollThreshold?: number;
22
+ /**
23
+ * Scales the autoscroll spreed at which the list scrolls when an item is dragged to the scroll areas. Default: `1`.
24
+ */
25
+ autoscrollSpeedScale?: number;
26
+ /**
27
+ * Delay in between autoscroll triggers. Can be used to tune the autoscroll smoothness.
28
+ * Default Android: `0`.
29
+ * Default iOS: `100`.
30
+ */
31
+ autoscrollDelay?: number;
32
+ /**
33
+ * Specifies the fraction of an item's size at which it will shift when a dragged item crosses over it.
34
+ * For example, a value of 0.2 means the item shifts when the dragged item passes 20% of its height (vertical list). Default is `0.2`.
35
+ */
36
+ dragReorderThreshold?: number;
37
+ /**
38
+ * Duration of the animations in milliseconds.
39
+ * Be aware that users won't be able to drag a new item until the dragged item is released and
40
+ * its animation to its new position ends.
41
+ * Default: `200`.
42
+ */
43
+ animationDuration?: number;
44
+ /**
45
+ * Event fired after an item is released and the list is reordered.
46
+ */
47
+ onReorder: (event: ReorderableListReorderEvent) => void;
48
+ /**
49
+ * 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.
50
+ */
51
+ onScroll?: (event: NativeScrollEvent) => void;
52
+ }
53
+ export interface ReorderableListItemConfig {
54
+ /**
55
+ * Value of the animated style on drag end.
56
+ */
57
+ enabled?: boolean;
58
+ /**
59
+ * Value of the animated style on drag end.
60
+ */
61
+ valueEnd?: number;
62
+ /**
63
+ * Value of the animated style on drag start.
64
+ */
65
+ valueStart?: number;
66
+ /**
67
+ * Easing function for the animation to the end value. Default: `Easing.in(Easing.ease)`.
68
+ */
69
+ easingEnd?: EasingFunction;
70
+ /**
71
+ * Easing function for the animation to the start value. Default: `Easing.out(Easing.ease)`.
72
+ */
73
+ easingStart?: EasingFunction;
74
+ /**
75
+ * Duration of the animations in milliseconds. Default: `200`.
76
+ */
77
+ duration?: number;
78
+ }
79
+ export interface ReorderableListItemProps extends ViewProps {
80
+ /**
81
+ * Config for the `opacity` animation. Enabled by default with custom default options.
82
+ */
83
+ opacityAnimationConfig?: ReorderableListItemConfig;
84
+ /**
85
+ * Config for the `scale` animation. Enabled by default with custom default options.
86
+ */
87
+ scaleAnimationConfig?: ReorderableListItemConfig;
88
+ }
89
+ export {};
90
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAE9E,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,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;CAC/C;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"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Moves an item in an array to a new index.
3
+ *
4
+ * @template T - The type of elements in the array.
5
+ * @param data - The array of items.
6
+ * @param from - The index of the item to move.
7
+ * @param to - The index to move the item to.
8
+ *
9
+ * @returns A new array with the two items swapped.
10
+ */
11
+ export declare const reorderItems: <T>(data: T[], from: number, to: number) => T[];
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,uBAAwB,MAAM,MAAM,MAAM,QAIlE,CAAC"}