From 12e91aa74a43ddbf40719293edef3a0c8c080442 Mon Sep 17 00:00:00 2001 From: Mathieu Meissonnier Date: Tue, 10 Sep 2024 17:37:53 +0200 Subject: [PATCH] fix: patch react-native-reanimated-carousel (https://github.com/dohooo/react-native-reanimated-carousel/pull/576) --- ...e-reanimated-carousel+4.0.0-alpha.12.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 patches/react-native-reanimated-carousel+4.0.0-alpha.12.patch diff --git a/patches/react-native-reanimated-carousel+4.0.0-alpha.12.patch b/patches/react-native-reanimated-carousel+4.0.0-alpha.12.patch new file mode 100644 index 00000000000..893ccab04f2 --- /dev/null +++ b/patches/react-native-reanimated-carousel+4.0.0-alpha.12.patch @@ -0,0 +1,44 @@ +diff --git a/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx b/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx +index 80a3fe0..ff03ed6 100644 +--- a/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx ++++ b/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx +@@ -65,7 +65,7 @@ const IScrollViewGesture: React.FC> = (props) => { + const maxPage = dataLength; + const isHorizontal = useDerivedValue(() => !vertical, [vertical]); + const max = useSharedValue(0); +- const panOffset = useSharedValue(0); ++ const panOffset = useSharedValue(undefined); + const touching = useSharedValue(false); + const validStart = useSharedValue(false); + const scrollEndTranslation = useSharedValue(0); +@@ -291,6 +291,10 @@ const IScrollViewGesture: React.FC> = (props) => { + const onGestureUpdate = useCallback((e: PanGestureHandlerEventPayload) => { + "worklet"; + ++ if (panOffset.value === undefined) { ++ return; ++ } ++ + if (validStart.value) { + validStart.value = false; + cancelAnimation(translation); +@@ -335,6 +339,10 @@ const IScrollViewGesture: React.FC> = (props) => { + const onGestureEnd = useCallback((e: GestureStateChangeEvent, _success: boolean) => { + "worklet"; + ++ if (panOffset.value === undefined) { ++ return; ++ } ++ + const { velocityX, velocityY, translationX, translationY } = e; + const scrollEndVelocityValue = isHorizontal.value + ? velocityX +@@ -381,6 +389,8 @@ const IScrollViewGesture: React.FC> = (props) => { + + if (!loop) + touching.value = false; ++ ++ panOffset.value = undefined; + }, [ + size, + loop,