1 | import type { NavigationAction, NavigationState, ParamListBase, Router } from '@react-navigation/routers';
|
2 | import { AddKeyedListener, AddListener } from './NavigationBuilderContext';
|
3 | import type { Descriptor, EventMapBase, NavigationHelpers, NavigationProp, RouteConfig, RouteProp } from './types';
|
4 | import type { NavigationEventEmitter } from './useEventEmitter';
|
5 | export declare type ScreenConfigWithParent<State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase> = {
|
6 | keys: (string | undefined)[];
|
7 | options: (ScreenOptionsOrCallback<ScreenOptions> | undefined)[] | undefined;
|
8 | props: RouteConfig<ParamListBase, string, State, ScreenOptions, EventMap>;
|
9 | };
|
10 | declare type ScreenOptionsOrCallback<ScreenOptions extends {}> = ScreenOptions | ((props: {
|
11 | route: RouteProp<ParamListBase, string>;
|
12 | navigation: any;
|
13 | }) => ScreenOptions);
|
14 | declare type Options<State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase> = {
|
15 | state: State;
|
16 | screens: Record<string, ScreenConfigWithParent<State, ScreenOptions, EventMap>>;
|
17 | navigation: NavigationHelpers<ParamListBase>;
|
18 | screenOptions?: ScreenOptionsOrCallback<ScreenOptions>;
|
19 | defaultScreenOptions?: ScreenOptions | ((props: {
|
20 | route: RouteProp<ParamListBase>;
|
21 | navigation: any;
|
22 | options: ScreenOptions;
|
23 | }) => ScreenOptions);
|
24 | onAction: (action: NavigationAction) => boolean;
|
25 | getState: () => State;
|
26 | setState: (state: State) => void;
|
27 | addListener: AddListener;
|
28 | addKeyedListener: AddKeyedListener;
|
29 | onRouteFocus: (key: string) => void;
|
30 | router: Router<State, NavigationAction>;
|
31 | emitter: NavigationEventEmitter<EventMap>;
|
32 | };
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | export default function useDescriptors<State extends NavigationState, ActionHelpers extends Record<string, () => void>, ScreenOptions extends {}, EventMap extends EventMapBase>({ state, screens, navigation, screenOptions, defaultScreenOptions, onAction, getState, setState, addListener, addKeyedListener, onRouteFocus, router, emitter, }: Options<State, ScreenOptions, EventMap>): Record<string, Descriptor<ScreenOptions, Omit<{
|
42 | dispatch(action: Readonly<{
|
43 | type: string;
|
44 | payload?: object | undefined;
|
45 | source?: string | undefined;
|
46 | target?: string | undefined;
|
47 | }> | ((state: State) => Readonly<{
|
48 | type: string;
|
49 | payload?: object | undefined;
|
50 | source?: string | undefined;
|
51 | target?: string | undefined;
|
52 | }>)): void;
|
53 | navigate<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName] | [screen: RouteName, params: object | undefined] : never): void;
|
54 | navigate<RouteName_1 extends string>(options: RouteName_1 extends unknown ? {
|
55 | key: string;
|
56 | params?: object | undefined;
|
57 | merge?: boolean | undefined;
|
58 | } | {
|
59 | name: RouteName_1;
|
60 | key?: string | undefined;
|
61 | params: object | undefined;
|
62 | merge?: boolean | undefined;
|
63 | } : never): void;
|
64 | reset(state: State | import("@react-navigation/routers").PartialState<State>): void;
|
65 | goBack(): void;
|
66 | isFocused(): boolean;
|
67 | canGoBack(): boolean;
|
68 | getId(): string | undefined;
|
69 | getParent<T = NavigationHelpers<ParamListBase, {}> | undefined>(id?: string | undefined): T;
|
70 | getState(): State;
|
71 | } & import("./types").PrivateValueStore<[ParamListBase, unknown, unknown]>, "getParent"> & {
|
72 | getParent<T_1 = NavigationProp<ParamListBase, string, undefined, Readonly<{
|
73 | key: string;
|
74 | index: number;
|
75 | routeNames: string[];
|
76 | history?: unknown[] | undefined;
|
77 | routes: (Readonly<{
|
78 | key: string;
|
79 | name: string;
|
80 | path?: string | undefined;
|
81 | }> & Readonly<{
|
82 | params?: Readonly<object | undefined>;
|
83 | }> & {
|
84 | state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
85 | })[];
|
86 | type: string;
|
87 | stale: false;
|
88 | }>, {}, {}> | undefined>(id?: string | undefined): T_1;
|
89 | setParams(params: Partial<object | undefined>): void;
|
90 | setOptions(options: Partial<ScreenOptions>): void;
|
91 | } & import("./types").EventConsumer<EventMap & import("./types").EventMapCore<State>> & import("./types").PrivateValueStore<[ParamListBase, string, EventMap]> & ActionHelpers, RouteProp<ParamListBase, string>>>;
|
92 | export {};
|
93 | //# sourceMappingURL=useDescriptors.d.ts.map |
\ | No newline at end of file |