export type NavigationStateOrRoute = Readonly<{ /** * Index of the currently focused route. */ index: number; /** * List of rendered routes. */ routes?: Array; state?: NavigationStateOrRoute; /** * User-provided name for the route. */ name: string; routeName: string; }>; export type NavigationAction = Readonly<{ /** * Type of the action (e.g. `NAVIGATE`) */ type: string; /** * Additional data for the action */ payload?: object; /** * Key of the route which dispatched this action. */ source?: string; /** * Key of the navigator which should handle this action. */ target?: string; }>; export type NavigationContainerRef = { /** * React Navigation 4 and below state. */ state?: { nav?: NavigationStateOrRoute; }; /** * Get the rehydrated navigation state of the navigation tree. */ getRootState?: () => NavigationStateOrRoute; }; export type NavigationContainerProps = { /** * Callback which is called after the navigation tree mounts. */ onReady?: () => void; /** * Callback which is called with the latest navigation state when it changes. * React Navigation 5.0 onward. */ onStateChange?: (state: NavigationStateOrRoute | undefined) => void; /** * Callback which is called with the latest navigation state when it changes. * Prior to React Navigation 5.0. */ onNavigationStateChange?: (previousState: NavigationStateOrRoute | undefined, currentState: NavigationStateOrRoute | undefined, action: NavigationAction | undefined) => void; };