We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 馃憢
Firstly, thanks for your work on this project! 馃檪
Today I used patch-package to patch react-native-reanimated-carousel@4.0.0-alpha.12 for the project I'm working on.
react-native-reanimated-carousel@4.0.0-alpha.12
This patch will fix the overscrollEnabled property. if it was false and loop was also false, the carousel would still bounce. fixes that issue.
Here is the diff that solved my problem:
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..b5b4099 100644 --- a/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx +++ b/node_modules/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx @@ -1,5 +1,5 @@ import type { PropsWithChildren } from "react"; -import React, { useCallback } from "react"; +import React, { useCallback, useState } from "react"; import type { StyleProp, ViewStyle } from "react-native"; import type { GestureStateChangeEvent, PanGestureHandlerEventPayload } from "react-native-gesture-handler"; import { GestureDetector } from "react-native-gesture-handler"; @@ -73,14 +73,14 @@ const IScrollViewGesture: React.FC<PropsWithChildren<Props>> = (props) => { const containerRef = useAnimatedRef<Animated.View>(); const maxScrollDistancePerSwipeIsSet = typeof maxScrollDistancePerSwipe === "number"; const minScrollDistancePerSwipeIsSet = typeof minScrollDistancePerSwipe === "number"; - + const [containerWidth, setContainerWidth] = useState(0) // Get the limit of the scroll. const getLimit = React.useCallback(() => { "worklet"; if (!loop && !overscrollEnabled) { - const { width: containerWidth = 0 } = measure(containerRef); - + // const measureResults = measure(containerRef); + containerRef.current?.measure((b,a,width) => setContainerWidth(width)) // If the item's total width is less than the container's width, then there is no need to scroll. if (dataLength * size < containerWidth) return 0; @@ -318,8 +318,19 @@ const IScrollViewGesture: React.FC<PropsWithChildren<Props>> = (props) => { } } - const translationValue = panOffset.value + panTranslation; - translation.value = translationValue; + const translationValue = panOffset.value + panTranslation; + + if (!(!loop && !overscrollEnabled && (translationValue > 0 || translationValue < -max.value))) { + translation.value = translationValue; + + } + + + // if (!loop && !overscrollEnabled && !(translation.value === 0 || translation.value === -max.value)) { + + // } + + }, [ isHorizontal, max,
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 馃憢
Firstly, thanks for your work on this project! 馃檪
Today I used patch-package to patch
react-native-reanimated-carousel@4.0.0-alpha.12
for the project I'm working on.This patch will fix the overscrollEnabled property. if it was false and loop was also false, the carousel would still bounce. fixes that issue.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: