API

useScreenGesture

Read the navigator pan gesture ref for Gesture Handler relations.

useScreenGesture() returns the screen navigation pan gesture ref. Use it when a custom Gesture Handler gesture needs a relationship with the navigator gesture.

TSX

1import { Gesture } from "react-native-gesture-handler";
2import { useScreenGesture } from "react-native-screen-transitions";
3
4const screenGesture = useScreenGesture();
5
6const pan = Gesture.Pan().requireExternalGestureToFail(screenGesture);

Target an ancestor navigator with negative depth:

TSX

1const parentGesture = useScreenGesture({ depth: -1 });

useScreenGesture() supports the current screen and ancestors. Positive depth is not valid here because gesture ownership only walks upward.