@react-navigation/elements 3.0.0-alpha.11 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/ActivityView.js +90 -0
- package/lib/module/ActivityView.js.map +1 -0
- package/lib/module/ActivityView.native.js +67 -0
- package/lib/module/ActivityView.native.js.map +1 -0
- package/lib/module/Container.js +3 -0
- package/lib/module/Container.js.map +1 -1
- package/lib/module/Header/Header.js +5 -2
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/getHeaderTitle.js.map +1 -1
- package/lib/module/Label/getLabel.js.map +1 -1
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/Screen.js +1 -1
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/internal.js +1 -1
- package/lib/module/internal.js.map +1 -1
- package/lib/typescript/src/ActivityView.d.ts +31 -0
- package/lib/typescript/src/ActivityView.d.ts.map +1 -0
- package/lib/typescript/src/ActivityView.native.d.ts +3 -0
- package/lib/typescript/src/ActivityView.native.d.ts.map +1 -0
- package/lib/typescript/src/Badge.d.ts +3 -3
- package/lib/typescript/src/Badge.d.ts.map +1 -1
- package/lib/typescript/src/Button.d.ts +2 -2
- package/lib/typescript/src/Button.d.ts.map +1 -1
- package/lib/typescript/src/Container.d.ts +7 -6
- package/lib/typescript/src/Container.d.ts.map +1 -1
- package/lib/typescript/src/Header/Header.d.ts +2 -2
- package/lib/typescript/src/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts +3 -3
- package/lib/typescript/src/Header/HeaderBackground.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts +4 -4
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts +3 -3
- package/lib/typescript/src/Header/HeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Label/getLabel.d.ts +2 -2
- package/lib/typescript/src/Label/getLabel.d.ts.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +12 -12
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts +6 -6
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/internal.d.ts +1 -1
- package/lib/typescript/src/internal.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +65 -65
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/ActivityView.native.tsx +90 -0
- package/src/ActivityView.tsx +129 -0
- package/src/Badge.tsx +3 -3
- package/src/Button.tsx +2 -2
- package/src/Container.tsx +11 -6
- package/src/Header/Header.tsx +19 -12
- package/src/Header/HeaderBackButton.tsx +3 -3
- package/src/Header/HeaderBackground.tsx +3 -3
- package/src/Header/HeaderSearchBar.tsx +4 -4
- package/src/Header/HeaderTitle.tsx +3 -3
- package/src/Header/getHeaderTitle.tsx +4 -1
- package/src/Label/getLabel.tsx +1 -1
- package/src/PlatformPressable.tsx +12 -8
- package/src/Screen.tsx +6 -6
- package/src/internal.tsx +1 -1
- package/src/types.tsx +96 -75
- package/lib/module/Lazy.js +0 -42
- package/lib/module/Lazy.js.map +0 -1
- package/lib/typescript/src/Lazy.d.ts +0 -31
- package/lib/typescript/src/Lazy.d.ts.map +0 -1
- package/src/Lazy.tsx +0 -59
package/src/types.tsx
CHANGED
|
@@ -39,7 +39,7 @@ export type HeaderSearchBarOptions = {
|
|
|
39
39
|
* - `clearText` - removes any text present in the search bar input field
|
|
40
40
|
* - `cancelSearch` - cancel the search and close the search bar
|
|
41
41
|
*/
|
|
42
|
-
ref?: React.Ref<HeaderSearchBarRef
|
|
42
|
+
ref?: React.Ref<HeaderSearchBarRef> | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* The auto-capitalization behavior
|
|
45
45
|
*/
|
|
@@ -48,55 +48,56 @@ export type HeaderSearchBarOptions = {
|
|
|
48
48
|
| 'words'
|
|
49
49
|
| 'sentences'
|
|
50
50
|
| 'characters'
|
|
51
|
-
| 'systemDefault'
|
|
51
|
+
| 'systemDefault'
|
|
52
|
+
| undefined;
|
|
52
53
|
/**
|
|
53
54
|
* Automatically focuses search input on mount
|
|
54
55
|
*/
|
|
55
|
-
autoFocus?: boolean;
|
|
56
|
+
autoFocus?: boolean | undefined;
|
|
56
57
|
/**
|
|
57
58
|
* The text to be used instead of default `Cancel` button text
|
|
58
59
|
*
|
|
59
60
|
* @platform ios
|
|
60
61
|
*/
|
|
61
|
-
cancelButtonText?: string;
|
|
62
|
+
cancelButtonText?: string | undefined;
|
|
62
63
|
/**
|
|
63
64
|
* Sets type of the input. Defaults to `text`.
|
|
64
65
|
*/
|
|
65
|
-
inputType?: 'text' | 'phone' | 'number' | 'email';
|
|
66
|
+
inputType?: 'text' | 'phone' | 'number' | 'email' | undefined;
|
|
66
67
|
/**
|
|
67
68
|
* Determines how the return key should look. Defaults to `search`.
|
|
68
69
|
*/
|
|
69
|
-
enterKeyHint?: TextInputProps['enterKeyHint'];
|
|
70
|
+
enterKeyHint?: TextInputProps['enterKeyHint'] | undefined;
|
|
70
71
|
/**
|
|
71
72
|
* A callback that gets called when search input has lost focus
|
|
72
73
|
*/
|
|
73
|
-
onBlur?: TextInputProps['onBlur'];
|
|
74
|
+
onBlur?: TextInputProps['onBlur'] | undefined;
|
|
74
75
|
/**
|
|
75
76
|
* A callback that gets called when the text changes.
|
|
76
77
|
* It receives the current text value of the search input.
|
|
77
78
|
*/
|
|
78
|
-
onChange?: TextInputProps['onChange'];
|
|
79
|
+
onChange?: TextInputProps['onChange'] | undefined;
|
|
79
80
|
/**
|
|
80
81
|
* Callback that is called when the submit button is pressed.
|
|
81
82
|
* It receives the current text value of the search input.
|
|
82
83
|
*/
|
|
83
|
-
onSubmitEditing?: TextInputProps['onSubmitEditing'];
|
|
84
|
+
onSubmitEditing?: TextInputProps['onSubmitEditing'] | undefined;
|
|
84
85
|
/**
|
|
85
86
|
* A callback that gets called when search input is opened
|
|
86
87
|
*/
|
|
87
|
-
onOpen?: () => void;
|
|
88
|
+
onOpen?: (() => void) | undefined;
|
|
88
89
|
/**
|
|
89
90
|
* A callback that gets called when search input is closed
|
|
90
91
|
*/
|
|
91
|
-
onClose?: () => void;
|
|
92
|
+
onClose?: (() => void) | undefined;
|
|
92
93
|
/**
|
|
93
94
|
* A callback that gets called when search input has received focus
|
|
94
95
|
*/
|
|
95
|
-
onFocus?: TextInputProps['onFocus'];
|
|
96
|
+
onFocus?: TextInputProps['onFocus'] | undefined;
|
|
96
97
|
/**
|
|
97
98
|
* Text displayed when search field is empty
|
|
98
99
|
*/
|
|
99
|
-
placeholder?: string;
|
|
100
|
+
placeholder?: string | undefined;
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
export type HeaderOptions = {
|
|
@@ -107,28 +108,35 @@ export type HeaderOptions = {
|
|
|
107
108
|
* It receives `allowFontScaling`, `tintColor`, `style` and `children` in the options object as an argument.
|
|
108
109
|
* The title string is passed in `children`.
|
|
109
110
|
*/
|
|
110
|
-
headerTitle?:
|
|
111
|
+
headerTitle?:
|
|
112
|
+
| string
|
|
113
|
+
| ((props: HeaderTitleProps) => React.ReactNode)
|
|
114
|
+
| undefined;
|
|
111
115
|
/**
|
|
112
116
|
* How to align the the header title.
|
|
113
117
|
* Defaults to `center` on iOS and `left` on Android.
|
|
114
118
|
*/
|
|
115
|
-
headerTitleAlign?: 'left' | 'center';
|
|
119
|
+
headerTitleAlign?: 'left' | 'center' | undefined;
|
|
116
120
|
/**
|
|
117
121
|
* Style object for the title component.
|
|
118
122
|
*/
|
|
119
|
-
headerTitleStyle?:
|
|
123
|
+
headerTitleStyle?:
|
|
124
|
+
| Animated.WithAnimatedValue<StyleProp<TextStyle>>
|
|
125
|
+
| undefined;
|
|
120
126
|
/**
|
|
121
127
|
* Style object for the container of the `headerTitle` element.
|
|
122
128
|
*/
|
|
123
|
-
headerTitleContainerStyle?:
|
|
129
|
+
headerTitleContainerStyle?:
|
|
130
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
131
|
+
| undefined;
|
|
124
132
|
/**
|
|
125
133
|
* Whether header title font should scale to respect Text Size accessibility settings. Defaults to `false`.
|
|
126
134
|
*/
|
|
127
|
-
headerTitleAllowFontScaling?: boolean;
|
|
135
|
+
headerTitleAllowFontScaling?: boolean | undefined;
|
|
128
136
|
/**
|
|
129
137
|
* Options to render a search bar.
|
|
130
138
|
*/
|
|
131
|
-
headerSearchBarOptions?: HeaderSearchBarOptions;
|
|
139
|
+
headerSearchBarOptions?: HeaderSearchBarOptions | undefined;
|
|
132
140
|
/**
|
|
133
141
|
* How the back button displays icon and title.
|
|
134
142
|
*
|
|
@@ -139,27 +147,31 @@ export type HeaderOptions = {
|
|
|
139
147
|
*
|
|
140
148
|
* Defaults to "default" on iOS, and "minimal" on other platforms.
|
|
141
149
|
*/
|
|
142
|
-
headerBackButtonDisplayMode?: HeaderBackButtonDisplayMode;
|
|
150
|
+
headerBackButtonDisplayMode?: HeaderBackButtonDisplayMode | undefined;
|
|
143
151
|
/**
|
|
144
152
|
* Style object for header back title. Supported properties:
|
|
145
153
|
* - fontFamily
|
|
146
154
|
* - fontSize
|
|
147
155
|
*/
|
|
148
|
-
headerBackTitleStyle?:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
headerBackTitleStyle?:
|
|
157
|
+
| StyleProp<{
|
|
158
|
+
fontFamily?: string | undefined;
|
|
159
|
+
fontSize?: number | undefined;
|
|
160
|
+
}>
|
|
161
|
+
| undefined;
|
|
152
162
|
/**
|
|
153
163
|
* Function which returns a React Element to display on the left side of the header.
|
|
154
164
|
*/
|
|
155
|
-
headerLeft?:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
headerLeft?:
|
|
166
|
+
| ((
|
|
167
|
+
props: HeaderBackButtonProps & {
|
|
168
|
+
/**
|
|
169
|
+
* Whether it's possible to navigate back.
|
|
170
|
+
*/
|
|
171
|
+
canGoBack?: boolean | undefined;
|
|
172
|
+
}
|
|
173
|
+
) => React.ReactNode)
|
|
174
|
+
| undefined;
|
|
163
175
|
/**
|
|
164
176
|
* Whether the liquid glass background is visible for the item.
|
|
165
177
|
*
|
|
@@ -168,20 +180,24 @@ export type HeaderOptions = {
|
|
|
168
180
|
*
|
|
169
181
|
* Defaults to `true`.
|
|
170
182
|
*/
|
|
171
|
-
headerLeftBackgroundVisible?: boolean;
|
|
183
|
+
headerLeftBackgroundVisible?: boolean | undefined;
|
|
172
184
|
/**
|
|
173
185
|
* Style object for the container of the `headerLeft` element`.
|
|
174
186
|
*/
|
|
175
|
-
headerLeftContainerStyle?:
|
|
187
|
+
headerLeftContainerStyle?:
|
|
188
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
189
|
+
| undefined;
|
|
176
190
|
/**
|
|
177
191
|
* Function which returns a React Element to display on the right side of the header.
|
|
178
192
|
*/
|
|
179
|
-
headerRight?:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
193
|
+
headerRight?:
|
|
194
|
+
| ((props: {
|
|
195
|
+
tintColor?: ColorValue | undefined;
|
|
196
|
+
pressColor?: ColorValue | undefined;
|
|
197
|
+
pressOpacity?: number | undefined;
|
|
198
|
+
canGoBack: boolean;
|
|
199
|
+
}) => React.ReactNode)
|
|
200
|
+
| undefined;
|
|
185
201
|
/**
|
|
186
202
|
* Whether the liquid glass background is visible for the item.
|
|
187
203
|
*
|
|
@@ -190,43 +206,47 @@ export type HeaderOptions = {
|
|
|
190
206
|
*
|
|
191
207
|
* Defaults to `true`.
|
|
192
208
|
*/
|
|
193
|
-
headerRightBackgroundVisible?: boolean;
|
|
209
|
+
headerRightBackgroundVisible?: boolean | undefined;
|
|
194
210
|
/**
|
|
195
211
|
* Style object for the container of the `headerRight` element.
|
|
196
212
|
*/
|
|
197
|
-
headerRightContainerStyle?:
|
|
213
|
+
headerRightContainerStyle?:
|
|
214
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
215
|
+
| undefined;
|
|
198
216
|
/**
|
|
199
217
|
* Color for material ripple (Android >= 5.0 only).
|
|
200
218
|
*/
|
|
201
|
-
headerPressColor?: ColorValue;
|
|
219
|
+
headerPressColor?: ColorValue | undefined;
|
|
202
220
|
/**
|
|
203
221
|
* Color for material ripple (Android >= 5.0 only).
|
|
204
222
|
*/
|
|
205
|
-
headerPressOpacity?: number;
|
|
223
|
+
headerPressOpacity?: number | undefined;
|
|
206
224
|
/**
|
|
207
225
|
* Tint color for the header.
|
|
208
226
|
*/
|
|
209
|
-
headerTintColor?: ColorValue;
|
|
227
|
+
headerTintColor?: ColorValue | undefined;
|
|
210
228
|
/**
|
|
211
229
|
* Function which returns a React Element to render as the background of the header.
|
|
212
230
|
* This is useful for using backgrounds such as an image, a gradient, blur effect etc.
|
|
213
231
|
* You can use this with `headerTransparent` to render a blur view, for example, to create a translucent header.
|
|
214
232
|
*/
|
|
215
|
-
headerBackground?:
|
|
216
|
-
|
|
217
|
-
|
|
233
|
+
headerBackground?:
|
|
234
|
+
| ((props: {
|
|
235
|
+
style: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
236
|
+
}) => React.ReactNode)
|
|
237
|
+
| undefined;
|
|
218
238
|
/**
|
|
219
239
|
* Style object for the container of the `headerBackground` element.
|
|
220
240
|
*/
|
|
221
|
-
headerBackgroundContainerStyle?:
|
|
222
|
-
StyleProp<ViewStyle
|
|
223
|
-
|
|
241
|
+
headerBackgroundContainerStyle?:
|
|
242
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
243
|
+
| undefined;
|
|
224
244
|
/**
|
|
225
245
|
* Defaults to `false`. If `true`, the header will not have a background unless you explicitly provide it with `headerBackground`.
|
|
226
246
|
* The header will also float over the screen so that it overlaps the content underneath.
|
|
227
247
|
* This is useful if you want to render a semi-transparent header or a blurred background.
|
|
228
248
|
*/
|
|
229
|
-
headerTransparent?: boolean;
|
|
249
|
+
headerTransparent?: boolean | undefined;
|
|
230
250
|
/**
|
|
231
251
|
* Blur effect for the translucent header.
|
|
232
252
|
* The `headerTransparent` option needs to be set to `true` for this to work.
|
|
@@ -235,11 +255,11 @@ export type HeaderOptions = {
|
|
|
235
255
|
*
|
|
236
256
|
* @platform web
|
|
237
257
|
*/
|
|
238
|
-
headerBlurEffect?: BlurEffectType | 'none';
|
|
258
|
+
headerBlurEffect?: BlurEffectType | 'none' | undefined;
|
|
239
259
|
/**
|
|
240
260
|
* Style object for the header. You can specify a custom background color here, for example.
|
|
241
261
|
*/
|
|
242
|
-
headerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle
|
|
262
|
+
headerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
243
263
|
/**
|
|
244
264
|
* Whether to hide the elevation shadow (Android) or the bottom border (iOS) on the header.
|
|
245
265
|
*
|
|
@@ -256,13 +276,13 @@ export type HeaderOptions = {
|
|
|
256
276
|
* If the above styles are specified in `headerStyle` along with `headerShadowVisible: false`,
|
|
257
277
|
* then `headerShadowVisible: false` will take precedence.
|
|
258
278
|
*/
|
|
259
|
-
headerShadowVisible?: boolean;
|
|
279
|
+
headerShadowVisible?: boolean | undefined;
|
|
260
280
|
/**
|
|
261
281
|
* Extra padding to add at the top of header to account for translucent status bar.
|
|
262
282
|
* By default, it uses the top value from the safe area insets of the device.
|
|
263
283
|
* Pass 0 or a custom value to disable the default behaviour, and customize the height.
|
|
264
284
|
*/
|
|
265
|
-
headerStatusBarHeight?: number;
|
|
285
|
+
headerStatusBarHeight?: number | undefined;
|
|
266
286
|
};
|
|
267
287
|
|
|
268
288
|
export type HeaderTitleProps = {
|
|
@@ -273,58 +293,58 @@ export type HeaderTitleProps = {
|
|
|
273
293
|
/**
|
|
274
294
|
* Whether title font should scale to respect Text Size accessibility settings.
|
|
275
295
|
*/
|
|
276
|
-
allowFontScaling?: boolean;
|
|
296
|
+
allowFontScaling?: boolean | undefined;
|
|
277
297
|
/**
|
|
278
298
|
* Tint color for the header.
|
|
279
299
|
*/
|
|
280
|
-
tintColor?: ColorValue;
|
|
300
|
+
tintColor?: ColorValue | undefined;
|
|
281
301
|
/**
|
|
282
302
|
* Callback to trigger when the size of the title element changes.
|
|
283
303
|
*/
|
|
284
|
-
onLayout?: (e: LayoutChangeEvent) => void;
|
|
304
|
+
onLayout?: ((e: LayoutChangeEvent) => void) | undefined;
|
|
285
305
|
/**
|
|
286
306
|
* Style object for the title element.
|
|
287
307
|
*/
|
|
288
|
-
style?: Animated.WithAnimatedValue<StyleProp<TextStyle
|
|
308
|
+
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | undefined;
|
|
289
309
|
};
|
|
290
310
|
|
|
291
311
|
export type HeaderButtonProps = {
|
|
292
312
|
/**
|
|
293
313
|
* Callback to call when the button is pressed.
|
|
294
314
|
*/
|
|
295
|
-
onPress?: () => void;
|
|
315
|
+
onPress?: (() => void) | undefined;
|
|
296
316
|
/**
|
|
297
317
|
* The `href` to use for the anchor tag on web
|
|
298
318
|
*/
|
|
299
|
-
href?: string;
|
|
319
|
+
href?: string | undefined;
|
|
300
320
|
/**
|
|
301
321
|
* Whether the button is disabled.
|
|
302
322
|
*/
|
|
303
|
-
disabled?: boolean;
|
|
323
|
+
disabled?: boolean | undefined;
|
|
304
324
|
/**
|
|
305
325
|
* Accessibility label for the button for screen readers.
|
|
306
326
|
*/
|
|
307
|
-
accessibilityLabel?: string;
|
|
327
|
+
accessibilityLabel?: string | undefined;
|
|
308
328
|
/**
|
|
309
329
|
* ID to locate this button in tests.
|
|
310
330
|
*/
|
|
311
|
-
testID?: string;
|
|
331
|
+
testID?: string | undefined;
|
|
312
332
|
/**
|
|
313
333
|
* Tint color for the header button.
|
|
314
334
|
*/
|
|
315
|
-
tintColor?: ColorValue;
|
|
335
|
+
tintColor?: ColorValue | undefined;
|
|
316
336
|
/**
|
|
317
337
|
* Color for material ripple (Android >= 5.0 only).
|
|
318
338
|
*/
|
|
319
|
-
pressColor?: ColorValue;
|
|
339
|
+
pressColor?: ColorValue | undefined;
|
|
320
340
|
/**
|
|
321
341
|
* Opacity when the button is pressed, used when ripple is not supported.
|
|
322
342
|
*/
|
|
323
|
-
pressOpacity?: number;
|
|
343
|
+
pressOpacity?: number | undefined;
|
|
324
344
|
/**
|
|
325
345
|
* Style object for the button.
|
|
326
346
|
*/
|
|
327
|
-
style?: StyleProp<ViewStyle
|
|
347
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
328
348
|
/**
|
|
329
349
|
* Content to render for the button. Usually the icon.
|
|
330
350
|
*/
|
|
@@ -360,16 +380,17 @@ export type HeaderBackButtonProps = Omit<HeaderButtonProps, 'children'> & {
|
|
|
360
380
|
*/
|
|
361
381
|
icon?:
|
|
362
382
|
| HeaderIcon
|
|
363
|
-
| ((props: { tintColor: ColorValue | undefined }) => React.ReactNode)
|
|
383
|
+
| ((props: { tintColor: ColorValue | undefined }) => React.ReactNode)
|
|
384
|
+
| undefined;
|
|
364
385
|
/**
|
|
365
386
|
* Label text for the button. Usually the title of the previous screen.
|
|
366
387
|
* By default, this is only shown on iOS.
|
|
367
388
|
*/
|
|
368
|
-
label?: string;
|
|
389
|
+
label?: string | undefined;
|
|
369
390
|
/**
|
|
370
391
|
* Label text to show when there isn't enough space for the full label.
|
|
371
392
|
*/
|
|
372
|
-
truncatedLabel?: string;
|
|
393
|
+
truncatedLabel?: string | undefined;
|
|
373
394
|
/**
|
|
374
395
|
* How the back button displays icon and title.
|
|
375
396
|
*
|
|
@@ -380,13 +401,13 @@ export type HeaderBackButtonProps = Omit<HeaderButtonProps, 'children'> & {
|
|
|
380
401
|
*
|
|
381
402
|
* Defaults to "default" on iOS, and "minimal" on other platforms.
|
|
382
403
|
*/
|
|
383
|
-
displayMode?: HeaderBackButtonDisplayMode;
|
|
404
|
+
displayMode?: HeaderBackButtonDisplayMode | undefined;
|
|
384
405
|
/**
|
|
385
406
|
* Style object for the label.
|
|
386
407
|
*/
|
|
387
|
-
labelStyle?: Animated.WithAnimatedValue<StyleProp<TextStyle
|
|
408
|
+
labelStyle?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | undefined;
|
|
388
409
|
/**
|
|
389
410
|
* Whether label font should scale to respect Text Size accessibility settings.
|
|
390
411
|
*/
|
|
391
|
-
allowFontScaling?: boolean;
|
|
412
|
+
allowFontScaling?: boolean | undefined;
|
|
392
413
|
};
|
package/lib/module/Lazy.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* Render content lazily based on visibility.
|
|
6
|
-
*
|
|
7
|
-
* When enabled:
|
|
8
|
-
* - If content is visible, it will render immediately
|
|
9
|
-
* - If content is not visible, it won't render until it becomes visible
|
|
10
|
-
*
|
|
11
|
-
* Otherwise:
|
|
12
|
-
* - If content is visible, it will render immediately
|
|
13
|
-
* - If content is not visible, it will defer rendering until idle
|
|
14
|
-
*
|
|
15
|
-
* Once rendered, the content remains rendered.
|
|
16
|
-
*/
|
|
17
|
-
export function Lazy({
|
|
18
|
-
enabled,
|
|
19
|
-
visible,
|
|
20
|
-
children
|
|
21
|
-
}) {
|
|
22
|
-
const [rendered, setRendered] = React.useState(enabled ? visible : false);
|
|
23
|
-
const shouldRenderInIdle = !(enabled || visible || rendered);
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
if (shouldRenderInIdle === false) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const id = requestIdleCallback(() => {
|
|
29
|
-
setRendered(true);
|
|
30
|
-
});
|
|
31
|
-
return () => cancelIdleCallback(id);
|
|
32
|
-
}, [shouldRenderInIdle]);
|
|
33
|
-
if (visible && rendered === false) {
|
|
34
|
-
setRendered(true);
|
|
35
|
-
return children;
|
|
36
|
-
}
|
|
37
|
-
if (rendered) {
|
|
38
|
-
return children;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=Lazy.js.map
|
package/lib/module/Lazy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Lazy","enabled","visible","children","rendered","setRendered","useState","shouldRenderInIdle","useEffect","id","requestIdleCallback","cancelIdleCallback"],"sourceRoot":"../../src","sources":["Lazy.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAiB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAE;EAC1D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAACL,OAAO,GAAGC,OAAO,GAAG,KAAK,CAAC;EAEzE,MAAMK,kBAAkB,GAAG,EAAEN,OAAO,IAAIC,OAAO,IAAIE,QAAQ,CAAC;EAE5DL,KAAK,CAACS,SAAS,CAAC,MAAM;IACpB,IAAID,kBAAkB,KAAK,KAAK,EAAE;MAChC;IACF;IAEA,MAAME,EAAE,GAAGC,mBAAmB,CAAC,MAAM;MACnCL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,MAAMM,kBAAkB,CAACF,EAAE,CAAC;EACrC,CAAC,EAAE,CAACF,kBAAkB,CAAC,CAAC;EAExB,IAAIL,OAAO,IAAIE,QAAQ,KAAK,KAAK,EAAE;IACjCC,WAAW,CAAC,IAAI,CAAC;IAEjB,OAAOF,QAAQ;EACjB;EAEA,IAAIC,QAAQ,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
type Props = {
|
|
3
|
-
/**
|
|
4
|
-
* Whether lazy rendering is enabled.
|
|
5
|
-
*/
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the component is visible.
|
|
9
|
-
*/
|
|
10
|
-
visible: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Content to render.
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactElement;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Render content lazily based on visibility.
|
|
18
|
-
*
|
|
19
|
-
* When enabled:
|
|
20
|
-
* - If content is visible, it will render immediately
|
|
21
|
-
* - If content is not visible, it won't render until it becomes visible
|
|
22
|
-
*
|
|
23
|
-
* Otherwise:
|
|
24
|
-
* - If content is visible, it will render immediately
|
|
25
|
-
* - If content is not visible, it will defer rendering until idle
|
|
26
|
-
*
|
|
27
|
-
* Once rendered, the content remains rendered.
|
|
28
|
-
*/
|
|
29
|
-
export declare function Lazy({ enabled, visible, children }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=Lazy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Lazy.d.ts","sourceRoot":"","sources":["../../../src/Lazy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,KAAK,GAAG;IACX;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,iFA4BzD"}
|
package/src/Lazy.tsx
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
/**
|
|
5
|
-
* Whether lazy rendering is enabled.
|
|
6
|
-
*/
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Whether the component is visible.
|
|
10
|
-
*/
|
|
11
|
-
visible: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Content to render.
|
|
14
|
-
*/
|
|
15
|
-
children: React.ReactElement;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Render content lazily based on visibility.
|
|
20
|
-
*
|
|
21
|
-
* When enabled:
|
|
22
|
-
* - If content is visible, it will render immediately
|
|
23
|
-
* - If content is not visible, it won't render until it becomes visible
|
|
24
|
-
*
|
|
25
|
-
* Otherwise:
|
|
26
|
-
* - If content is visible, it will render immediately
|
|
27
|
-
* - If content is not visible, it will defer rendering until idle
|
|
28
|
-
*
|
|
29
|
-
* Once rendered, the content remains rendered.
|
|
30
|
-
*/
|
|
31
|
-
export function Lazy({ enabled, visible, children }: Props) {
|
|
32
|
-
const [rendered, setRendered] = React.useState(enabled ? visible : false);
|
|
33
|
-
|
|
34
|
-
const shouldRenderInIdle = !(enabled || visible || rendered);
|
|
35
|
-
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
if (shouldRenderInIdle === false) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const id = requestIdleCallback(() => {
|
|
42
|
-
setRendered(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return () => cancelIdleCallback(id);
|
|
46
|
-
}, [shouldRenderInIdle]);
|
|
47
|
-
|
|
48
|
-
if (visible && rendered === false) {
|
|
49
|
-
setRendered(true);
|
|
50
|
-
|
|
51
|
-
return children;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (rendered) {
|
|
55
|
-
return children;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return null;
|
|
59
|
-
}
|