UNPKG

3.77 kBTypeScriptView Raw
1import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, 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<ParamList extends {}> = {
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 *
23 * This is not supported on Web.
24 *
25 * @example
26 * ```js
27 * {
28 * prefixes: [
29 * "myapp://", // App-specific scheme
30 * "https://example.com", // Prefix for universal links
31 * "https://*.example.com" // Prefix which matches any subdomain
32 * ]
33 * }
34 * ```
35 */
36 prefixes: string[];
37 /**
38 * Optional function which takes an incoming URL returns a boolean
39 * indicating whether React Navigation should handle it.
40 *
41 * This can be used to disable deep linking for specific URLs.
42 * e.g. URLs used for authentication, and not for deep linking to screens.
43 *
44 * This is not supported on Web.
45 *
46 * @example
47 * ```js
48 * {
49 * // Filter out URLs used by expo-auth-session
50 * filter: (url) => !url.includes('+expo-auth-session')
51 * }
52 * ```
53 */
54 filter?: (url: string) => boolean;
55 /**
56 * Config to fine-tune how to parse the path.
57 *
58 * @example
59 * ```js
60 * {
61 * Chat: {
62 * path: 'chat/:author/:id',
63 * parse: { id: Number }
64 * }
65 * }
66 * ```
67 */
68 config?: {
69 initialRouteName?: keyof ParamList;
70 screens: PathConfigMap<ParamList>;
71 };
72 /**
73 * Custom function to get the initial URL used for linking.
74 * Uses `Linking.getInitialURL()` by default.
75 *
76 * This is not supported on Web.
77 *
78 * @example
79 * ```js
80 * {
81 * getInitialURL () => Linking.getInitialURL(),
82 * }
83 * ```
84 */
85 getInitialURL?: () => string | null | undefined | Promise<string | null | undefined>;
86 /**
87 * Custom function to get subscribe to URL updates.
88 * Uses `Linking.addEventListener('url', callback)` by default.
89 *
90 * This is not supported on Web.
91 *
92 * @example
93 * ```js
94 * {
95 * subscribe: (listener) => {
96 * const onReceiveURL = ({ url }) => listener(url);
97 *
98 * Linking.addEventListener('url', onReceiveURL);
99 *
100 * return () => Linking.removeEventListener('url', onReceiveURL);
101 * }
102 * }
103 * ```
104 */
105 subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);
106 /**
107 * Custom function to parse the URL to a valid navigation state (advanced).
108 */
109 getStateFromPath?: typeof getStateFromPathDefault;
110 /**
111 * Custom function to convert the state object to a valid URL (advanced).
112 * Only applicable on Web.
113 */
114 getPathFromState?: typeof getPathFromStateDefault;
115 /**
116 * Custom function to convert the state object to a valid action (advanced).
117 */
118 getActionFromState?: typeof getActionFromStateDefault;
119};
120export declare type DocumentTitleOptions = {
121 enabled?: boolean;
122 formatter?: (options: Record<string, any> | undefined, route: Route<string> | undefined) => string;
123};
124export declare type ServerContainerRef = {
125 getCurrentOptions(): Record<string, any> | undefined;
126};