From 4f145b04aee46d10cdc1969b21b251cbd6c6334b Mon Sep 17 00:00:00 2001 From: Petr Konecny Date: Tue, 16 Dec 2025 12:02:54 +0100 Subject: [PATCH] fix: round value on go to and scroll view interaction --- src/components/AnimatedPagedView/index.tsx | 4 ++++ src/hooks/useManualScroll.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/AnimatedPagedView/index.tsx b/src/components/AnimatedPagedView/index.tsx index c4a9196..1d1c915 100644 --- a/src/components/AnimatedPagedView/index.tsx +++ b/src/components/AnimatedPagedView/index.tsx @@ -22,6 +22,9 @@ type AnimatedPagedViewProps = { children: React.ReactNode } +// easiest way to allow other gestures to work, for example the scroll view +const MIN_DISTANCE_THRESHOLD = 30 + export const AnimatedPagedView = forwardRef( (props, ref) => { const translateX = useSharedValue(0) @@ -38,6 +41,7 @@ export const AnimatedPagedView = forwardRef { context.value = { x: translateX.value } runOnJS(props.onScrollBeginDrag)() diff --git a/src/hooks/useManualScroll.ts b/src/hooks/useManualScroll.ts index 6da0f0d..450a91d 100644 --- a/src/hooks/useManualScroll.ts +++ b/src/hooks/useManualScroll.ts @@ -16,7 +16,7 @@ export const useManualScroll = ({ const goToPage = useCallback( (page: number, duration = 0, animation?: typeof DEFAULT_ANIMATION) => { 'worklet' - const to = page * slideWidth + const to = Math.round(page) * slideWidth if (duration) { manualScrollValue.value = { value: animation ? animation(to, duration) : withTiming(to, { duration }),