1 | import type {
|
2 | getActionFromState as getActionFromStateDefault,
|
3 | getPathFromState as getPathFromStateDefault,
|
4 | getStateFromPath as getStateFromPathDefault,
|
5 | PathConfigMap,
|
6 | Route,
|
7 | } from '@react-navigation/core';
|
8 |
|
9 | export type Theme = {
|
10 | dark: boolean;
|
11 | colors: {
|
12 | primary: string;
|
13 | background: string;
|
14 | card: string;
|
15 | text: string;
|
16 | border: string;
|
17 | notification: string;
|
18 | };
|
19 | };
|
20 |
|
21 | export type LinkingOptions<ParamList extends {}> = {
|
22 | /**
|
23 | * Whether deep link handling should be enabled.
|
24 | * Defaults to true.
|
25 | */
|
26 | enabled?: boolean;
|
27 | /**
|
28 | * The prefixes are stripped from the URL before parsing them.
|
29 | * Usually they are the `scheme` + `host` (e.g. `myapp://chat?user=jane`)
|
30 | *
|
31 | * This is not supported on Web.
|
32 | *
|
33 | * @example
|
34 | * ```js
|
35 | * {
|
36 | * prefixes: [
|
37 | * "myapp://", // App-specific scheme
|
38 | * "https://example.com", // Prefix for universal links
|
39 | * "https://*.example.com" // Prefix which matches any subdomain
|
40 | * ]
|
41 | * }
|
42 | * ```
|
43 | */
|
44 | prefixes: string[];
|
45 | /**
|
46 | * Optional function which takes an incoming URL returns a boolean
|
47 | * indicating whether React Navigation should handle it.
|
48 | *
|
49 | * This can be used to disable deep linking for specific URLs.
|
50 | * e.g. URLs used for authentication, and not for deep linking to screens.
|
51 | *
|
52 | * This is not supported on Web.
|
53 | *
|
54 | * @example
|
55 | * ```js
|
56 | * {
|
57 | * // Filter out URLs used by expo-auth-session
|
58 | * filter: (url) => !url.includes('+expo-auth-session')
|
59 | * }
|
60 | * ```
|
61 | */
|
62 | filter?: (url: string) => boolean;
|
63 | /**
|
64 | * Config to fine-tune how to parse the path.
|
65 | *
|
66 | * @example
|
67 | * ```js
|
68 | * {
|
69 | * Chat: {
|
70 | * path: 'chat/:author/:id',
|
71 | * parse: { id: Number }
|
72 | * }
|
73 | * }
|
74 | * ```
|
75 | */
|
76 | config?: {
|
77 | initialRouteName?: keyof ParamList;
|
78 | screens: PathConfigMap<ParamList>;
|
79 | };
|
80 | /**
|
81 | * Custom function to get the initial URL used for linking.
|
82 | * Uses `Linking.getInitialURL()` by default.
|
83 | *
|
84 | * This is not supported on Web.
|
85 | *
|
86 | * @example
|
87 | * ```js
|
88 | * {
|
89 | * getInitialURL () => Linking.getInitialURL(),
|
90 | * }
|
91 | * ```
|
92 | */
|
93 | getInitialURL?: () =>
|
94 | | string
|
95 | | null
|
96 | | undefined
|
97 | | Promise<string | null | undefined>;
|
98 | /**
|
99 | * Custom function to get subscribe to URL updates.
|
100 | * Uses `Linking.addEventListener('url', callback)` by default.
|
101 | *
|
102 | * This is not supported on Web.
|
103 | *
|
104 | * @example
|
105 | * ```js
|
106 | * {
|
107 | * subscribe: (listener) => {
|
108 | * const onReceiveURL = ({ url }) => listener(url);
|
109 | *
|
110 | * Linking.addEventListener('url', onReceiveURL);
|
111 | *
|
112 | * return () => Linking.removeEventListener('url', onReceiveURL);
|
113 | * }
|
114 | * }
|
115 | * ```
|
116 | */
|
117 | subscribe?: (
|
118 | listener: (url: string) => void
|
119 | ) => undefined | void | (() => void);
|
120 | /**
|
121 | * Custom function to parse the URL to a valid navigation state (advanced).
|
122 | */
|
123 | getStateFromPath?: typeof getStateFromPathDefault;
|
124 | /**
|
125 | * Custom function to convert the state object to a valid URL (advanced).
|
126 | * Only applicable on Web.
|
127 | */
|
128 | getPathFromState?: typeof getPathFromStateDefault;
|
129 | /**
|
130 | * Custom function to convert the state object to a valid action (advanced).
|
131 | */
|
132 | getActionFromState?: typeof getActionFromStateDefault;
|
133 | };
|
134 |
|
135 | export type DocumentTitleOptions = {
|
136 | enabled?: boolean;
|
137 | formatter?: (
|
138 | options: Record<string, any> | undefined,
|
139 | route: Route<string> | undefined
|
140 | ) => string;
|
141 | };
|
142 |
|
143 | export type ServerContainerRef = {
|
144 | getCurrentOptions(): Record<string, any> | undefined;
|
145 | };
|