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