diff --git a/src/hooks/useGestureEventsHandlersDefault.tsx b/src/hooks/useGestureEventsHandlersDefault.tsx index 4a33d172..be5994e9 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,21 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType = snapPoints.unshift(closedDetentPosition); } + const wasGestureHandledByScrollView = + source === GESTURE_SOURCE.CONTENT && scrollableContentOffsetY > 0; + + let rawDestinationPosition = + translationY + context.value.initialPosition; + + if (wasGestureHandledByScrollView) { + rawDestinationPosition -= scrollableContentOffsetY; + } + /** * calculate the destination point, using redash. */ const destinationPoint = snapPoint( - translationY + context.value.initialPosition, + rawDestinationPosition, velocityY, snapPoints ); @@ -392,8 +402,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 */