UNPKG

4.79 kBTypeScriptView Raw
1import type { getActionFromState as getActionFromStateDefault, getPathFromState as getPathFromStateDefault, getStateFromPath as getStateFromPathDefault, PathConfigMap, Route } from '@react-navigation/core';
2declare global {
3 namespace ReactNavigation {
4 interface Theme extends NativeTheme {
5 }
6 }
7}
8type FontStyle = {
9 fontFamily: string;
10 fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
11};
12interface NativeTheme {
13 dark: boolean;
14 colors: {
15 primary: string;
16 background: string;
17 card: string;
18 text: string;
19 border: string;
20 notification: string;
21 };
22 fonts: {
23 regular: FontStyle;
24 medium: FontStyle;
25 bold: FontStyle;
26 heavy: FontStyle;
27 };
28}
29export type Theme = NativeTheme;
30export type LocaleDirection = 'ltr' | 'rtl';
31export type LinkingOptions<ParamList extends {}> = {
32 /**
33 * Whether deep link handling should be enabled.
34 * Defaults to true.
35 */
36 enabled?: boolean;
37 /**
38 * The prefixes are stripped from the URL before parsing them.
39 * Usually they are the `scheme` + `host` (e.g. `myapp://chat?user=jane`)
40 *
41 * This is not supported on Web.
42 *
43 * @example
44 * ```js
45 * {
46 * prefixes: [
47 * "myapp://", // App-specific scheme
48 * "https://example.com", // Prefix for universal links
49 * "https://*.example.com" // Prefix which matches any subdomain
50 * ]
51 * }
52 * ```
53 */
54 prefixes: string[];
55 /**
56 * Optional function which takes an incoming URL returns a boolean
57 * indicating whether React Navigation should handle it.
58 *
59 * This can be used to disable deep linking for specific URLs.
60 * e.g. URLs used for authentication, and not for deep linking to screens.
61 *
62 * This is not supported on Web.
63 *
64 * @example
65 * ```js
66 * {
67 * // Filter out URLs used by expo-auth-session
68 * filter: (url) => !url.includes('+expo-auth-session')
69 * }
70 * ```
71 */
72 filter?: (url: string) => boolean;
73 /**
74 * Config to fine-tune how to parse the path.
75 *
76 * @example
77 * ```js
78 * {
79 * Chat: {
80 * path: 'chat/:author/:id',
81 * parse: { id: Number }
82 * }
83 * }
84 * ```
85 */
86 config?: {
87 /**
88 * Path string to match against for the whole navigation tree.
89 * It's not possible to specify params here since this doesn't belong to a screen.
90 * This is useful when the whole app is under a specific path.
91 * e.g. all of the screens are under `/admin` in `https://example.com/admin`
92 */
93 path?: string;
94 /**
95 * Path configuration for child screens.
96 */
97 screens: PathConfigMap<ParamList>;
98 /**
99 * Name of the initial route to use for the root navigator.
100 */
101 initialRouteName?: keyof ParamList;
102 };
103 /**
104 * Custom function to get the initial URL used for linking.
105 * Uses `Linking.getInitialURL()` by default.
106 *
107 * This is not supported on Web.
108 *
109 * @example
110 * ```js
111 * {
112 * getInitialURL () => Linking.getInitialURL(),
113 * }
114 * ```
115 */
116 getInitialURL?: () => string | null | undefined | Promise<string | null | undefined>;
117 /**
118 * Custom function to get subscribe to URL updates.
119 * Uses `Linking.addEventListener('url', callback)` by default.
120 *
121 * This is not supported on Web.
122 *
123 * @example
124 * ```js
125 * {
126 * subscribe: (listener) => {
127 * const onReceiveURL = ({ url }) => listener(url);
128 *
129 * Linking.addEventListener('url', onReceiveURL);
130 *
131 * return () => Linking.removeEventListener('url', onReceiveURL);
132 * }
133 * }
134 * ```
135 */
136 subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);
137 /**
138 * Custom function to parse the URL to a valid navigation state (advanced).
139 */
140 getStateFromPath?: typeof getStateFromPathDefault;
141 /**
142 * Custom function to convert the state object to a valid URL (advanced).
143 * Only applicable on Web.
144 */
145 getPathFromState?: typeof getPathFromStateDefault;
146 /**
147 * Custom function to convert the state object to a valid action (advanced).
148 */
149 getActionFromState?: typeof getActionFromStateDefault;
150};
151export type DocumentTitleOptions = {
152 enabled?: boolean;
153 formatter?: (options: Record<string, any> | undefined, route: Route<string> | undefined) => string;
154};
155export type ServerContainerRef = {
156 getCurrentOptions(): Record<string, any> | undefined;
157};
158export {};
159//# sourceMappingURL=types.d.ts.map
\No newline at end of file