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,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;EACbC,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE,KAAK;EACjBC,WAAW,EAAEV,MAAM,CAACW,EAAE,CAACX,MAAM,CAACY,IAAI,CAAC;EACnCC,SAAS,EAAEb,MAAM,CAACc,GAAG,CAACd,MAAM,CAACY,IAAI,CAAC;EAClCG,QAAQ,EAAE;AACZ,CAAC;AAED,MAAMC,oBAAoB,G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constants.d.ts","sourceRoot":"","sources":["../../../../src/components/ReorderableListCore/constants.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,SAAS,SACqD,CAAC;AAE5E,eAAO,MAAM,iBAAiB;;;CAU5B,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,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
- };