API

useScreenState

Read route, option, navigation, and snap state from the current Blank Stack.

useScreenState() returns screen and focused-route state from the current Blank Stack.

TSX

1import { useScreenState } from "react-native-screen-transitions";
2
3const {
4 index,
5 routes,
6 focusedRoute,
7 focusedIndex,
8 options,
9 meta,
10 navigation,
11 snapTo,
12} = useScreenState();
FieldMeaning
indexIndex of the current screen in the stack
routesRoutes in the current stack
focusedRouteFocused route in the stack
focusedIndexIndex of the focused route
optionsResolved options for the focused screen
metaMetadata from the focused screen options
navigationNavigation object for the current screen
snapTo(index)Snap the focused screen to a configured snap-point index