1 | import type { NavigationState, PartialState } from '@react-navigation/routers';
|
2 | import type { PathConfigMap } from './types';
|
3 | type Options<ParamList extends {}> = {
|
4 | initialRouteName?: string;
|
5 | screens: PathConfigMap<ParamList>;
|
6 | };
|
7 | type ResultState = PartialState<NavigationState> & {
|
8 | state?: ResultState;
|
9 | };
|
10 | /**
|
11 | * Utility to parse a path string to initial state object accepted by the container.
|
12 | * This is useful for deep linking when we need to handle the incoming URL.
|
13 | *
|
14 | * @example
|
15 | * ```js
|
16 | * getStateFromPath(
|
17 | * '/chat/jane/42',
|
18 | * {
|
19 | * screens: {
|
20 | * Chat: {
|
21 | * path: 'chat/:author/:id',
|
22 | * parse: { id: Number }
|
23 | * }
|
24 | * }
|
25 | * }
|
26 | * )
|
27 | * ```
|
28 | * @param path Path string to parse and convert, e.g. /foo/bar?count=42.
|
29 | * @param options Extra options to fine-tune how to parse the path.
|
30 | */
|
31 | export default function getStateFromPath<ParamList extends {}>(path: string, options?: Options<ParamList>): ResultState | undefined;
|
32 | export {};
|
33 | //# sourceMappingURL=getStateFromPath.d.ts.map |
\ | No newline at end of file |