From 3fa57343f5ab14ff960d75b386bb2a9a195afb56 Mon Sep 17 00:00:00 2001 From: Anh Tu Do Date: Sun, 19 Oct 2025 22:44:36 -0500 Subject: [PATCH 1/2] fix: take into account scrollable content offset y for panning gesture --- src/hooks/useGestureEventsHandlersDefault.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/hooks/useGestureEventsHandlersDefault.tsx b/src/hooks/useGestureEventsHandlersDefault.tsx index 4a33d172..5bef4a37 100644 --- a/src/hooks/useGestureEventsHandlersDefault.tsx +++ b/src/hooks/useGestureEventsHandlersDefault.tsx @@ -33,7 +33,7 @@ const dismissKeyboard = Keyboard.dismiss; // biome-ignore lint: to be addressed! const resetContext = (context: any) => { 'worklet'; - Object.keys(context).map(key => { + Object.keys(context).forEach(key => { context[key] = undefined; }); }; @@ -375,11 +375,22 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType = snapPoints.unshift(closedDetentPosition); } + const wasGestureHandledByScrollView = + source === GESTURE_SOURCE.CONTENT && scrollableContentOffsetY > 0; + + let rawDestinationPosition = + translationY + context.value.initialPosition; + + if (wasGestureHandledByScrollView) { + rawDestinationPosition -= + animatedScrollableState.get().contentOffsetY; + } + /** * calculate the destination point, using redash. */ const destinationPoint = snapPoint( - translationY + context.value.initialPosition, + rawDestinationPosition, velocityY, snapPoints ); @@ -392,8 +403,6 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType = return; } - const wasGestureHandledByScrollView = - source === GESTURE_SOURCE.CONTENT && scrollableContentOffsetY > 0; /** * prevents snapping from top to middle / bottom with repeated interrupted scrolls */ From 7cc0398ccab909640942cc50ab67f9fe655f809f Mon Sep 17 00:00:00 2001 From: Anh Tu Do Date: Sun, 19 Oct 2025 22:53:46 -0500 Subject: [PATCH 2/2] fix: use already declared variable for content offset y --- src/hooks/useGestureEventsHandlersDefault.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hooks/useGestureEventsHandlersDefault.tsx b/src/hooks/useGestureEventsHandlersDefault.tsx index 5bef4a37..be5994e9 100644 --- a/src/hooks/useGestureEventsHandlersDefault.tsx +++ b/src/hooks/useGestureEventsHandlersDefault.tsx @@ -382,8 +382,7 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType = translationY + context.value.initialPosition; if (wasGestureHandledByScrollView) { - rawDestinationPosition -= - animatedScrollableState.get().contentOffsetY; + rawDestinationPosition -= scrollableContentOffsetY; } /**