@react-navigation/native-stack 8.0.0-alpha.3 → 8.0.0-alpha.30

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.
Files changed (28) hide show
  1. package/lib/module/index.js.map +1 -1
  2. package/lib/module/navigators/createNativeStackNavigator.js +4 -8
  3. package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
  4. package/lib/module/utils/useAnimatedHeaderHeight.js +1 -1
  5. package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -1
  6. package/lib/module/views/NativeStackView.js +34 -24
  7. package/lib/module/views/NativeStackView.js.map +1 -1
  8. package/lib/module/views/NativeStackView.native.js +92 -68
  9. package/lib/module/views/NativeStackView.native.js.map +1 -1
  10. package/lib/module/views/useHeaderConfigProps.js +71 -21
  11. package/lib/module/views/useHeaderConfigProps.js.map +1 -1
  12. package/lib/typescript/src/index.d.ts +1 -1
  13. package/lib/typescript/src/index.d.ts.map +1 -1
  14. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +8 -14
  15. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
  16. package/lib/typescript/src/types.d.ts +181 -146
  17. package/lib/typescript/src/types.d.ts.map +1 -1
  18. package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
  19. package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
  20. package/lib/typescript/src/views/useHeaderConfigProps.d.ts.map +1 -1
  21. package/package.json +17 -18
  22. package/src/index.tsx +1 -0
  23. package/src/navigators/createNativeStackNavigator.tsx +11 -47
  24. package/src/types.tsx +242 -184
  25. package/src/utils/useAnimatedHeaderHeight.tsx +1 -1
  26. package/src/views/NativeStackView.native.tsx +135 -89
  27. package/src/views/NativeStackView.tsx +52 -40
  28. package/src/views/useHeaderConfigProps.tsx +100 -36
@@ -1,7 +1,8 @@
1
+ import type { Icon } from '@react-navigation/elements';
1
2
  import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, Route, RouteProp, StackActionHelpers, StackNavigationState, StackRouterOptions, Theme } from '@react-navigation/native';
2
- import type { ColorValue, ImageSourcePropType, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ import * as React from 'react';
4
+ import type { ColorValue, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
5
  import type { ScreenProps, ScreenStackHeaderConfigProps, ScrollEdgeEffect, SearchBarProps } from 'react-native-screens';
4
- import type { SFSymbol } from 'sf-symbols-typescript';
5
6
  export type NativeStackNavigationEventMap = {
6
7
  /**
7
8
  * Event which fires when a transition animation starts.
@@ -63,7 +64,7 @@ export type NativeStackHeaderProps = {
63
64
  * The `href` to use for the anchor tag on web
64
65
  */
65
66
  href: string | undefined;
66
- };
67
+ } | undefined;
67
68
  /**
68
69
  * Options for the current screen.
69
70
  */
@@ -81,22 +82,22 @@ export type NativeStackHeaderItemProps = {
81
82
  /**
82
83
  * Tint color for the header.
83
84
  */
84
- tintColor?: ColorValue;
85
+ tintColor?: ColorValue | undefined;
85
86
  /**
86
87
  * Whether it's possible to navigate back in stack.
87
88
  */
88
- canGoBack?: boolean;
89
+ canGoBack?: boolean | undefined;
89
90
  };
90
91
  export type NativeStackHeaderBackProps = NativeStackHeaderItemProps & {
91
92
  /**
92
93
  * Label text for the button. Usually the title of the previous screen.
93
94
  * By default, this is only shown on iOS 18.
94
95
  */
95
- label?: string;
96
+ label?: string | undefined;
96
97
  /**
97
98
  * The `href` to use for the anchor tag on web
98
99
  */
99
- href?: string;
100
+ href?: string | undefined;
100
101
  };
101
102
  /**
102
103
  * @deprecated Use `NativeStackHeaderBackProps` instead.
@@ -110,18 +111,18 @@ export type NativeStackNavigationOptions = {
110
111
  /**
111
112
  * String that can be displayed in the header as a fallback for `headerTitle`.
112
113
  */
113
- title?: string;
114
+ title?: string | undefined;
114
115
  /**
115
116
  * Function that given `HeaderProps` returns a React Element to display as a header.
116
117
  */
117
- header?: (props: NativeStackHeaderProps) => React.ReactNode;
118
+ header?: ((props: NativeStackHeaderProps) => React.ReactNode) | undefined;
118
119
  /**
119
120
  * Whether the back button is visible in the header.
120
121
  * You can use it to show a back button alongside `headerLeft` if you have specified it.
121
122
  *
122
123
  * This will have no effect on the first screen in the stack.
123
124
  */
124
- headerBackVisible?: boolean;
125
+ headerBackVisible?: boolean | undefined;
125
126
  /**
126
127
  * Title string used by the back button on iOS.
127
128
  * Defaults to the previous scene's title.
@@ -133,7 +134,7 @@ export type NativeStackNavigationOptions = {
133
134
  *
134
135
  * @platform ios, web
135
136
  */
136
- headerBackTitle?: string;
137
+ headerBackTitle?: string | undefined;
137
138
  /**
138
139
  * Style object for header back title. Supported properties:
139
140
  * - fontFamily
@@ -144,11 +145,17 @@ export type NativeStackNavigationOptions = {
144
145
  * @platform ios, web
145
146
  */
146
147
  headerBackTitleStyle?: StyleProp<{
147
- fontFamily?: string;
148
- fontSize?: number;
149
- }>;
148
+ fontFamily?: string | undefined;
149
+ fontSize?: number | undefined;
150
+ }> | undefined;
150
151
  /**
151
- * Icon to display in the header as the icon in the back button.
152
+ * Icon to display in the header in the back button.
153
+ *
154
+ * Supported types:
155
+ * - image: custom image source
156
+ * - sfSymbol: SF Symbol icon (iOS only - when using custom header)
157
+ * - materialSymbol: material symbol icon (Android only)
158
+ *
152
159
  * Defaults to back icon image for the platform
153
160
  * - A chevron on iOS
154
161
  * - An arrow on Android
@@ -161,10 +168,7 @@ export type NativeStackNavigationOptions = {
161
168
  * }
162
169
  * ```
163
170
  */
164
- headerBackIcon?: {
165
- type: 'image';
166
- source: ImageSourcePropType;
167
- };
171
+ headerBackIcon?: Icon | undefined;
168
172
  /**
169
173
  * Style of the header when a large title is shown.
170
174
  * The large title is shown if `headerLargeTitleEnabled` is `true` and
@@ -178,8 +182,8 @@ export type NativeStackNavigationOptions = {
178
182
  * @platform ios
179
183
  */
180
184
  headerLargeStyle?: StyleProp<{
181
- backgroundColor?: ColorValue;
182
- }>;
185
+ backgroundColor?: ColorValue | undefined;
186
+ }> | undefined;
183
187
  /**
184
188
  * Whether to enable header with large title which collapses to regular header on scroll.
185
189
  *
@@ -191,7 +195,7 @@ export type NativeStackNavigationOptions = {
191
195
  *
192
196
  * @platform ios
193
197
  */
194
- headerLargeTitleEnabled?: boolean;
198
+ headerLargeTitleEnabled?: boolean | undefined;
195
199
  /**
196
200
  * Whether drop shadow of header is visible when a large title is shown.
197
201
  *
@@ -199,7 +203,7 @@ export type NativeStackNavigationOptions = {
199
203
  *
200
204
  * @platform ios
201
205
  */
202
- headerLargeTitleShadowVisible?: boolean;
206
+ headerLargeTitleShadowVisible?: boolean | undefined;
203
207
  /**
204
208
  * Style object for large title in header. Supported properties:
205
209
  * - fontFamily
@@ -212,33 +216,33 @@ export type NativeStackNavigationOptions = {
212
216
  * @platform ios
213
217
  */
214
218
  headerLargeTitleStyle?: StyleProp<{
215
- fontFamily?: string;
216
- fontSize?: number;
217
- fontWeight?: string;
218
- color?: ColorValue;
219
- }>;
219
+ fontFamily?: string | undefined;
220
+ fontSize?: number | undefined;
221
+ fontWeight?: string | undefined;
222
+ color?: ColorValue | undefined;
223
+ }> | undefined;
220
224
  /**
221
225
  * Whether to show the header. The header is shown by default.
222
226
  * Setting this to `false` hides the header.
223
227
  */
224
- headerShown?: boolean;
228
+ headerShown?: boolean | undefined;
225
229
  /**
226
230
  * Style object for header. Supported properties:
227
231
  * - backgroundColor
228
232
  */
229
233
  headerStyle?: StyleProp<{
230
- backgroundColor?: ColorValue;
231
- }>;
234
+ backgroundColor?: ColorValue | undefined;
235
+ }> | undefined;
232
236
  /**
233
237
  * Whether to hide the elevation shadow (Android) or the bottom border (iOS) on the header.
234
238
  */
235
- headerShadowVisible?: boolean;
239
+ headerShadowVisible?: boolean | undefined;
236
240
  /**
237
241
  * Boolean indicating whether the navigation bar is translucent.
238
242
  * Setting this to `true` makes the header absolutely positioned,
239
243
  * and changes the background color to `transparent` unless specified in `headerStyle`.
240
244
  */
241
- headerTransparent?: boolean;
245
+ headerTransparent?: boolean | undefined;
242
246
  /**
243
247
  * Blur effect for the translucent header.
244
248
  * The `headerTransparent` option needs to be set to `true` for this to work.
@@ -249,23 +253,23 @@ export type NativeStackNavigationOptions = {
249
253
  *
250
254
  * @platform ios
251
255
  */
252
- headerBlurEffect?: ScreenStackHeaderConfigProps['blurEffect'];
256
+ headerBlurEffect?: ScreenStackHeaderConfigProps['blurEffect'] | undefined;
253
257
  /**
254
258
  * Tint color for the header. Changes the color of back button and title.
255
259
  */
256
- headerTintColor?: ColorValue;
260
+ headerTintColor?: ColorValue | undefined;
257
261
  /**
258
262
  * Function which returns a React Element to render as the background of the header.
259
263
  * This is useful for using backgrounds such as an image, a gradient, blur effect etc.
260
264
  * You can use this with `headerTransparent` to render content underneath a translucent header.
261
265
  */
262
- headerBackground?: () => React.ReactNode;
266
+ headerBackground?: (() => React.ReactNode) | undefined;
263
267
  /**
264
268
  * Function which returns a React Element to display on the left side of the header.
265
269
  * This replaces the back button. See `headerBackVisible` to show the back button along side left element.
266
270
  * Will be overriden by `headerLeftItems` on iOS.
267
271
  */
268
- headerLeft?: (props: NativeStackHeaderBackProps) => React.ReactNode;
272
+ headerLeft?: ((props: NativeStackHeaderBackProps) => React.ReactNode) | undefined;
269
273
  /**
270
274
  * Whether the liquid glass background is visible for the item.
271
275
  *
@@ -274,12 +278,12 @@ export type NativeStackNavigationOptions = {
274
278
  *
275
279
  * Defaults to `true`.
276
280
  */
277
- headerLeftBackgroundVisible?: boolean;
281
+ headerLeftBackgroundVisible?: boolean | undefined;
278
282
  /**
279
283
  * Function which returns a React Element to display on the right side of the header.
280
284
  * Will be overriden by `headerRightItems` on iOS.
281
285
  */
282
- headerRight?: (props: NativeStackHeaderItemProps) => React.ReactNode;
286
+ headerRight?: ((props: NativeStackHeaderItemProps) => React.ReactNode) | undefined;
283
287
  /**
284
288
  * Whether the liquid glass background is visible for the item.
285
289
  *
@@ -288,7 +292,7 @@ export type NativeStackNavigationOptions = {
288
292
  *
289
293
  * Defaults to `true`.
290
294
  */
291
- headerRightBackgroundVisible?: boolean;
295
+ headerRightBackgroundVisible?: boolean | undefined;
292
296
  /**
293
297
  * Function which returns an array of items to display as on the left side of the header.
294
298
  * Overrides `headerLeft`.
@@ -297,7 +301,7 @@ export type NativeStackNavigationOptions = {
297
301
  *
298
302
  * @platform ios
299
303
  */
300
- unstable_headerLeftItems?: (props: NativeStackHeaderItemProps) => NativeStackHeaderItem[];
304
+ unstable_headerLeftItems?: ((props: NativeStackHeaderItemProps) => NativeStackHeaderItem[]) | undefined;
301
305
  /**
302
306
  * Function which returns an array of items to display as on the right side of the header.
303
307
  * Overrides `headerRight`.
@@ -306,7 +310,7 @@ export type NativeStackNavigationOptions = {
306
310
  *
307
311
  * @platform ios
308
312
  */
309
- unstable_headerRightItems?: (props: NativeStackHeaderItemProps) => NativeStackHeaderItem[];
313
+ unstable_headerRightItems?: ((props: NativeStackHeaderItemProps) => NativeStackHeaderItem[]) | undefined;
310
314
  /**
311
315
  * String or a function that returns a React Element to be used by the header.
312
316
  * Defaults to screen `title` or route name.
@@ -324,15 +328,15 @@ export type NativeStackNavigationOptions = {
324
328
  /**
325
329
  * Tint color for the header.
326
330
  */
327
- tintColor?: ColorValue;
328
- }) => React.ReactNode);
331
+ tintColor?: ColorValue | undefined;
332
+ }) => React.ReactNode) | undefined;
329
333
  /**
330
334
  * How to align the the header title.
331
335
  * Defaults to `left` on platforms other than iOS.
332
336
  *
333
337
  * Not supported on iOS. It's always `center` on iOS and cannot be changed.
334
338
  */
335
- headerTitleAlign?: 'left' | 'center';
339
+ headerTitleAlign?: 'left' | 'center' | undefined;
336
340
  /**
337
341
  * Style object for header title. Supported properties:
338
342
  * - fontFamily
@@ -341,16 +345,16 @@ export type NativeStackNavigationOptions = {
341
345
  * - color
342
346
  */
343
347
  headerTitleStyle?: StyleProp<Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight'> & {
344
- color?: ColorValue;
345
- }>;
348
+ color?: ColorValue | undefined;
349
+ }> | undefined;
346
350
  /**
347
351
  * Options to render a native search bar.
348
352
  * You also need to specify `contentInsetAdjustmentBehavior="automatic"` in your `ScrollView`, `FlatList` etc.
349
353
  * If you don't have a `ScrollView`, specify `headerTransparent: false`.
350
354
  */
351
- headerSearchBarOptions?: Omit<SearchBarProps, 'onChangeText'> & {
352
- onChange?: SearchBarProps['onChangeText'];
353
- };
355
+ headerSearchBarOptions?: (Omit<SearchBarProps, 'onChangeText'> & {
356
+ onChange?: SearchBarProps['onChangeText'] | undefined;
357
+ }) | undefined;
354
358
  /**
355
359
  * Boolean indicating whether to show the menu on longPress of iOS >= 14 back button. Defaults to `true`.
356
360
  * Requires `react-native-screens` version >=3.3.0.
@@ -359,7 +363,7 @@ export type NativeStackNavigationOptions = {
359
363
  *
360
364
  * @platform ios
361
365
  */
362
- headerBackButtonMenuEnabled?: boolean;
366
+ headerBackButtonMenuEnabled?: boolean | undefined;
363
367
  /**
364
368
  * How the back button displays icon and title.
365
369
  *
@@ -381,25 +385,25 @@ export type NativeStackNavigationOptions = {
381
385
  *
382
386
  * @platform ios, web
383
387
  */
384
- headerBackButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];
388
+ headerBackButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'] | undefined;
385
389
  /**
386
390
  * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
387
391
  *
388
392
  * @platform ios
389
393
  */
390
- autoHideHomeIndicator?: boolean;
394
+ autoHideHomeIndicator?: boolean | undefined;
391
395
  /**
392
396
  * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
393
397
  *
394
398
  * @platform ios
395
399
  */
396
- keyboardHandlingEnabled?: boolean;
400
+ keyboardHandlingEnabled?: boolean | undefined;
397
401
  /**
398
402
  * Sets the visibility of the navigation bar. Defaults to `false`.
399
403
  *
400
404
  * @platform android
401
405
  */
402
- navigationBarHidden?: boolean;
406
+ navigationBarHidden?: boolean | undefined;
403
407
  /**
404
408
  * Sets the status bar animation (similar to the `StatusBar` component).
405
409
  * On Android, setting either `fade` or `slide` will set the transition of status bar color. On iOS, this option applies to appereance animation of the status bar.
@@ -411,7 +415,7 @@ export type NativeStackNavigationOptions = {
411
415
  *
412
416
  * @platform android, ios
413
417
  */
414
- statusBarAnimation?: ScreenProps['statusBarAnimation'];
418
+ statusBarAnimation?: ScreenProps['statusBarAnimation'] | undefined;
415
419
  /**
416
420
  * Whether the status bar should be hidden on this screen.
417
421
  * Requires setting `View controller-based status bar appearance -> YES` in your Info.plist file.
@@ -420,7 +424,7 @@ export type NativeStackNavigationOptions = {
420
424
  *
421
425
  * @platform android, ios
422
426
  */
423
- statusBarHidden?: boolean;
427
+ statusBarHidden?: boolean | undefined;
424
428
  /**
425
429
  * Sets the status bar color (similar to the `StatusBar` component).
426
430
  * Requires setting `View controller-based status bar appearance -> YES` (or removing the config) in your `Info.plist` file.
@@ -432,7 +436,7 @@ export type NativeStackNavigationOptions = {
432
436
  *
433
437
  * @platform android, ios
434
438
  */
435
- statusBarStyle?: ScreenProps['statusBarStyle'];
439
+ statusBarStyle?: ScreenProps['statusBarStyle'] | undefined;
436
440
  /**
437
441
  * Sets the direction in which you should swipe to dismiss the screen.
438
442
  * When using `vertical` option, options `fullScreenGestureEnabled: true`, `animationMatchesGesture: true` and `animation: 'slide_from_bottom'` are set by default.
@@ -443,11 +447,11 @@ export type NativeStackNavigationOptions = {
443
447
  *
444
448
  * @platform ios
445
449
  */
446
- gestureDirection?: ScreenProps['swipeDirection'];
450
+ gestureDirection?: ScreenProps['swipeDirection'] | undefined;
447
451
  /**
448
452
  * Style object for the scene content.
449
453
  */
450
- contentStyle?: StyleProp<ViewStyle>;
454
+ contentStyle?: StyleProp<ViewStyle> | undefined;
451
455
  /**
452
456
  * Whether the gesture to dismiss should use animation provided to `animation` prop. Defaults to `false`.
453
457
  *
@@ -455,7 +459,7 @@ export type NativeStackNavigationOptions = {
455
459
  *
456
460
  * @platform ios
457
461
  */
458
- animationMatchesGesture?: boolean;
462
+ animationMatchesGesture?: boolean | undefined;
459
463
  /**
460
464
  * Whether the gesture to dismiss should work on the whole screen. The behavior depends on iOS version.
461
465
  *
@@ -470,7 +474,7 @@ export type NativeStackNavigationOptions = {
470
474
  *
471
475
  * @platform ios
472
476
  */
473
- fullScreenGestureEnabled?: boolean;
477
+ fullScreenGestureEnabled?: boolean | undefined;
474
478
  /**
475
479
  * iOS 18 and below. Controls whether the full screen dismiss gesture has shadow under view during transition.
476
480
  * The gesture uses custom transition and thus doesn't have a shadow by default. When enabled, a custom shadow view
@@ -482,7 +486,7 @@ export type NativeStackNavigationOptions = {
482
486
  *
483
487
  * @platform ios
484
488
  */
485
- fullScreenGestureShadowEnabled?: boolean;
489
+ fullScreenGestureShadowEnabled?: boolean | undefined;
486
490
  /**
487
491
  * Whether you can use gestures to dismiss this screen. Defaults to `true`.
488
492
  *
@@ -490,13 +494,13 @@ export type NativeStackNavigationOptions = {
490
494
  *
491
495
  * @platform ios
492
496
  */
493
- gestureEnabled?: boolean;
497
+ gestureEnabled?: boolean | undefined;
494
498
  /**
495
499
  * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenGestureEnabled`.
496
500
  *
497
501
  * @platform ios
498
502
  */
499
- gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
503
+ gestureResponseDistance?: ScreenProps['gestureResponseDistance'] | undefined;
500
504
  /**
501
505
  * The type of animation to use when this screen replaces another screen. Defaults to `pop`.
502
506
  *
@@ -506,7 +510,7 @@ export type NativeStackNavigationOptions = {
506
510
  *
507
511
  * Only supported on iOS and Android.
508
512
  */
509
- animationTypeForReplace?: ScreenProps['replaceAnimation'];
513
+ animationTypeForReplace?: ScreenProps['replaceAnimation'] | undefined;
510
514
  /**
511
515
  * How the screen should animate when pushed or popped.
512
516
  *
@@ -525,7 +529,7 @@ export type NativeStackNavigationOptions = {
525
529
  *
526
530
  * Only supported on iOS and Android.
527
531
  */
528
- animation?: ScreenProps['stackAnimation'];
532
+ animation?: ScreenProps['stackAnimation'] | undefined;
529
533
  /**
530
534
  * Duration (in milliseconds) for the following transition animations on iOS:
531
535
  * - `slide_from_bottom`
@@ -541,7 +545,7 @@ export type NativeStackNavigationOptions = {
541
545
  *
542
546
  * @platform ios
543
547
  */
544
- animationDuration?: number;
548
+ animationDuration?: number | undefined;
545
549
  /**
546
550
  * How should the screen be presented.
547
551
  *
@@ -557,7 +561,7 @@ export type NativeStackNavigationOptions = {
557
561
  *
558
562
  * Only supported on iOS and Android.
559
563
  */
560
- presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card';
564
+ presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card' | undefined;
561
565
  /**
562
566
  * Describes heights where a sheet can rest.
563
567
  * Works only when `presentation` is set to `formSheet`.
@@ -576,7 +580,7 @@ export type NativeStackNavigationOptions = {
576
580
  *
577
581
  * Defaults to `[1.0]`.
578
582
  */
579
- sheetAllowedDetents?: number[] | 'fitToContents';
583
+ sheetAllowedDetents?: number[] | 'fitToContents' | undefined;
580
584
  /**
581
585
  * Integer value describing elevation of the sheet, impacting shadow on the top edge of the sheet.
582
586
  *
@@ -586,7 +590,7 @@ export type NativeStackNavigationOptions = {
586
590
  *
587
591
  * @platform Android
588
592
  */
589
- sheetElevation?: number;
593
+ sheetElevation?: number | undefined;
590
594
  /**
591
595
  * Whether the sheet should expand to larger detent when scrolling.
592
596
  * Works only when `presentation` is set to `formSheet`.
@@ -594,7 +598,7 @@ export type NativeStackNavigationOptions = {
594
598
  *
595
599
  * @platform ios
596
600
  */
597
- sheetExpandsWhenScrolledToEdge?: boolean;
601
+ sheetExpandsWhenScrolledToEdge?: boolean | undefined;
598
602
  /**
599
603
  * The corner radius that the sheet will try to render with.
600
604
  * Works only when `presentation` is set to `formSheet`.
@@ -603,7 +607,7 @@ export type NativeStackNavigationOptions = {
603
607
  *
604
608
  * If left unset system default is used.
605
609
  */
606
- sheetCornerRadius?: number;
610
+ sheetCornerRadius?: number | undefined;
607
611
  /**
608
612
  * Index of the detent the sheet should expand to after being opened.
609
613
  * Works only when `stackPresentation` is set to `formSheet`.
@@ -615,7 +619,7 @@ export type NativeStackNavigationOptions = {
615
619
  *
616
620
  * Defaults to `0` - which represents first detent in the detents array.
617
621
  */
618
- sheetInitialDetentIndex?: number | 'last';
622
+ sheetInitialDetentIndex?: number | 'last' | undefined;
619
623
  /**
620
624
  * Boolean indicating whether the sheet shows a grabber at the top.
621
625
  * Works only when `presentation` is set to `formSheet`.
@@ -623,7 +627,7 @@ export type NativeStackNavigationOptions = {
623
627
  *
624
628
  * @platform ios
625
629
  */
626
- sheetGrabberVisible?: boolean;
630
+ sheetGrabberVisible?: boolean | undefined;
627
631
  /**
628
632
  * The largest sheet detent for which a view underneath won't be dimmed.
629
633
  * Works only when `presentation` is set to `formSheet`.
@@ -636,9 +640,47 @@ export type NativeStackNavigationOptions = {
636
640
  * * `none` - there will be dimming view for all detents levels,
637
641
  * * `last` - there won't be a dimming view for any detent level.
638
642
  *
643
+ * @remark
644
+ * On iOS, the native implementation might resize the the sheet w/o explicitly changing the detent level, e.g. in case of keyboard appearance.
645
+ * In case after such resize the sheet exceeds height for which in regular scenario a dimming view would be applied - it will be applied,
646
+ * even if the detent has not effectively been changed.
647
+ *
639
648
  * Defaults to `none`, indicating that the dimming view should be always present.
640
649
  */
641
- sheetLargestUndimmedDetentIndex?: number | 'none' | 'last';
650
+ sheetLargestUndimmedDetentIndex?: number | 'none' | 'last' | undefined;
651
+ /**
652
+ * Whether the sheet content should be rendered behind the Status Bar or display cutouts.
653
+ *
654
+ * When set to `true`, the sheet will extend to the physical edges of the stack,
655
+ * allowing content to be visible behind the status bar or display cutouts.
656
+ * Detent ratios in sheetAllowedDetents will be measured relative to the full stack height.
657
+ *
658
+ * When set to `false`, the sheet's layout will be constrained by the inset from the top
659
+ * and the detent ratios will then be measured relative to the adjusted height (excluding the top inset).
660
+ * This means that sheetAllowedDetents will result in different sheet heights depending on this prop.
661
+ *
662
+ * Defaults to `false`.
663
+ *
664
+ * @platform android
665
+ */
666
+ sheetShouldOverflowTopInset?: boolean | undefined;
667
+ /**
668
+ * Whether the default native animation should be used when the sheet's with
669
+ * `fitToContents` content size changes.
670
+ *
671
+ * When set to `true`, the sheet uses internal logic to synchronize size updates and
672
+ * translation animations during entry, exit, or content updates. This ensures a smooth
673
+ * transition for standard, static content mounting/unmounting.
674
+ *
675
+ * When set to `false`, the internal animation and translation logic is ignored. This
676
+ * allows the sheet to adjust its size dynamically based on the current dimensions of
677
+ * the content provided by the developer, allowing implementing custom resizing animations.
678
+ *
679
+ * Defaults to `true`.
680
+ *
681
+ * @platform android
682
+ */
683
+ sheetResizeAnimationEnabled?: boolean | undefined;
642
684
  /**
643
685
  * The display orientation to use for the screen.
644
686
  *
@@ -654,15 +696,7 @@ export type NativeStackNavigationOptions = {
654
696
  *
655
697
  * Only supported on iOS and Android.
656
698
  */
657
- orientation?: ScreenProps['screenOrientation'];
658
- /**
659
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
660
- * Defaults to `true` when `enableFreeze()` is run at the top of the application.
661
- * Requires `react-native-screens` version >=3.16.0.
662
- *
663
- * Only supported on iOS and Android.
664
- */
665
- freezeOnBlur?: boolean;
699
+ orientation?: ScreenProps['screenOrientation'] | undefined;
666
700
  /**
667
701
  * Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen).
668
702
  * Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar)
@@ -687,11 +721,11 @@ export type NativeStackNavigationOptions = {
687
721
  * @supported iOS 26 or higher
688
722
  */
689
723
  scrollEdgeEffects?: {
690
- bottom?: ScrollEdgeEffect;
691
- left?: ScrollEdgeEffect;
692
- right?: ScrollEdgeEffect;
693
- top?: ScrollEdgeEffect;
694
- };
724
+ bottom?: ScrollEdgeEffect | undefined;
725
+ left?: ScrollEdgeEffect | undefined;
726
+ right?: ScrollEdgeEffect | undefined;
727
+ top?: ScrollEdgeEffect | undefined;
728
+ } | undefined;
695
729
  /**
696
730
  * Footer component that can be used alongside formSheet stack presentation style.
697
731
  *
@@ -704,24 +738,25 @@ export type NativeStackNavigationOptions = {
704
738
  *
705
739
  * @platform android
706
740
  */
707
- unstable_sheetFooter?: () => React.ReactNode;
708
- };
709
- type PlatformIconShared = {
710
- type: 'image';
711
- source: ImageSourcePropType;
741
+ unstable_sheetFooter?: (() => React.ReactNode) | undefined;
712
742
  /**
713
- * Whether to apply tint color to the icon.
714
- * Defaults to `true`.
743
+ * What should happen when screens become inactive.
744
+ * - `pause`: Effects are cleaned up.
745
+ * - `unmount`: Screen is unmounted
746
+ * - `none`: Screen renders normally
715
747
  *
716
- * @platform ios
748
+ * Defaults to `pause`.
749
+ *
750
+ * Preloaded screens won't be paused until after navigated to.
751
+ * This makes sure that effects are run to initialize the screen.
752
+ *
753
+ * Screens with nested navigators and last 2 screens won't be unmounted.
717
754
  */
718
- tinted?: boolean;
755
+ inactiveBehavior?: 'pause' | 'unmount' | 'none' | undefined;
719
756
  };
720
- type PlatformIconIOSSfSymbol = {
721
- type: 'sfSymbol';
722
- name: SFSymbol;
723
- };
724
- type PlatformIconIOS = PlatformIconIOSSfSymbol | PlatformIconShared;
757
+ type IconIOS = Extract<Icon, {
758
+ type: 'image' | 'sfSymbol';
759
+ }>;
725
760
  type SharedHeaderItem = {
726
761
  /**
727
762
  * Label of the item.
@@ -731,59 +766,59 @@ type SharedHeaderItem = {
731
766
  * Style for the item label.
732
767
  */
733
768
  labelStyle?: {
734
- fontFamily?: string;
735
- fontSize?: number;
736
- fontWeight?: string;
737
- color?: ColorValue;
738
- };
769
+ fontFamily?: string | undefined;
770
+ fontSize?: number | undefined;
771
+ fontWeight?: string | undefined;
772
+ color?: ColorValue | undefined;
773
+ } | undefined;
739
774
  /**
740
775
  * Icon for the item
741
776
  */
742
- icon?: PlatformIconIOS;
777
+ icon?: IconIOS | undefined;
743
778
  /**
744
779
  * The variant of the item.
745
780
  * "prominent" only available from iOS 26.0 and later.
746
781
  *
747
782
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.property
748
783
  */
749
- variant?: 'plain' | 'done' | 'prominent';
784
+ variant?: 'plain' | 'done' | 'prominent' | undefined;
750
785
  /**
751
786
  * The tint color to apply to the item.
752
787
  *
753
788
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor
754
789
  */
755
- tintColor?: ColorValue;
790
+ tintColor?: ColorValue | undefined;
756
791
  /**
757
792
  * Whether the item is in a disabled state.
758
793
  */
759
- disabled?: boolean;
794
+ disabled?: boolean | undefined;
760
795
  /**
761
796
  * The width of the item.
762
797
  *
763
798
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/width
764
799
  */
765
- width?: number;
800
+ width?: number | undefined;
766
801
  /**
767
802
  * Whether the background this item may share with other items in the bar should be hidden.
768
803
  * Only available from iOS 26.0 and later.
769
804
  *
770
805
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground
771
806
  */
772
- hidesSharedBackground?: boolean;
807
+ hidesSharedBackground?: boolean | undefined;
773
808
  /**
774
809
  * Whether this item can share a background with other items.
775
810
  * Only available from iOS 26.0 and later.
776
811
  *
777
812
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground
778
813
  */
779
- sharesBackground?: boolean;
814
+ sharesBackground?: boolean | undefined;
780
815
  /**
781
816
  * An identifier used to match items across transitions.
782
817
  * Only available from iOS 26.0 and later.
783
818
  *
784
819
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/identifier
785
820
  */
786
- identifier?: string;
821
+ identifier?: string | undefined;
787
822
  /**
788
823
  * A badge to display on a item.
789
824
  * Only available from iOS 26.0 and later.
@@ -799,21 +834,21 @@ type SharedHeaderItem = {
799
834
  * Style of the badge.
800
835
  */
801
836
  style?: {
802
- color?: ColorValue;
803
- backgroundColor?: ColorValue;
804
- fontFamily?: string;
805
- fontSize?: number;
806
- fontWeight?: string;
807
- };
808
- };
837
+ color?: ColorValue | undefined;
838
+ backgroundColor?: ColorValue | undefined;
839
+ fontFamily?: string | undefined;
840
+ fontSize?: number | undefined;
841
+ fontWeight?: string | undefined;
842
+ } | undefined;
843
+ } | undefined;
809
844
  /**
810
845
  * Accessibility label for the item.
811
846
  */
812
- accessibilityLabel?: string;
847
+ accessibilityLabel?: string | undefined;
813
848
  /**
814
849
  * Accessibility hint for the item.
815
850
  */
816
- accessibilityHint?: string;
851
+ accessibilityHint?: string | undefined;
817
852
  };
818
853
  /**
819
854
  * A button item in the header.
@@ -832,7 +867,7 @@ export type NativeStackHeaderItemButton = SharedHeaderItem & {
832
867
  *
833
868
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected
834
869
  */
835
- selected?: boolean;
870
+ selected?: boolean | undefined;
836
871
  };
837
872
  /**
838
873
  * An action item in a menu.
@@ -846,11 +881,11 @@ export type NativeStackHeaderItemMenuAction = {
846
881
  /**
847
882
  * The secondary text displayed alongside the label of the menu item.
848
883
  */
849
- description?: string;
884
+ description?: string | undefined;
850
885
  /**
851
886
  * Icon for the menu item.
852
887
  */
853
- icon?: PlatformIconIOSSfSymbol;
888
+ icon?: IconIOS | undefined;
854
889
  /**
855
890
  * Function to call when the menu item is pressed.
856
891
  */
@@ -860,31 +895,31 @@ export type NativeStackHeaderItemMenuAction = {
860
895
  *
861
896
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/state
862
897
  */
863
- state?: 'on' | 'off' | 'mixed';
898
+ state?: 'on' | 'off' | 'mixed' | undefined;
864
899
  /**
865
900
  * Whether to apply disabled style to the item.
866
901
  *
867
902
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled
868
903
  */
869
- disabled?: boolean;
904
+ disabled?: boolean | undefined;
870
905
  /**
871
906
  * Whether to apply destructive style to the item.
872
907
  *
873
908
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive
874
909
  */
875
- destructive?: boolean;
910
+ destructive?: boolean | undefined;
876
911
  /**
877
912
  * Whether to apply hidden style to the item.
878
913
  *
879
914
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden
880
915
  */
881
- hidden?: boolean;
916
+ hidden?: boolean | undefined;
882
917
  /**
883
- * Whether to keep the menu presented after firing the elements action.
918
+ * Whether to keep the menu presented after firing the element's action.
884
919
  *
885
920
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented
886
921
  */
887
- keepsMenuPresented?: boolean;
922
+ keepsMenuPresented?: boolean | undefined;
888
923
  /**
889
924
  * An elaborated title that explains the purpose of the action.
890
925
  *
@@ -893,7 +928,7 @@ export type NativeStackHeaderItemMenuAction = {
893
928
  *
894
929
  * Read more: https://developer.apple.com/documentation/uikit/uiaction/discoverabilitytitle
895
930
  */
896
- discoverabilityLabel?: string;
931
+ discoverabilityLabel?: string | undefined;
897
932
  };
898
933
  /**
899
934
  * A submenu item that contains other menu items.
@@ -907,7 +942,7 @@ export type NativeStackHeaderItemMenuSubmenu = {
907
942
  /**
908
943
  * Icon for the submenu item.
909
944
  */
910
- icon?: PlatformIconIOSSfSymbol;
945
+ icon?: IconIOS | undefined;
911
946
  /**
912
947
  * Whether the menu is displayed inline with the parent menu.
913
948
  * By default, submenus are displayed after expanding the parent menu item.
@@ -917,7 +952,7 @@ export type NativeStackHeaderItemMenuSubmenu = {
917
952
  *
918
953
  * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline
919
954
  */
920
- inline?: boolean;
955
+ inline?: boolean | undefined;
921
956
  /**
922
957
  * How the submenu items are displayed.
923
958
  * - `default`: menu items are displayed normally.
@@ -927,13 +962,13 @@ export type NativeStackHeaderItemMenuSubmenu = {
927
962
  *
928
963
  * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette
929
964
  */
930
- layout?: 'default' | 'palette';
965
+ layout?: 'default' | 'palette' | undefined;
931
966
  /**
932
967
  * Whether to apply destructive style to the menu item.
933
968
  *
934
969
  * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive
935
970
  */
936
- destructive?: boolean;
971
+ destructive?: boolean | undefined;
937
972
  /**
938
973
  * Whether multiple items in the submenu can be selected, i.e. in "on" state.
939
974
  *
@@ -941,7 +976,7 @@ export type NativeStackHeaderItemMenuSubmenu = {
941
976
  *
942
977
  * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/singleselection
943
978
  */
944
- multiselectable?: boolean;
979
+ multiselectable?: boolean | undefined;
945
980
  /**
946
981
  * Array of menu items (actions or submenus).
947
982
  */
@@ -958,7 +993,7 @@ export type NativeStackHeaderItemMenu = SharedHeaderItem & {
958
993
  *
959
994
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
960
995
  */
961
- changesSelectionAsPrimaryAction?: boolean;
996
+ changesSelectionAsPrimaryAction?: boolean | undefined;
962
997
  /**
963
998
  * Menu for the item.
964
999
  */
@@ -966,7 +1001,7 @@ export type NativeStackHeaderItemMenu = SharedHeaderItem & {
966
1001
  /**
967
1002
  * Optional title to show on top of the menu.
968
1003
  */
969
- title?: string;
1004
+ title?: string | undefined;
970
1005
  /**
971
1006
  * Whether multiple items in the submenu can be selected, i.e. in "on" state.
972
1007
  *
@@ -974,7 +1009,7 @@ export type NativeStackHeaderItemMenu = SharedHeaderItem & {
974
1009
  *
975
1010
  * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/singleselection
976
1011
  */
977
- multiselectable?: boolean;
1012
+ multiselectable?: boolean | undefined;
978
1013
  /**
979
1014
  * How the submenu items are displayed.
980
1015
  * - `default`: menu items are displayed normally.
@@ -984,7 +1019,7 @@ export type NativeStackHeaderItemMenu = SharedHeaderItem & {
984
1019
  *
985
1020
  * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette
986
1021
  */
987
- layout?: 'default' | 'palette';
1022
+ layout?: 'default' | 'palette' | undefined;
988
1023
  /**
989
1024
  * Array of menu items (actions or submenus).
990
1025
  */
@@ -1016,7 +1051,7 @@ export type NativeStackHeaderItemCustom = {
1016
1051
  *
1017
1052
  * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground
1018
1053
  */
1019
- hidesSharedBackground?: boolean;
1054
+ hidesSharedBackground?: boolean | undefined;
1020
1055
  };
1021
1056
  /**
1022
1057
  * An item that can be displayed in the header.