react-native-reorderable-list 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +53 -47
  2. package/lib/commonjs/components/ReorderableList.js +11 -13
  3. package/lib/commonjs/components/ReorderableList.js.map +1 -1
  4. package/lib/commonjs/components/ReorderableListCell.js +39 -29
  5. package/lib/commonjs/components/ReorderableListCell.js.map +1 -1
  6. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js +10 -7
  7. package/lib/commonjs/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  8. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js +34 -0
  9. package/lib/commonjs/components/ReorderableListCore/animationDefaults.js.map +1 -0
  10. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js +31 -0
  11. package/lib/commonjs/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  12. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js +66 -41
  13. package/lib/commonjs/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  14. package/lib/commonjs/components/ScrollViewContainer.js +2 -2
  15. package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
  16. package/lib/commonjs/components/index.js +0 -11
  17. package/lib/commonjs/components/index.js.map +1 -1
  18. package/lib/commonjs/contexts/ReorderableListContext.js.map +1 -1
  19. package/lib/commonjs/index.js +0 -6
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/types/misc.js +3 -3
  22. package/lib/module/components/ReorderableList.js +11 -13
  23. package/lib/module/components/ReorderableList.js.map +1 -1
  24. package/lib/module/components/ReorderableListCell.js +40 -30
  25. package/lib/module/components/ReorderableListCell.js.map +1 -1
  26. package/lib/module/components/ReorderableListCore/ReorderableListCore.js +10 -6
  27. package/lib/module/components/ReorderableListCore/ReorderableListCore.js.map +1 -1
  28. package/lib/module/components/ReorderableListCore/animationDefaults.js +28 -0
  29. package/lib/module/components/ReorderableListCore/animationDefaults.js.map +1 -0
  30. package/lib/module/components/ReorderableListCore/autoscrollConfig.js +25 -0
  31. package/lib/module/components/ReorderableListCore/autoscrollConfig.js.map +1 -0
  32. package/lib/module/components/ReorderableListCore/useReorderableListCore.js +68 -43
  33. package/lib/module/components/ReorderableListCore/useReorderableListCore.js.map +1 -1
  34. package/lib/module/components/ScrollViewContainer.js +3 -3
  35. package/lib/module/components/ScrollViewContainer.js.map +1 -1
  36. package/lib/module/components/index.js +0 -1
  37. package/lib/module/components/index.js.map +1 -1
  38. package/lib/module/contexts/ReorderableListContext.js.map +1 -1
  39. package/lib/module/index.js +2 -2
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/types/misc.js +3 -3
  42. package/lib/typescript/components/ReorderableList.d.ts.map +1 -1
  43. package/lib/typescript/components/ReorderableListCell.d.ts +1 -1
  44. package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -1
  45. package/lib/typescript/components/ReorderableListCore/ReorderableListCore.d.ts.map +1 -1
  46. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts +13 -0
  47. package/lib/typescript/components/ReorderableListCore/animationDefaults.d.ts.map +1 -0
  48. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts +6 -0
  49. package/lib/typescript/components/ReorderableListCore/autoscrollConfig.d.ts.map +1 -0
  50. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts +7 -4
  51. package/lib/typescript/components/ReorderableListCore/useReorderableListCore.d.ts.map +1 -1
  52. package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
  53. package/lib/typescript/components/index.d.ts +0 -1
  54. package/lib/typescript/components/index.d.ts.map +1 -1
  55. package/lib/typescript/contexts/ReorderableListContext.d.ts +2 -0
  56. package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -1
  57. package/lib/typescript/index.d.ts +3 -3
  58. package/lib/typescript/index.d.ts.map +1 -1
  59. package/lib/typescript/types/misc.d.ts +3 -3
  60. package/lib/typescript/types/misc.d.ts.map +1 -1
  61. package/lib/typescript/types/props.d.ts +25 -37
  62. package/lib/typescript/types/props.d.ts.map +1 -1
  63. package/package.json +19 -11
  64. package/src/components/ReorderableList.tsx +14 -16
  65. package/src/components/ReorderableListCell.tsx +36 -32
  66. package/src/components/ReorderableListCore/ReorderableListCore.tsx +16 -5
  67. package/src/components/ReorderableListCore/animationDefaults.ts +35 -0
  68. package/src/components/ReorderableListCore/autoscrollConfig.ts +31 -0
  69. package/src/components/ReorderableListCore/useReorderableListCore.ts +94 -52
  70. package/src/components/ScrollViewContainer.tsx +7 -3
  71. package/src/components/index.ts +0 -1
  72. package/src/contexts/ReorderableListContext.ts +2 -0
  73. package/src/index.ts +4 -6
  74. package/src/types/misc.ts +3 -3
  75. package/src/types/props.ts +26 -43
  76. package/lib/commonjs/components/ReorderableListCore/constants.ios.js +0 -10
  77. package/lib/commonjs/components/ReorderableListCore/constants.ios.js.map +0 -1
  78. package/lib/commonjs/components/ReorderableListCore/constants.js +0 -10
  79. package/lib/commonjs/components/ReorderableListCore/constants.js.map +0 -1
  80. package/lib/commonjs/components/ReorderableListItem.js +0 -87
  81. package/lib/commonjs/components/ReorderableListItem.js.map +0 -1
  82. package/lib/module/components/ReorderableListCore/constants.ios.js +0 -4
  83. package/lib/module/components/ReorderableListCore/constants.ios.js.map +0 -1
  84. package/lib/module/components/ReorderableListCore/constants.js +0 -4
  85. package/lib/module/components/ReorderableListCore/constants.js.map +0 -1
  86. package/lib/module/components/ReorderableListItem.js +0 -78
  87. package/lib/module/components/ReorderableListItem.js.map +0 -1
  88. package/lib/typescript/components/ReorderableListCore/constants.d.ts +0 -3
  89. package/lib/typescript/components/ReorderableListCore/constants.d.ts.map +0 -1
  90. package/lib/typescript/components/ReorderableListCore/constants.ios.d.ts +0 -3
  91. package/lib/typescript/components/ReorderableListCore/constants.ios.d.ts.map +0 -1
  92. package/lib/typescript/components/ReorderableListItem.d.ts +0 -4
  93. package/lib/typescript/components/ReorderableListItem.d.ts.map +0 -1
  94. package/src/components/ReorderableListCore/constants.ios.ts +0 -3
  95. package/src/components/ReorderableListCore/constants.ts +0 -3
  96. package/src/components/ReorderableListItem.tsx +0 -108
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ReorderableListItem = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
9
- var _hooks = require("../hooks");
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
- 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); }
13
- const scaleDefaultConfig = {
14
- enabled: true,
15
- valueEnd: 1,
16
- valueStart: 1.025,
17
- easingStart: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease),
18
- easingEnd: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease),
19
- duration: 200
20
- };
21
- const opacityDefaultConfig = {
22
- enabled: true,
23
- valueEnd: 1,
24
- valueStart: 0.75,
25
- easingStart: _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.ease),
26
- easingEnd: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease),
27
- duration: 200
28
- };
29
- const ReorderableListItem = ({
30
- scaleAnimationConfig = scaleDefaultConfig,
31
- opacityAnimationConfig = opacityDefaultConfig,
32
- ...rest
33
- }) => {
34
- const scaleConfigWithDefaults = (0, _react.useMemo)(() => ({
35
- ...scaleDefaultConfig,
36
- ...scaleAnimationConfig
37
- }), [scaleAnimationConfig]);
38
- const opacityConfigWithDefaults = (0, _react.useMemo)(() => ({
39
- ...opacityDefaultConfig,
40
- ...opacityAnimationConfig
41
- }), [opacityAnimationConfig]);
42
- const scale = (0, _reactNativeReanimated.useSharedValue)(scaleConfigWithDefaults.enabled ? scaleConfigWithDefaults.valueEnd : 1);
43
- const opacity = (0, _reactNativeReanimated.useSharedValue)(opacityConfigWithDefaults.enabled ? opacityConfigWithDefaults.valueEnd : 1);
44
- (0, _hooks.useReorderableDragStart)((0, _react.useCallback)(() => {
45
- 'worklet';
46
-
47
- if (scaleConfigWithDefaults.enabled) {
48
- scale.value = (0, _reactNativeReanimated.withTiming)(scaleConfigWithDefaults.valueStart, {
49
- easing: scaleConfigWithDefaults.easingStart,
50
- duration: scaleConfigWithDefaults.duration
51
- });
52
- }
53
- if (opacityConfigWithDefaults.enabled) {
54
- opacity.value = (0, _reactNativeReanimated.withTiming)(opacityConfigWithDefaults.valueStart, {
55
- easing: opacityConfigWithDefaults.easingStart,
56
- duration: opacityConfigWithDefaults.duration
57
- });
58
- }
59
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]));
60
- (0, _hooks.useReorderableDragEnd)((0, _react.useCallback)(() => {
61
- 'worklet';
62
-
63
- if (scaleConfigWithDefaults.enabled) {
64
- scale.value = (0, _reactNativeReanimated.withTiming)(scaleConfigWithDefaults.valueEnd, {
65
- easing: scaleConfigWithDefaults.easingEnd,
66
- duration: scaleConfigWithDefaults.duration
67
- });
68
- }
69
- if (opacityConfigWithDefaults.enabled) {
70
- opacity.value = (0, _reactNativeReanimated.withTiming)(opacityConfigWithDefaults.valueEnd, {
71
- easing: opacityConfigWithDefaults.easingEnd,
72
- duration: opacityConfigWithDefaults.duration
73
- });
74
- }
75
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]));
76
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
77
- transform: [{
78
- scale: scale.value
79
- }],
80
- opacity: opacity.value
81
- }), [scale, opacity]);
82
- return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({}, rest, {
83
- style: [animatedStyle, rest.style]
84
- }));
85
- };
86
- exports.ReorderableListItem = ReorderableListItem;
87
- //# sourceMappingURL=ReorderableListItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","scaleDefaultConfig","enabled","valueEnd","valueStart","easingStart","Easing","in","ease","easingEnd","out","duration","opacityDefaultConfig","ReorderableListItem","scaleAnimationConfig","opacityAnimationConfig","rest","scaleConfigWithDefaults","useMemo","opacityConfigWithDefaults","scale","useSharedValue","opacity","useReorderableDragStart","useCallback","value","withTiming","easing","useReorderableDragEnd","animatedStyle","useAnimatedStyle","transform","createElement","View","style","exports"],"sourceRoot":"../../../src","sources":["components/ReorderableListItem.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AAAwE,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,S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EAED,MAAMY,aAAa,GAAG,IAAAC,uCAAgB,EACpC,OAAO;IACLC,SAAS,EAAE,CACT;MACEX,KAAK,EAAEA,KAAK,CAACK;IACf,CAAC,CACF;IACDH,OAAO,EAAEA,OAAO,CAACG;EACnB,CAAC,CAAC,EACF,CAACL,KAAK,EAAEE,OAAO,CACjB,CAAC;EAED,oBAAOpD,MAAA,CAAAW,OAAA,CAAAmD,aAAA,CAAC3D,sBAAA,CAAAQ,OAAQ,CAACoD,IAAI,EAAAtC,QAAA,KAAKqB,IAAI;IAAEkB,KAAK,EAAE,CAACL,aAAa,EAAEb,IAAI,CAACkB,KAAK;EAAE,EAAE,CAAC;AACxE,CAAC;AAACC,OAAA,CAAAtB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- // iOS specific constants
2
- export const AUTOSCROLL_INCREMENT = 80;
3
- export const AUTOSCROLL_DELAY = 100;
4
- //# sourceMappingURL=constants.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["AUTOSCROLL_INCREMENT","AUTOSCROLL_DELAY"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/constants.ios.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,GAAG,EAAE;AACtC,OAAO,MAAMC,gBAAgB,GAAG,GAAG","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- // Default constants
2
- export const AUTOSCROLL_INCREMENT = 5;
3
- export const AUTOSCROLL_DELAY = 0;
4
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["AUTOSCROLL_INCREMENT","AUTOSCROLL_DELAY"],"sourceRoot":"../../../../src","sources":["components/ReorderableListCore/constants.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,GAAG,CAAC;AACrC,OAAO,MAAMC,gBAAgB,GAAG,CAAC","ignoreList":[]}
@@ -1,78 +0,0 @@
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, useMemo } from 'react';
3
- import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
4
- import { useReorderableDragEnd, useReorderableDragStart } from '../hooks';
5
- const scaleDefaultConfig = {
6
- enabled: true,
7
- valueEnd: 1,
8
- valueStart: 1.025,
9
- easingStart: Easing.in(Easing.ease),
10
- easingEnd: Easing.out(Easing.ease),
11
- duration: 200
12
- };
13
- const opacityDefaultConfig = {
14
- enabled: true,
15
- valueEnd: 1,
16
- valueStart: 0.75,
17
- easingStart: Easing.in(Easing.ease),
18
- easingEnd: Easing.out(Easing.ease),
19
- duration: 200
20
- };
21
- export const ReorderableListItem = ({
22
- scaleAnimationConfig = scaleDefaultConfig,
23
- opacityAnimationConfig = opacityDefaultConfig,
24
- ...rest
25
- }) => {
26
- const scaleConfigWithDefaults = useMemo(() => ({
27
- ...scaleDefaultConfig,
28
- ...scaleAnimationConfig
29
- }), [scaleAnimationConfig]);
30
- const opacityConfigWithDefaults = useMemo(() => ({
31
- ...opacityDefaultConfig,
32
- ...opacityAnimationConfig
33
- }), [opacityAnimationConfig]);
34
- const scale = useSharedValue(scaleConfigWithDefaults.enabled ? scaleConfigWithDefaults.valueEnd : 1);
35
- const opacity = useSharedValue(opacityConfigWithDefaults.enabled ? opacityConfigWithDefaults.valueEnd : 1);
36
- useReorderableDragStart(useCallback(() => {
37
- 'worklet';
38
-
39
- if (scaleConfigWithDefaults.enabled) {
40
- scale.value = withTiming(scaleConfigWithDefaults.valueStart, {
41
- easing: scaleConfigWithDefaults.easingStart,
42
- duration: scaleConfigWithDefaults.duration
43
- });
44
- }
45
- if (opacityConfigWithDefaults.enabled) {
46
- opacity.value = withTiming(opacityConfigWithDefaults.valueStart, {
47
- easing: opacityConfigWithDefaults.easingStart,
48
- duration: opacityConfigWithDefaults.duration
49
- });
50
- }
51
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]));
52
- useReorderableDragEnd(useCallback(() => {
53
- 'worklet';
54
-
55
- if (scaleConfigWithDefaults.enabled) {
56
- scale.value = withTiming(scaleConfigWithDefaults.valueEnd, {
57
- easing: scaleConfigWithDefaults.easingEnd,
58
- duration: scaleConfigWithDefaults.duration
59
- });
60
- }
61
- if (opacityConfigWithDefaults.enabled) {
62
- opacity.value = withTiming(opacityConfigWithDefaults.valueEnd, {
63
- easing: opacityConfigWithDefaults.easingEnd,
64
- duration: opacityConfigWithDefaults.duration
65
- });
66
- }
67
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]));
68
- const animatedStyle = useAnimatedStyle(() => ({
69
- transform: [{
70
- scale: scale.value
71
- }],
72
- opacity: opacity.value
73
- }), [scale, opacity]);
74
- return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
75
- style: [animatedStyle, rest.style]
76
- }));
77
- };
78
- //# sourceMappingURL=ReorderableListItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useCallback","useMemo","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","useReorderableDragEnd","useReorderableDragStart","scaleDefaultConfig","enabled","valueEnd","valueStart","easingStart","in","ease","easingEnd","out","duration","opacityDefaultConfig","ReorderableListItem","scaleAnimationConfig","opacityAnimationConfig","rest","scaleConfigWithDefaults","opacityConfigWithDefaults","scale","opacity","value","easing","animatedStyle","transform","createElement","View","_extends","style"],"sourceRoot":"../../../src","sources":["components/ReorderableListItem.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAEjD,OAAOC,QAAQ,IACbC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAEhC,SAAQC,qBAAqB,EAAEC,uBAAuB,QAAO,UAAU;AAGvE,MAAMC,kBAAkB,GAAG;EACzBC,OAAO,EAAE,IAAI;E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AAO,CACjB,CAAC;EAED,oBAAO5B,KAAA,CAAAiC,aAAA,CAAC9B,QAAQ,CAAC+B,IAAI,EAAAC,QAAA,KAAKX,IAAI;IAAEY,KAAK,EAAE,CAACL,aAAa,EAAEP,IAAI,CAACY,KAAK;EAAE,EAAE,CAAC;AACxE,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export declare const AUTOSCROLL_INCREMENT = 5;
2
- export declare const AUTOSCROLL_DELAY = 0;
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,gBAAgB,IAAI,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const AUTOSCROLL_INCREMENT = 80;
2
- export declare const AUTOSCROLL_DELAY = 100;
3
- //# sourceMappingURL=constants.ios.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.ios.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/constants.ios.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,gBAAgB,MAAM,CAAC"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- // iOS specific constants
2
- export const AUTOSCROLL_INCREMENT = 80;
3
- export const AUTOSCROLL_DELAY = 100;
@@ -1,3 +0,0 @@
1
- // Default constants
2
- export const AUTOSCROLL_INCREMENT = 5;
3
- export const AUTOSCROLL_DELAY = 0;
@@ -1,108 +0,0 @@
1
- import React, {useCallback, useMemo} from 'react';
2
-
3
- import Animated, {
4
- Easing,
5
- useAnimatedStyle,
6
- useSharedValue,
7
- withTiming,
8
- } from 'react-native-reanimated';
9
-
10
- import {useReorderableDragEnd, useReorderableDragStart} from '../hooks';
11
- import type {ReorderableListItemProps} from '../types';
12
-
13
- const scaleDefaultConfig = {
14
- enabled: true,
15
- valueEnd: 1,
16
- valueStart: 1.025,
17
- easingStart: Easing.in(Easing.ease),
18
- easingEnd: Easing.out(Easing.ease),
19
- duration: 200,
20
- };
21
-
22
- const opacityDefaultConfig = {
23
- enabled: true,
24
- valueEnd: 1,
25
- valueStart: 0.75,
26
- easingStart: Easing.in(Easing.ease),
27
- easingEnd: Easing.out(Easing.ease),
28
- duration: 200,
29
- };
30
-
31
- export const ReorderableListItem: React.FC<ReorderableListItemProps> = ({
32
- scaleAnimationConfig = scaleDefaultConfig,
33
- opacityAnimationConfig = opacityDefaultConfig,
34
- ...rest
35
- }) => {
36
- const scaleConfigWithDefaults = useMemo(
37
- () => ({
38
- ...scaleDefaultConfig,
39
- ...scaleAnimationConfig,
40
- }),
41
- [scaleAnimationConfig],
42
- );
43
- const opacityConfigWithDefaults = useMemo(
44
- () => ({
45
- ...opacityDefaultConfig,
46
- ...opacityAnimationConfig,
47
- }),
48
- [opacityAnimationConfig],
49
- );
50
- const scale = useSharedValue(
51
- scaleConfigWithDefaults.enabled ? scaleConfigWithDefaults.valueEnd : 1,
52
- );
53
- const opacity = useSharedValue(
54
- opacityConfigWithDefaults.enabled ? opacityConfigWithDefaults.valueEnd : 1,
55
- );
56
-
57
- useReorderableDragStart(
58
- useCallback(() => {
59
- 'worklet';
60
- if (scaleConfigWithDefaults.enabled) {
61
- scale.value = withTiming(scaleConfigWithDefaults.valueStart, {
62
- easing: scaleConfigWithDefaults.easingStart,
63
- duration: scaleConfigWithDefaults.duration,
64
- });
65
- }
66
-
67
- if (opacityConfigWithDefaults.enabled) {
68
- opacity.value = withTiming(opacityConfigWithDefaults.valueStart, {
69
- easing: opacityConfigWithDefaults.easingStart,
70
- duration: opacityConfigWithDefaults.duration,
71
- });
72
- }
73
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]),
74
- );
75
-
76
- useReorderableDragEnd(
77
- useCallback(() => {
78
- 'worklet';
79
- if (scaleConfigWithDefaults.enabled) {
80
- scale.value = withTiming(scaleConfigWithDefaults.valueEnd, {
81
- easing: scaleConfigWithDefaults.easingEnd,
82
- duration: scaleConfigWithDefaults.duration,
83
- });
84
- }
85
-
86
- if (opacityConfigWithDefaults.enabled) {
87
- opacity.value = withTiming(opacityConfigWithDefaults.valueEnd, {
88
- easing: opacityConfigWithDefaults.easingEnd,
89
- duration: opacityConfigWithDefaults.duration,
90
- });
91
- }
92
- }, [opacity, scale, opacityConfigWithDefaults, scaleConfigWithDefaults]),
93
- );
94
-
95
- const animatedStyle = useAnimatedStyle(
96
- () => ({
97
- transform: [
98
- {
99
- scale: scale.value,
100
- },
101
- ],
102
- opacity: opacity.value,
103
- }),
104
- [scale, opacity],
105
- );
106
-
107
- return <Animated.View {...rest} style={[animatedStyle, rest.style]} />;
108
- };