react-native-reanimated-carousel 4.0.0-alpha.8 → 4.0.0-alpha.9
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.
- package/README.md +2 -3
- package/lib/commonjs/components/Carousel.js +6 -6
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/ScrollViewGesture.js +5 -5
- package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
- package/lib/commonjs/hooks/useCarouselController.js +9 -9
- package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
- package/lib/commonjs/hooks/usePanGestureProxy.js +12 -12
- package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
- package/lib/commonjs/hooks/usePanGestureProxy.test.js +8 -8
- package/lib/commonjs/hooks/usePanGestureProxy.test.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/Carousel.js +6 -6
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/ScrollViewGesture.js +5 -5
- package/lib/module/components/ScrollViewGesture.js.map +1 -1
- package/lib/module/hooks/useCarouselController.js +9 -9
- package/lib/module/hooks/useCarouselController.js.map +1 -1
- package/lib/module/hooks/usePanGestureProxy.js +12 -12
- package/lib/module/hooks/usePanGestureProxy.js.map +1 -1
- package/lib/module/hooks/usePanGestureProxy.test.js +8 -8
- package/lib/module/hooks/usePanGestureProxy.test.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/ScrollViewGesture.d.ts +1 -1
- package/lib/typescript/hooks/useCarouselController.d.ts +1 -1
- package/lib/typescript/hooks/usePanGestureProxy.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Carousel.tsx +6 -6
- package/src/components/ScrollViewGesture.tsx +6 -6
- package/src/hooks/useCarouselController.tsx +9 -9
- package/src/hooks/usePanGestureProxy.test.tsx +6 -7
- package/src/hooks/usePanGestureProxy.ts +15 -15
- package/src/index.tsx +2 -0
- package/src/types.ts +2 -2
|
@@ -8,7 +8,7 @@ import { useUpdateGestureConfig } from "./useUpdateGestureConfig";
|
|
|
8
8
|
export const usePanGestureProxy = (
|
|
9
9
|
customization: {
|
|
10
10
|
onConfigurePanGesture?: (gesture: PanGesture) => void
|
|
11
|
-
|
|
11
|
+
onGestureStart: (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => void
|
|
12
12
|
onGestureUpdate: (event: GestureUpdateEvent<PanGestureHandlerEventPayload>) => void
|
|
13
13
|
onGestureEnd: (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>, success: boolean) => void
|
|
14
14
|
options?: GestureConfig
|
|
@@ -16,7 +16,7 @@ export const usePanGestureProxy = (
|
|
|
16
16
|
) => {
|
|
17
17
|
const {
|
|
18
18
|
onConfigurePanGesture,
|
|
19
|
-
|
|
19
|
+
onGestureStart,
|
|
20
20
|
onGestureUpdate,
|
|
21
21
|
onGestureEnd,
|
|
22
22
|
options = {},
|
|
@@ -27,25 +27,25 @@ export const usePanGestureProxy = (
|
|
|
27
27
|
|
|
28
28
|
// Save the original gesture callbacks
|
|
29
29
|
const originalGestures = {
|
|
30
|
-
|
|
30
|
+
onStart: gesture.onStart,
|
|
31
31
|
onUpdate: gesture.onUpdate,
|
|
32
32
|
onEnd: gesture.onEnd,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// Save the user defined gesture callbacks
|
|
36
36
|
const userDefinedConflictGestures: {
|
|
37
|
-
|
|
37
|
+
onStart?: Parameters<(typeof gesture)["onStart"]>[0]
|
|
38
38
|
onUpdate?: Parameters<(typeof gesture)["onUpdate"]>[0]
|
|
39
39
|
onEnd?: Parameters<(typeof gesture)["onEnd"]>[0]
|
|
40
40
|
} = {
|
|
41
|
-
|
|
41
|
+
onStart: undefined,
|
|
42
42
|
onUpdate: undefined,
|
|
43
43
|
onEnd: undefined,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
// Using
|
|
48
|
-
userDefinedConflictGestures.
|
|
46
|
+
const fakeOnStart: typeof gesture.onStart = (cb) => {
|
|
47
|
+
// Using fakeOnStart to save the user defined callback
|
|
48
|
+
userDefinedConflictGestures.onStart = cb;
|
|
49
49
|
return gesture;
|
|
50
50
|
};
|
|
51
51
|
|
|
@@ -62,7 +62,7 @@ export const usePanGestureProxy = (
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// Setup the fake callbacks
|
|
65
|
-
gesture.
|
|
65
|
+
gesture.onStart = fakeOnStart;
|
|
66
66
|
gesture.onUpdate = fakeOnUpdate;
|
|
67
67
|
gesture.onEnd = fakeOnEnd;
|
|
68
68
|
|
|
@@ -71,17 +71,17 @@ export const usePanGestureProxy = (
|
|
|
71
71
|
onConfigurePanGesture(gesture);
|
|
72
72
|
|
|
73
73
|
// Restore the original callbacks
|
|
74
|
-
gesture.
|
|
74
|
+
gesture.onStart = originalGestures.onStart;
|
|
75
75
|
gesture.onUpdate = originalGestures.onUpdate;
|
|
76
76
|
gesture.onEnd = originalGestures.onEnd;
|
|
77
77
|
|
|
78
78
|
// Setup the original callbacks with the user defined callbacks
|
|
79
79
|
gesture
|
|
80
|
-
.
|
|
81
|
-
|
|
80
|
+
.onStart((e) => {
|
|
81
|
+
onGestureStart(e);
|
|
82
82
|
|
|
83
|
-
if (userDefinedConflictGestures.
|
|
84
|
-
userDefinedConflictGestures.
|
|
83
|
+
if (userDefinedConflictGestures.onStart)
|
|
84
|
+
userDefinedConflictGestures.onStart(e);
|
|
85
85
|
})
|
|
86
86
|
.onUpdate((e) => {
|
|
87
87
|
onGestureUpdate(e);
|
|
@@ -98,7 +98,7 @@ export const usePanGestureProxy = (
|
|
|
98
98
|
|
|
99
99
|
return gesture;
|
|
100
100
|
}, [
|
|
101
|
-
|
|
101
|
+
onGestureStart,
|
|
102
102
|
onGestureUpdate,
|
|
103
103
|
onGestureEnd,
|
|
104
104
|
onConfigurePanGesture,
|
package/src/index.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import Carousel from "./components/Carousel";
|
|
2
|
+
|
|
2
3
|
export type {
|
|
3
4
|
TCarouselProps,
|
|
4
5
|
ICarouselInstance,
|
|
5
6
|
IComputedDirectionTypes,
|
|
6
7
|
CarouselRenderItem,
|
|
7
8
|
} from "./types";
|
|
9
|
+
export type { TAnimationStyle } from "./components/BaseLayout";
|
|
8
10
|
export type { ILayoutConfig } from "./layouts/stack";
|
|
9
11
|
|
|
10
12
|
export default Carousel;
|
package/src/types.ts
CHANGED
|
@@ -180,9 +180,9 @@ export type TCarouselProps<T = any> = {
|
|
|
180
180
|
*/
|
|
181
181
|
onSnapToItem?: (index: number) => void
|
|
182
182
|
/**
|
|
183
|
-
* On scroll
|
|
183
|
+
* On scroll start
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
onScrollStart?: () => void
|
|
186
186
|
/**
|
|
187
187
|
* On scroll end
|
|
188
188
|
*/
|