From 3a493453f342423bd5b7bac4cc57bd57df4b59af Mon Sep 17 00:00:00 2001 From: Petr Konecny Date: Tue, 25 Nov 2025 16:55:29 +0100 Subject: [PATCH] fix: fixed crash when manually scrolling --- src/hooks/useManualScroll.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/useManualScroll.ts b/src/hooks/useManualScroll.ts index cef39cd..6da0f0d 100644 --- a/src/hooks/useManualScroll.ts +++ b/src/hooks/useManualScroll.ts @@ -14,11 +14,13 @@ export const useManualScroll = ({ const scrollValue = useSharedValue(initialIndex) const goToPage = useCallback( - (page: number, duration = 0, animation = DEFAULT_ANIMATION) => { + (page: number, duration = 0, animation?: typeof DEFAULT_ANIMATION) => { 'worklet' const to = page * slideWidth if (duration) { - manualScrollValue.value = { value: animation(to, duration) } + manualScrollValue.value = { + value: animation ? animation(to, duration) : withTiming(to, { duration }), + } } else { manualScrollValue.value = { value: to } }