Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/hooks/useGestureEventsHandlersDefault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
};
Expand Down Expand Up @@ -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
);
Expand All @@ -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
*/
Expand Down