API Reference / @gtkx/navigation / GenericNavigation
Type Alias: GenericNavigation<ParamList>
GenericNavigation<
ParamList> =Omit<NavigationProp<ParamList>,"getState"|"setParams"|"replaceParams"|"setOptions"> &object
A stripped down NavigationProp if the navigator is not known.
The hook can be used in NavigationContainer directly, not inside of a navigator. So navigator specific methods won't be available.
Type Parameters
ParamList
ParamList extends object
Type Declaration
getState()
getState():
Readonly<{history?:unknown[];index:number;key:string;routeNames:Extract<keyofParamList,string>[];routes:NavigationRoute<ParamList, keyofParamList>[];stale:false;type:string; }> |undefined
Returns the navigator's state.
This may return undefined if used outside of a navigator, as the navigator may not have rendered yet
Returns
Readonly<{ history?: unknown[]; index: number; key: string; routeNames: Extract<keyof ParamList, string>[]; routes: NavigationRoute<ParamList, keyof ParamList>[]; stale: false; type: string; }> | undefined
replaceParams()
replaceParams(
params):void
Replace the param object for the route
Parameters
params
unknown
Params object for the current route.
Returns
void
setOptions()
setOptions(
options):void
Update the options for the route. The options object will be shallow merged with default options object.
Parameters
options
unknown
Partial options object for the current screen.
Returns
void
setParams()
setParams(
params):void
Update the param object for the route. The new params will be shallow merged with the old one.
Parameters
params
unknown
Partial params object for the current route.
Returns
void