react-native-reorderable-list 0.4.0 → 0.5.1

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 +91 -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 +313 -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 +25 -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 +83 -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 +304 -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 +18 -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 +15 -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 -36
  130. package/src/components/ReorderableList/ReorderableList.tsx +117 -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 +489 -0
  135. package/src/components/ReorderableListCell.tsx +138 -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 +21 -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,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ReorderableCellContext = require("./ReorderableCellContext");
7
+ Object.keys(_ReorderableCellContext).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ReorderableCellContext[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ReorderableCellContext[key];
14
+ }
15
+ });
16
+ });
17
+ var _ReorderableListContext = require("./ReorderableListContext");
18
+ Object.keys(_ReorderableListContext).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _ReorderableListContext[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _ReorderableListContext[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ReorderableCellContext","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ReorderableListContext"],"sourceRoot":"../../../src","sources":["contexts/index.ts"],"mappings":";;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,uBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,uBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,uBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,uBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,uBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,uBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,uBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useReorderableDrag = require("./useReorderableDrag");
7
+ Object.keys(_useReorderableDrag).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useReorderableDrag[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useReorderableDrag[key];
14
+ }
15
+ });
16
+ });
17
+ var _useReorderableDragStart = require("./useReorderableDragStart");
18
+ Object.keys(_useReorderableDragStart).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _useReorderableDragStart[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _useReorderableDragStart[key];
25
+ }
26
+ });
27
+ });
28
+ var _useReorderableDragEnd = require("./useReorderableDragEnd");
29
+ Object.keys(_useReorderableDragEnd).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _useReorderableDragEnd[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _useReorderableDragEnd[key];
36
+ }
37
+ });
38
+ });
39
+ var _useContext = require("./useContext");
40
+ Object.keys(_useContext).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _useContext[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _useContext[key];
47
+ }
48
+ });
49
+ });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useReorderableDrag","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useReorderableDragStart","_useReorderableDragEnd","_useContext"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH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reList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useContext = void 0;
7
+ var _react = require("react");
8
+ const useContext = context => {
9
+ const value = (0, _react.useContext)(context);
10
+ if (value !== undefined) {
11
+ return value;
12
+ }
13
+ throw 'Please consume ReorderableList context within its provider.';
14
+ };
15
+ exports.useContext = useContext;
16
+ //# sourceMappingURL=useContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","useContext","context","value","useReactContext","undefined","exports"],"sourceRoot":"../../../src","sources":["hooks/useContext.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAOC,OAAqC,IAAK;EACtE,MAAMC,KAAK,GAAG,IAAAC,iBAAe,EAACF,OAAO,CAAC;EAEtC,IAAIC,KAAK,KAAKE,SAAS,EAAE;IACvB,OAAOF,KAAK;EACd;EAEA,MAAM,6DAA6D;AACrE,CAAC;AAACG,OAAA,CAAAL,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useReorderableDrag = void 0;
7
+ var _useContext = require("./useContext");
8
+ var _contexts = require("../contexts");
9
+ const useReorderableDrag = () => {
10
+ const {
11
+ dragHandler
12
+ } = (0, _useContext.useContext)(_contexts.ReorderableCellContext);
13
+ return dragHandler;
14
+ };
15
+ exports.useReorderableDrag = useReorderableDrag;
16
+ //# sourceMappingURL=useReorderableDrag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useContext","require","_contexts","useReorderableDrag","dragHandler","useContext","ReorderableCellContext","exports"],"sourceRoot":"../../../src","sources":["hooks/useReorderableDrag.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAM;IAACC;EAAW,CAAC,GAAG,IAAAC,sBAAU,EAACC,gCAAsB,CAAC;EACxD,OAAOF,WAAW;AACpB,CAAC;AAACG,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useReorderableDragEnd = void 0;
7
+ var _reactNativeReanimated = require("react-native-reanimated");
8
+ var _useContext = require("./useContext");
9
+ var _contexts = require("../contexts");
10
+ const useReorderableDragEnd = onEnd => {
11
+ const {
12
+ currentIndex
13
+ } = (0, _useContext.useContext)(_contexts.ReorderableListContext);
14
+ const {
15
+ releasedIndex,
16
+ index
17
+ } = (0, _useContext.useContext)(_contexts.ReorderableCellContext);
18
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => releasedIndex.value === index, newValue => {
19
+ if (newValue) {
20
+ onEnd(index, currentIndex.value);
21
+ }
22
+ }, [onEnd]);
23
+ };
24
+ exports.useReorderableDragEnd = useReorderableDragEnd;
25
+ //# sourceMappingURL=useReorderableDragEnd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNativeReanimated","require","_useContext","_contexts","useReorderableDragEnd","onEnd","currentIndex","useContext","ReorderableListContext","releasedIndex","index","ReorderableCellContext","useAnimatedReaction","value","newValue","exports"],"sourceRoot":"../../../src","sources":["hooks/useReorderableDragEnd.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEO,MAAMG,qBAAqB,GAChCC,KAAyC,IACtC;EACH,MAAM;IAACC;EAAY,CAAC,GAAG,IAAAC,sBAAU,EAACC,gCAAsB,CAAC;EACzD,MAAM;IAACC,aAAa;IAAEC;EAAK,CAAC,GAAG,IAAAH,sBAAU,EAACI,gCAAsB,CAAC;EAEjE,IAAAC,0CAAmB,EACjB,MAAMH,aAAa,CAACI,KAAK,KAAKH,KAAK,EACnCI,QAAQ,IAAI;IACV,IAAIA,QAAQ,EAAE;MACZT,KAAK,CAACK,KAAK,EAAEJ,YAAY,CAACO,KAAK,CAAC;IAClC;EACF,CAAC,EACD,CAACR,KAAK,CACR,CAAC;AACH,CAAC;AAACU,OAAA,CAAAX,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useReorderableDragStart = void 0;
7
+ var _reactNativeReanimated = require("react-native-reanimated");
8
+ var _useContext = require("./useContext");
9
+ var _contexts = require("../contexts");
10
+ const useReorderableDragStart = onStart => {
11
+ const {
12
+ draggedIndex,
13
+ index
14
+ } = (0, _useContext.useContext)(_contexts.ReorderableCellContext);
15
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => draggedIndex.value === index, newValue => {
16
+ if (newValue && onStart) {
17
+ onStart(index);
18
+ }
19
+ }, [onStart]);
20
+ };
21
+ exports.useReorderableDragStart = useReorderableDragStart;
22
+ //# sourceMappingURL=useReorderableDragStart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNativeReanimated","require","_useContext","_contexts","useReorderableDragStart","onStart","draggedIndex","index","useContext","ReorderableCellContext","useAnimatedReaction","value","newValue","exports"],"sourceRoot":"../../../src","sources":["hooks/useReorderableDragStart.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,OAAgC,IAAK;EAC3E,MAAM;IAACC,YAAY;IAAEC;EAAK,CAAC,GAAG,IAAAC,sBAAU,EAACC,gCAAsB,CAAC;EAEhE,IAAAC,0CAAmB,EACjB,MAAMJ,YAAY,CAACK,KAAK,KAAKJ,KAAK,EAClCK,QAAQ,IAAI;IACV,IAAIA,QAAQ,IAAIP,OAAO,EAAE;MACvBA,OAAO,CAACE,KAAK,CAAC;IAChB;EACF,CAAC,EACD,CAACF,OAAO,CACV,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAT,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ReorderableListItem", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _components.ReorderableListItem;
10
+ }
11
+ });
12
+ exports.default = void 0;
13
+ Object.defineProperty(exports, "reorderItems", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _utils.reorderItems;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "useReorderableDrag", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _hooks.useReorderableDrag;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "useReorderableDragEnd", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _hooks.useReorderableDragEnd;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "useReorderableDragStart", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _hooks.useReorderableDragStart;
35
+ }
36
+ });
37
+ var _components = require("./components");
38
+ var _hooks = require("./hooks");
39
+ var _utils = require("./utils");
40
+ var _default = exports.default = _components.ReorderableList;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_hooks","_utils","_default","exports","default","ReorderableList"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAWA,IAAAE,MAAA,GAAAF,OAAA;AAAqC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAatBC,2BAAe","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _props = require("./props");
7
+ Object.keys(_props).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _props[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _props[key];
14
+ }
15
+ });
16
+ });
17
+ var _misc = require("./misc");
18
+ Object.keys(_misc).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _misc[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _misc[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_props","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_misc"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReorderableListState = void 0;
7
+ let ReorderableListState = exports.ReorderableListState = /*#__PURE__*/function (ReorderableListState) {
8
+ ReorderableListState[ReorderableListState["IDLE"] = 0] = "IDLE";
9
+ ReorderableListState[ReorderableListState["DRAGGING"] = 1] = "DRAGGING";
10
+ ReorderableListState[ReorderableListState["RELEASING"] = 2] = "RELEASING";
11
+ ReorderableListState[ReorderableListState["AUTO_SCROLL"] = 3] = "AUTO_SCROLL";
12
+ return ReorderableListState;
13
+ }({});
14
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReorderableListState","exports"],"sourceRoot":"../../../src","sources":["types/misc.ts"],"mappings":";;;;;;IAAYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,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,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/props.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.reorderItems = void 0;
7
+ /**
8
+ * Moves an item in an array to a new index.
9
+ *
10
+ * @template T - The type of elements in the array.
11
+ * @param data - The array of items.
12
+ * @param from - The index of the item to move.
13
+ * @param to - The index to move the item to.
14
+ *
15
+ * @returns A new array with the two items swapped.
16
+ */
17
+ const reorderItems = (data, from, to) => {
18
+ const newData = [...data];
19
+ newData.splice(to, 0, newData.splice(from, 1)[0]);
20
+ return newData;
21
+ };
22
+ exports.reorderItems = reorderItems;
23
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reorderItems","data","from","to","newData","splice","exports"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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;AAACE,OAAA,CAAAN,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ 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); }
2
+ import React, { useCallback } from 'react';
3
+ import { FlatList } from 'react-native';
4
+ import { GestureDetector } from 'react-native-gesture-handler';
5
+ import Animated from 'react-native-reanimated';
6
+ import { AUTOSCROLL_DELAY } from './constants';
7
+ import { useReorderableList } from './useReorderableList';
8
+ import { ReorderableListContext } from '../../contexts';
9
+ import { ReorderableListCell } from '../ReorderableListCell';
10
+ const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
11
+ const ReorderableList = ({
12
+ data,
13
+ autoscrollThreshold = 0.1,
14
+ autoscrollSpeedScale = 1,
15
+ autoscrollDelay = AUTOSCROLL_DELAY,
16
+ animationDuration = 200,
17
+ dragReorderThreshold = 0.2,
18
+ onLayout,
19
+ onReorder,
20
+ onScroll,
21
+ keyExtractor,
22
+ extraData,
23
+ ...rest
24
+ }, ref) => {
25
+ const {
26
+ gestureHandler,
27
+ handleScroll,
28
+ handleFlatListLayout,
29
+ handleRef,
30
+ startDrag,
31
+ listContextValue,
32
+ itemOffset,
33
+ itemHeight,
34
+ dragY,
35
+ draggedIndex,
36
+ releasedIndex,
37
+ duration
38
+ } = useReorderableList({
39
+ ref,
40
+ autoscrollThreshold,
41
+ autoscrollSpeedScale,
42
+ autoscrollDelay,
43
+ animationDuration,
44
+ dragReorderThreshold,
45
+ onLayout,
46
+ onReorder,
47
+ onScroll
48
+ });
49
+ const renderAnimatedCell = useCallback(({
50
+ cellKey,
51
+ ...props
52
+ }) => /*#__PURE__*/React.createElement(ReorderableListCell, _extends({}, props, {
53
+ // forces remount with key change on reorder
54
+ key: `${cellKey}+${props.index}`,
55
+ itemOffset: itemOffset,
56
+ itemHeight: itemHeight,
57
+ dragY: dragY,
58
+ draggedIndex: draggedIndex,
59
+ releasedIndex: releasedIndex,
60
+ animationDuration: duration,
61
+ startDrag: startDrag
62
+ })), [itemOffset, itemHeight, dragY, draggedIndex, releasedIndex, duration, startDrag]);
63
+ return /*#__PURE__*/React.createElement(ReorderableListContext.Provider, {
64
+ value: listContextValue
65
+ }, /*#__PURE__*/React.createElement(GestureDetector, {
66
+ gesture: gestureHandler
67
+ }, /*#__PURE__*/React.createElement(AnimatedFlatList, _extends({}, rest, {
68
+ ref: handleRef,
69
+ data: data,
70
+ CellRendererComponent: renderAnimatedCell,
71
+ onLayout: handleFlatListLayout,
72
+ onScroll: handleScroll,
73
+ scrollEventThrottle: 1,
74
+ horizontal: false,
75
+ removeClippedSubviews: false,
76
+ keyExtractor: keyExtractor,
77
+ extraData: extraData,
78
+ numColumns: 1
79
+ }))));
80
+ };
81
+ const MemoizedReorderableList = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(ReorderableList));
82
+ export { MemoizedReorderableList as ReorderableList };
83
+ //# sourceMappingURL=ReorderableList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","FlatList","GestureDetector","Animated","AUTOSCROLL_DELAY","useReorderableList","ReorderableListContext","ReorderableListCell","AnimatedFlatList","createAnimatedComponent","ReorderableList","data","autoscrollThreshold","autoscrollSpeedScale","autoscrollDelay","animationDuration","dragReorderThreshold","onLayout","onReorder","onScroll","keyExtractor","extraData","rest","ref","gestureHandler","handleScroll","handleFlatListLayout","handleRef","startDrag","listContextValue","itemOffset","itemHeight","dragY","draggedIndex","releasedIndex","duration","renderAnimatedCell","cellKey","props","createElement","_extends","key","index","Provider","value","gesture","CellRendererComponent","scrollEventThrottle","horizontal","removeClippedSubviews","numColumns","MemoizedReorderableList","memo","forwardRef"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/ReorderableList.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,WAAW,QAAO,OAAO;AACxC,SAA2BC,QAAQ,QAAsB,cAAc;AAEvE,SAAQC,eAAe,QAAO,8BAA8B;AAC5D,OAAOC,QAAQ,MAAM,yBAAyB;AAE9C,SAAQC,gBAAgB,QAAO,aAAa;AAC5C,SAAQC,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,sBAAsB,QAAO,gBAAgB;AAErD,SAAQC,mBAAmB,QAAO,wBAAwB;AAE1D,MAAMC,gBAAgB,GAAGL,QAAQ,CAACM,uBAAuB,CACvDR,QACF,CAEuB;AAEvB,MAAMS,eAAe,GAAGA,CACtB;EACEC,IAAI;EACJC,mBAAmB,GAAG,GAAG;EACzBC,oBAAoB,GAAG,CAAC;EACxBC,eAAe,GAAGV,gBAAgB;EAClCW,iBAAiB,GAAG,GAAG;EACvBC,oBAAoB,GAAG,GAAG;EAC1BC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,YAAY;EACZC,SAAS;EACT,GAAGC;AACoB,CAAC,EAC1BC,GAAoC,KACj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EAAEM,YAAa;IACvBsB,mBAAmB,EAAE,CAAE;IACvBC,UAAU,EAAE,KAAM;IAClBC,qBAAqB,EAAE,KAAM;IAC7B7B,YAAY,EAAEA,YAAa;IAC3BC,SAAS,EAAEA,SAAU;IACrB6B,UAAU,EAAE;EAAE,EACf,CACc,CACc,CAAC;AAEtC,CAAC;AAED,MAAMC,uBAAuB,gBAAGpD,KAAK,CAACqD,IAAI,cACxCrD,KAAK,CAACsD,UAAU,CAAC3C,eAAe,CAClC,CAIuB;AAEvB,SAAQyC,uBAAuB,IAAIzC,eAAe","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ // iOS specific constants
2
+ export const AUTOSCROLL_INCREMENT = 80;
3
+ export const AUTOSCROLL_DELAY = 100;
4
+ //# sourceMappingURL=constants.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AUTOSCROLL_INCREMENT","AUTOSCROLL_DELAY"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/constants.ios.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,GAAG,EAAE;AACtC,OAAO,MAAMC,gBAAgB,GAAG,GAAG","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ // Default constants
2
+ export const AUTOSCROLL_INCREMENT = 5;
3
+ export const AUTOSCROLL_DELAY = 0;
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AUTOSCROLL_INCREMENT","AUTOSCROLL_DELAY"],"sourceRoot":"../../../../src","sources":["components/ReorderableList/constants.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,GAAG,CAAC;AACrC,OAAO,MAAMC,gBAAgB,GAAG,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from './ReorderableList';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/ReorderableList/index.ts"],"mappings":"AAAA,cAAc,mBAAmB","ignoreList":[]}