UNPKG

3.4 kBTypeScriptView Raw
1import type { getStateFromPath as getStateFromPathDefault, getPathFromState as getPathFromStateDefault, getActionFromState as getActionFromStateDefault, PathConfigMap, Route } from '@react-navigation/core';
2export declare type Theme = {
3 dark: boolean;
4 colors: {
5 primary: string;
6 background: string;
7 card: string;
8 text: string;
9 border: string;
10 notification: string;
11 };
12};
13export declare type LinkingOptions = {
14 /**
15 * Whether deep link handling should be enabled.
16 * Defaults to true.
17 */
18 enabled?: boolean;
19 /**
20 * The prefixes are stripped from the URL before parsing them.
21 * Usually they are the `scheme` + `host` (e.g. `myapp://chat?user=jane`)
22 * Only applicable on Android and iOS.
23 *
24 * @example
25 * ```js
26 * {
27 * prefixes: [
28 * "myapp://", // App-specific scheme
29 * "https://example.com", // Prefix for universal links
30 * "https://*.example.com" // Prefix which matches any subdomain
31 * ]
32 * }
33 * ```
34 */
35 prefixes: string[];
36 /**
37 * Config to fine-tune how to parse the path.
38 *
39 * @example
40 * ```js
41 * {
42 * Chat: {
43 * path: 'chat/:author/:id',
44 * parse: { id: Number }
45 * }
46 * }
47 * ```
48 */
49 config?: {
50 initialRouteName?: string;
51 screens: PathConfigMap;
52 };
53 /**
54 * Custom function to get the initial URL used for linking.
55 * Uses `Linking.getInitialURL()` by default.
56 * Not supported on Web.
57 *
58 * @example
59 * ```js
60 * {
61 * getInitialURL () => Linking.getInitialURL(),
62 * }
63 * ```
64 */
65 getInitialURL?: () => string | null | undefined | Promise<string | null | undefined>;
66 /**
67 * Custom function to get subscribe to URL updates.
68 * Uses `Linking.addEventListener('url', callback)` by default.
69 * Not supported on Web.
70 *
71 * @example
72 * ```js
73 * {
74 * subscribe: (listener) => {
75 * const onReceiveURL = ({ url }) => listener(url);
76 *
77 * Linking.addEventListener('url', onReceiveURL);
78 *
79 * return () => Linking.removeEventListener('url', onReceiveURL);
80 * }
81 * }
82 * ```
83 */
84 subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);
85 /**
86 * Custom function to parse the URL to a valid navigation state (advanced).
87 * This state object will be passed as `initialState` for initial URL,
88 * and converted to an action object to `dispatch` for subsequent URLs.
89 */
90 getStateFromPath?: typeof getStateFromPathDefault;
91 /**
92 * Custom function to convert the state object to an action to dispatch (advanced).
93 * By default, the state is converted to a `NAVIGATE` action.
94 */
95 getActionFromState?: typeof getActionFromStateDefault;
96 /**
97 * Custom function to convert the state object to a valid URL (advanced).
98 * Used for creating links for navigation, primarily useful on Web.
99 */
100 getPathFromState?: typeof getPathFromStateDefault;
101};
102export declare type DocumentTitleOptions = {
103 enabled?: boolean;
104 formatter?: (options: Record<string, any> | undefined, route: Route<string> | undefined) => string;
105};
106export declare type ServerContainerRef = {
107 getCurrentOptions(): Record<string, any> | undefined;
108};