Skip to content

API Reference / @gtkx/navigation / DefaultNavigatorOptions

Type Alias: DefaultNavigatorOptions<ParamList, NavigatorID, State, ScreenOptions, EventMap, Navigation> ​

DefaultNavigatorOptions<ParamList, NavigatorID, State, ScreenOptions, EventMap, Navigation> = DefaultRouterOptions<Keyof<ParamList>> & object & NavigatorID extends string ? object : object

Defined in: node_modules/.pnpm/@react-navigation+core@7.21.13_patch_hash=6462da01ed23beee88f01d290d3714743e43d2fd84235198fcbe09501a61d1d4_react@19.2.8/node_modules/@react-navigation/core/lib/typescript/src/types.d.ts:112

Type Declaration ​

children ​

children: React.ReactNode

Children React Elements to extract the route configuration from. Only Screen, Group and React.Fragment are supported as children.

layout? ​

optional layout?: (props) => React.ReactElement

Layout for the navigator. Useful for wrapping with a component with access to navigator's state and options.

Parameters ​

props ​
children ​

React.ReactNode

descriptors ​

Record<string, Descriptor<ScreenOptions, NavigationProp<ParamList, keyof ParamList, string | undefined, State, ScreenOptions, EventMap>, ScreenRouteProp<ParamList>>>

NavigationHelpers<ParamList>

state ​

State

Returns ​

React.ReactElement

screenLayout? ​

optional screenLayout?: (props) => React.ReactElement

Layout for all screens under this navigator.

Parameters ​

props ​

ScreenLayoutArgs<ParamList, keyof ParamList, ScreenOptions, Navigation>

Returns ​

React.ReactElement

screenListeners? ​

optional screenListeners?: ScreenListeners<State, EventMap> | ((props) => ScreenListeners<State, EventMap>)

Event listeners for all the screens in the navigator.

screenOptions? ​

optional screenOptions?: ScreenOptions | ((props) => ScreenOptions)

Default options for all screens under this navigator.

UNSTABLE_routeNamesChangeBehavior? ​

optional UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled"

What should happen when the available route names change. e.g. when different screens are rendered based on a condition.

  • 'firstMatch': Navigate to the first route in the new list of routes (default).
  • 'lastUnhandled': Restore the last state that was unhandled due to conditional render.

Example cases where previous state might have been unhandled:

  • Opened a deep link to a screen, but a login screen was shown.
  • Navigated to a screen containing a navigator, but a different screen was shown.
  • Reset the navigator to a state with different routes not matching the current list of routes.

In these cases, 'lastUnhandled' will reuse the unhandled state if present. If there's no unhandled state, it will fallback to 'firstMatch' behavior.

Caveats:

  • Direct navigation is only handled for NAVIGATE actions.
  • Unhandled state is restored only if the current state becomes invalid, i.e. it doesn't contain any currently defined screens.

UNSTABLE_router? ​

optional UNSTABLE_router?: <Action>(original) => Partial<Router<State, Action>>

A function returning overrides for the underlying router used by the navigator. The overrides will be shallow merged onto the original router. It receives the original router as an argument to the function.

This must be a pure function and cannot reference outside dynamic variables.

Type Parameters ​

Action ​

Action extends NavigationAction

Parameters ​

original ​

Router<State, Action>

Returns ​

Partial<Router<State, Action>>

Type Parameters ​

ParamList ​

ParamList extends ParamListBase

NavigatorID extends string | undefined

State ​

State extends NavigationState

ScreenOptions ​

ScreenOptions extends object

EventMap ​

EventMap extends EventMapBase

Navigation