Skip to content

Instantly share code, notes, and snippets.

@reime005
Last active January 13, 2021 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/45aca59066e5151b31dd868e02024784 to your computer and use it in GitHub Desktop.
Save reime005/45aca59066e5151b31dd868e02024784 to your computer and use it in GitHub Desktop.
const changeModalPosition = React.useCallback(
(gs: PanResponderGestureState) => {
const value = screenHeight - MODAL_HEIGHT + gs.dy;
// prevent dragging too high or too low
if (value >= screenHeight || value < screenHeight - MODAL_HEIGHT) {
return;
}
pan.y.setValue(value);
},
[],
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment