@react-navigation/stack 7.0.0-alpha.2 → 7.0.0-alpha.20

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 (176) hide show
  1. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +29 -14
  2. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  3. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +19 -12
  4. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  5. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +20 -22
  6. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
  7. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +7 -14
  8. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
  9. package/lib/commonjs/index.js +2 -2
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/navigators/createStackNavigator.js +35 -25
  12. package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
  13. package/lib/commonjs/types.js.map +1 -1
  14. package/lib/commonjs/utils/CardAnimationContext.js +3 -4
  15. package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
  16. package/lib/commonjs/utils/GestureHandlerRefContext.js +3 -4
  17. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
  18. package/lib/commonjs/utils/ModalPresentationContext.js +3 -4
  19. package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
  20. package/lib/commonjs/utils/conditional.js.map +1 -1
  21. package/lib/commonjs/utils/debounce.js.map +1 -1
  22. package/lib/commonjs/utils/findLastIndex.js +1 -1
  23. package/lib/commonjs/utils/findLastIndex.js.map +1 -1
  24. package/lib/commonjs/utils/getDistanceForDirection.js +2 -2
  25. package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
  26. package/lib/commonjs/utils/getInvertedMultiplier.js +3 -4
  27. package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
  28. package/lib/commonjs/utils/getModalRoutesKeys.js +17 -0
  29. package/lib/commonjs/utils/getModalRoutesKeys.js.map +1 -0
  30. package/lib/commonjs/utils/memoize.js.map +1 -1
  31. package/lib/commonjs/utils/useCardAnimation.js +2 -2
  32. package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
  33. package/lib/commonjs/utils/useGestureHandlerRef.js +2 -2
  34. package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
  35. package/lib/commonjs/utils/useKeyboardManager.js +6 -6
  36. package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
  37. package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
  38. package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
  39. package/lib/commonjs/views/GestureHandler.js +5 -8
  40. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  41. package/lib/commonjs/views/GestureHandlerNative.js +2 -2
  42. package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
  43. package/lib/commonjs/views/Header/Header.js +4 -4
  44. package/lib/commonjs/views/Header/Header.js.map +1 -1
  45. package/lib/commonjs/views/Header/HeaderContainer.js +14 -11
  46. package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
  47. package/lib/commonjs/views/Header/HeaderSegment.js +9 -2
  48. package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
  49. package/lib/commonjs/views/Screens.js +2 -2
  50. package/lib/commonjs/views/Screens.js.map +1 -1
  51. package/lib/commonjs/views/Stack/Card.js +55 -48
  52. package/lib/commonjs/views/Stack/Card.js.map +1 -1
  53. package/lib/commonjs/views/Stack/CardContainer.js +27 -23
  54. package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
  55. package/lib/commonjs/views/Stack/CardSheet.js +24 -4
  56. package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
  57. package/lib/commonjs/views/Stack/CardStack.js +99 -73
  58. package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
  59. package/lib/commonjs/views/Stack/StackView.js +27 -31
  60. package/lib/commonjs/views/Stack/StackView.js.map +1 -1
  61. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +28 -14
  62. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  63. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +20 -13
  64. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  65. package/lib/module/TransitionConfigs/TransitionPresets.js +10 -2
  66. package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
  67. package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/navigators/createStackNavigator.js +33 -22
  70. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  71. package/lib/module/types.js.map +1 -1
  72. package/lib/module/utils/CardAnimationContext.js.map +1 -1
  73. package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
  74. package/lib/module/utils/ModalPresentationContext.js.map +1 -1
  75. package/lib/module/utils/conditional.js.map +1 -1
  76. package/lib/module/utils/debounce.js.map +1 -1
  77. package/lib/module/utils/findLastIndex.js +1 -1
  78. package/lib/module/utils/findLastIndex.js.map +1 -1
  79. package/lib/module/utils/getDistanceForDirection.js +2 -2
  80. package/lib/module/utils/getDistanceForDirection.js.map +1 -1
  81. package/lib/module/utils/getInvertedMultiplier.js +3 -4
  82. package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
  83. package/lib/module/utils/getModalRoutesKeys.js +10 -0
  84. package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
  85. package/lib/module/utils/memoize.js.map +1 -1
  86. package/lib/module/utils/useCardAnimation.js.map +1 -1
  87. package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
  88. package/lib/module/utils/useKeyboardManager.js +4 -4
  89. package/lib/module/utils/useKeyboardManager.js.map +1 -1
  90. package/lib/module/views/GestureHandler.android.js.map +1 -1
  91. package/lib/module/views/GestureHandler.ios.js.map +1 -1
  92. package/lib/module/views/GestureHandler.js.map +1 -1
  93. package/lib/module/views/GestureHandlerNative.js.map +1 -1
  94. package/lib/module/views/Header/Header.js +1 -0
  95. package/lib/module/views/Header/Header.js.map +1 -1
  96. package/lib/module/views/Header/HeaderContainer.js +13 -10
  97. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  98. package/lib/module/views/Header/HeaderSegment.js +7 -0
  99. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  100. package/lib/module/views/Screens.js.map +1 -1
  101. package/lib/module/views/Stack/Card.js +52 -44
  102. package/lib/module/views/Stack/Card.js.map +1 -1
  103. package/lib/module/views/Stack/CardContainer.js +25 -20
  104. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  105. package/lib/module/views/Stack/CardSheet.js +21 -0
  106. package/lib/module/views/Stack/CardSheet.js.map +1 -1
  107. package/lib/module/views/Stack/CardStack.js +95 -68
  108. package/lib/module/views/Stack/CardStack.js.map +1 -1
  109. package/lib/module/views/Stack/StackView.js +25 -29
  110. package/lib/module/views/Stack/StackView.js.map +1 -1
  111. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +4 -0
  112. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
  113. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +3 -3
  114. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
  115. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +4 -0
  116. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
  117. package/lib/typescript/src/index.d.ts +1 -1
  118. package/lib/typescript/src/index.d.ts.map +1 -1
  119. package/lib/typescript/src/navigators/createStackNavigator.d.ts +15 -9
  120. package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
  121. package/lib/typescript/src/types.d.ts +70 -15
  122. package/lib/typescript/src/types.d.ts.map +1 -1
  123. package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
  124. package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
  125. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
  126. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
  127. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
  128. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  129. package/lib/typescript/src/views/GestureHandlerNative.d.ts +3 -2
  130. package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
  131. package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
  132. package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -3
  133. package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
  134. package/lib/typescript/src/views/Header/HeaderSegment.d.ts +3 -1
  135. package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
  136. package/lib/typescript/src/views/Screens.d.ts +4 -3
  137. package/lib/typescript/src/views/Screens.d.ts.map +1 -1
  138. package/lib/typescript/src/views/Stack/Card.d.ts +6 -5
  139. package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
  140. package/lib/typescript/src/views/Stack/CardContainer.d.ts +3 -6
  141. package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
  142. package/lib/typescript/src/views/Stack/CardSheet.d.ts +1 -1
  143. package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
  144. package/lib/typescript/src/views/Stack/CardStack.d.ts +4 -5
  145. package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
  146. package/lib/typescript/src/views/Stack/StackView.d.ts +9 -80
  147. package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
  148. package/package.json +19 -20
  149. package/src/TransitionConfigs/CardStyleInterpolators.tsx +18 -5
  150. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +32 -22
  151. package/src/TransitionConfigs/TransitionPresets.tsx +13 -4
  152. package/src/index.tsx +2 -0
  153. package/src/navigators/createStackNavigator.tsx +49 -14
  154. package/src/types.tsx +88 -15
  155. package/src/utils/findLastIndex.tsx +1 -1
  156. package/src/utils/getDistanceForDirection.tsx +3 -2
  157. package/src/utils/getInvertedMultiplier.tsx +4 -5
  158. package/src/utils/getModalRoutesKeys.ts +21 -0
  159. package/src/utils/useKeyboardManager.tsx +1 -1
  160. package/src/views/GestureHandlerNative.tsx +1 -1
  161. package/src/views/Header/Header.tsx +3 -2
  162. package/src/views/Header/HeaderContainer.tsx +19 -8
  163. package/src/views/Header/HeaderSegment.tsx +10 -3
  164. package/src/views/Screens.tsx +2 -1
  165. package/src/views/Stack/Card.tsx +82 -63
  166. package/src/views/Stack/CardContainer.tsx +20 -11
  167. package/src/views/Stack/CardSheet.tsx +25 -1
  168. package/src/views/Stack/CardStack.tsx +278 -193
  169. package/src/views/Stack/StackView.tsx +25 -28
  170. package/lib/commonjs/views/ModalStatusBarManager.js +0 -44
  171. package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
  172. package/lib/module/views/ModalStatusBarManager.js +0 -36
  173. package/lib/module/views/ModalStatusBarManager.js.map +0 -1
  174. package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -11
  175. package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
  176. package/src/views/ModalStatusBarManager.tsx +0 -45
package/src/types.tsx CHANGED
@@ -1,12 +1,12 @@
1
1
  import type {
2
2
  HeaderBackButton,
3
3
  HeaderBackButtonProps,
4
- HeaderButtonProps,
5
4
  HeaderOptions,
6
5
  HeaderTitleProps,
7
6
  } from '@react-navigation/elements';
8
7
  import type {
9
8
  Descriptor,
9
+ LocaleDirection,
10
10
  NavigationHelpers,
11
11
  NavigationProp,
12
12
  ParamListBase,
@@ -14,6 +14,7 @@ import type {
14
14
  RouteProp,
15
15
  StackActionHelpers,
16
16
  StackNavigationState,
17
+ Theme,
17
18
  } from '@react-navigation/native';
18
19
  import type * as React from 'react';
19
20
  import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
@@ -50,7 +51,7 @@ export type StackNavigationHelpers = NavigationHelpers<
50
51
  export type StackNavigationProp<
51
52
  ParamList extends ParamListBase,
52
53
  RouteName extends keyof ParamList = keyof ParamList,
53
- NavigatorID extends string | undefined = undefined
54
+ NavigatorID extends string | undefined = undefined,
54
55
  > = NavigationProp<
55
56
  ParamList,
56
57
  RouteName,
@@ -64,12 +65,20 @@ export type StackNavigationProp<
64
65
  export type StackScreenProps<
65
66
  ParamList extends ParamListBase,
66
67
  RouteName extends keyof ParamList = keyof ParamList,
67
- NavigatorID extends string | undefined = undefined
68
+ NavigatorID extends string | undefined = undefined,
68
69
  > = {
69
70
  navigation: StackNavigationProp<ParamList, RouteName, NavigatorID>;
70
71
  route: RouteProp<ParamList, RouteName>;
71
72
  };
72
73
 
74
+ export type StackOptionsArgs<
75
+ ParamList extends ParamListBase,
76
+ RouteName extends keyof ParamList = keyof ParamList,
77
+ NavigatorID extends string | undefined = undefined,
78
+ > = StackScreenProps<ParamList, RouteName, NavigatorID> & {
79
+ theme: Theme;
80
+ };
81
+
73
82
  export type Layout = { width: number; height: number };
74
83
 
75
84
  export type GestureDirection =
@@ -78,8 +87,19 @@ export type GestureDirection =
78
87
  | 'vertical'
79
88
  | 'vertical-inverted';
80
89
 
90
+ export type StackAnimationName =
91
+ | 'default'
92
+ | 'fade'
93
+ | 'fade_from_bottom'
94
+ | 'none'
95
+ | 'reveal_from_bottom'
96
+ | 'scale_from_center'
97
+ | 'slide_from_bottom'
98
+ | 'slide_from_right'
99
+ | 'slide_from_left';
100
+
81
101
  type SceneOptionsDefaults = TransitionPreset & {
82
- animationEnabled: boolean;
102
+ animation: StackAnimationName;
83
103
  gestureEnabled: boolean;
84
104
  cardOverlayEnabled: boolean;
85
105
  headerMode: StackHeaderMode;
@@ -139,11 +159,11 @@ export type StackHeaderOptions = Omit<
139
159
  /**
140
160
  * Function which returns a React Element to display on the left side of the header.
141
161
  */
142
- headerLeft?: (props: HeaderBackButtonProps) => React.ReactNode;
162
+ headerLeft?: (props: StackHeaderLeftProps) => React.ReactNode;
143
163
  /**
144
164
  * Function which returns a React Element to display on the right side of the header.
145
165
  */
146
- headerRight?: (props: HeaderButtonProps) => React.ReactNode;
166
+ headerRight?: (props: StackHeaderRightProps) => React.ReactNode;
147
167
  /**
148
168
  * Whether back button title font should scale to respect Text Size accessibility settings. Defaults to `false`.
149
169
  */
@@ -196,7 +216,11 @@ export type StackHeaderProps = {
196
216
  /**
197
217
  * Title of the previous screen.
198
218
  */
199
- title: string;
219
+ title: string | undefined;
220
+ /**
221
+ * The `href` to use for the anchor tag on web
222
+ */
223
+ href: string | undefined;
200
224
  };
201
225
  /**
202
226
  * Animated nodes representing the progress of the animation.
@@ -220,6 +244,36 @@ export type StackHeaderProps = {
220
244
  styleInterpolator: StackHeaderStyleInterpolator;
221
245
  };
222
246
 
247
+ export type StackHeaderRightProps = {
248
+ /**
249
+ * Tint color for the header button.
250
+ */
251
+ tintColor?: string;
252
+ /**
253
+ * Color for material ripple (Android >= 5.0 only).
254
+ */
255
+ pressColor?: string;
256
+ /**
257
+ * Opacity when the button is pressed, used when ripple is not supported.
258
+ */
259
+ pressOpacity?: number;
260
+ /**
261
+ * Whether it's possible to navigate back in stack.
262
+ */
263
+ canGoBack?: boolean;
264
+ };
265
+
266
+ export type StackHeaderLeftProps = HeaderBackButtonProps & {
267
+ /**
268
+ * The `href` to use for the anchor tag on web
269
+ */
270
+ href?: string;
271
+ /**
272
+ * Whether it's possible to navigate back in stack.
273
+ */
274
+ canGoBack?: boolean;
275
+ };
276
+
223
277
  export type StackDescriptor = Descriptor<
224
278
  StackNavigationOptions,
225
279
  StackNavigationProp<ParamListBase>,
@@ -296,11 +350,20 @@ export type StackNavigationOptions = StackHeaderOptions &
296
350
  */
297
351
  presentation?: 'card' | 'modal' | 'transparentModal';
298
352
  /**
299
- * Whether transition animation should be enabled the screen.
300
- * If you set it to `false`, the screen won't animate when pushing or popping.
301
- * Defaults to `true` on Android and iOS, `false` on Web.
353
+ * How the screen should animate when pushed or popped.
354
+ *
355
+ * Supported values:
356
+ * - 'none': don't animate the screen
357
+ * - 'default': use the platform default animation
358
+ * - 'fade': fade screen in or out
359
+ * - 'fade_from_bottom': fade screen in or out from bottom
360
+ * - 'slide_from_bottom': slide in the new screen from bottom
361
+ * - 'slide_from_right': slide in the new screen from right
362
+ * - 'slide_from_left': slide in the new screen from left
363
+ * - 'reveal_from_bottom': reveal screen in from bottom to top
364
+ * - 'scale_from_center': scale screen in from center
302
365
  */
303
- animationEnabled?: boolean;
366
+ animation?: StackAnimationName;
304
367
  /**
305
368
  * The type of animation to use when this screen replaces another screen. Defaults to `push`.
306
369
  * When `pop` is used, the `pop` animation is applied to the screen being replaced.
@@ -341,6 +404,12 @@ export type StackNavigationOptions = StackHeaderOptions &
341
404
  * Only supported on iOS and Android.
342
405
  */
343
406
  freezeOnBlur?: boolean;
407
+ /**
408
+ * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
409
+ *
410
+ * @platform ios
411
+ */
412
+ autoHideHomeIndicator?: boolean;
344
413
  };
345
414
 
346
415
  export type StackNavigationConfig = {
@@ -429,19 +498,19 @@ export type StackCardInterpolatedStyle = {
429
498
  /**
430
499
  * Interpolated style for the container view wrapping the card.
431
500
  */
432
- containerStyle?: any;
501
+ containerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
433
502
  /**
434
503
  * Interpolated style for the view representing the card.
435
504
  */
436
- cardStyle?: any;
505
+ cardStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
437
506
  /**
438
507
  * Interpolated style for the view representing the semi-transparent overlay below the card.
439
508
  */
440
- overlayStyle?: any;
509
+ overlayStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
441
510
  /**
442
511
  * Interpolated style representing the card shadow.
443
512
  */
444
- shadowStyle?: any;
513
+ shadowStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
445
514
  };
446
515
 
447
516
  export type StackCardStyleInterpolator = (
@@ -468,6 +537,10 @@ export type StackHeaderInterpolationProps = {
468
537
  */
469
538
  progress: Animated.AnimatedInterpolation<number>;
470
539
  };
540
+ /**
541
+ * Writing direction of the layout.
542
+ */
543
+ direction: LocaleDirection;
471
544
  /**
472
545
  * Layout measurements for various items we use for animation.
473
546
  */
@@ -1,5 +1,5 @@
1
1
  export function findLastIndex<T>(array: T[], callback: (value: T) => boolean) {
2
- for (var i = array.length - 1; i >= 0; i--) {
2
+ for (let i = array.length - 1; i >= 0; i--) {
3
3
  if (callback(array[i])) {
4
4
  return i;
5
5
  }
@@ -3,9 +3,10 @@ import { getInvertedMultiplier } from './getInvertedMultiplier';
3
3
 
4
4
  export function getDistanceForDirection(
5
5
  layout: Layout,
6
- gestureDirection: GestureDirection
6
+ gestureDirection: GestureDirection,
7
+ isRTL: boolean
7
8
  ): number {
8
- const multiplier = getInvertedMultiplier(gestureDirection);
9
+ const multiplier = getInvertedMultiplier(gestureDirection, isRTL);
9
10
 
10
11
  switch (gestureDirection) {
11
12
  case 'vertical':
@@ -1,9 +1,8 @@
1
- import { I18nManager } from 'react-native';
2
-
3
1
  import type { GestureDirection } from '../types';
4
2
 
5
3
  export function getInvertedMultiplier(
6
- gestureDirection: GestureDirection
4
+ gestureDirection: GestureDirection,
5
+ isRTL: boolean
7
6
  ): 1 | -1 {
8
7
  switch (gestureDirection) {
9
8
  case 'vertical':
@@ -11,8 +10,8 @@ export function getInvertedMultiplier(
11
10
  case 'vertical-inverted':
12
11
  return -1;
13
12
  case 'horizontal':
14
- return I18nManager.getConstants().isRTL ? -1 : 1;
13
+ return isRTL ? -1 : 1;
15
14
  case 'horizontal-inverted':
16
- return I18nManager.getConstants().isRTL ? 1 : -1;
15
+ return isRTL ? 1 : -1;
17
16
  }
18
17
  }
@@ -0,0 +1,21 @@
1
+ import type { Route } from '@react-navigation/native';
2
+
3
+ import type { StackDescriptorMap } from '../types';
4
+
5
+ export const getModalRouteKeys = (
6
+ routes: Route<string>[],
7
+ descriptors: StackDescriptorMap
8
+ ) =>
9
+ routes.reduce<string[]>((acc, route) => {
10
+ const { presentation } = descriptors[route.key]?.options ?? {};
11
+
12
+ if (
13
+ (acc.length && !presentation) ||
14
+ presentation === 'modal' ||
15
+ presentation === 'transparentModal'
16
+ ) {
17
+ acc.push(route.key);
18
+ }
19
+
20
+ return acc;
21
+ }, []);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { HostComponent, Keyboard, TextInput } from 'react-native';
2
+ import { type HostComponent, Keyboard, TextInput } from 'react-native';
3
3
 
4
4
  type InputRef = React.ElementRef<HostComponent<unknown>> | undefined;
5
5
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import {
3
3
  PanGestureHandler as PanGestureHandlerNative,
4
- PanGestureHandlerProperties,
4
+ type PanGestureHandlerProperties,
5
5
  } from 'react-native-gesture-handler';
6
6
 
7
7
  import { GestureHandlerRefContext } from '../utils/GestureHandlerRefContext';
@@ -49,8 +49,8 @@ export const Header = React.memo(function Header({
49
49
  options.headerStatusBarHeight !== undefined
50
50
  ? options.headerStatusBarHeight
51
51
  : isModal || isParentHeaderShown
52
- ? 0
53
- : insets.top;
52
+ ? 0
53
+ : insets.top;
54
54
 
55
55
  return (
56
56
  <HeaderSegment
@@ -66,6 +66,7 @@ export const Header = React.memo(function Header({
66
66
  }
67
67
  headerStatusBarHeight={statusBarHeight}
68
68
  onGoBack={back ? goBack : undefined}
69
+ backHref={back ? back.href : undefined}
69
70
  styleInterpolator={styleInterpolator}
70
71
  />
71
72
  );
@@ -2,11 +2,18 @@ import { getHeaderTitle, HeaderBackContext } from '@react-navigation/elements';
2
2
  import {
3
3
  NavigationContext,
4
4
  NavigationRouteContext,
5
- ParamListBase,
6
- Route,
5
+ type ParamListBase,
6
+ type Route,
7
+ useLinkBuilder,
7
8
  } from '@react-navigation/native';
8
9
  import * as React from 'react';
9
- import { Animated, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
10
+ import {
11
+ Animated,
12
+ type StyleProp,
13
+ StyleSheet,
14
+ View,
15
+ type ViewStyle,
16
+ } from 'react-native';
10
17
 
11
18
  import {
12
19
  forNoAnimation,
@@ -47,6 +54,7 @@ export function HeaderContainer({
47
54
  }: Props) {
48
55
  const focusedRoute = getFocusedRoute();
49
56
  const parentHeaderBack = React.useContext(HeaderBackContext);
57
+ const { buildHref } = useLinkBuilder();
50
58
 
51
59
  return (
52
60
  <Animated.View pointerEvents="box-none" style={style}>
@@ -78,7 +86,10 @@ export function HeaderContainer({
78
86
  const { options, route } = previousScene.descriptor;
79
87
 
80
88
  headerBack = previousScene
81
- ? { title: getHeaderTitle(options, route.name) }
89
+ ? {
90
+ title: getHeaderTitle(options, route.name),
91
+ href: buildHref(route.name, route.params),
92
+ }
82
93
  : parentHeaderBack;
83
94
  }
84
95
 
@@ -128,8 +139,8 @@ export function HeaderContainer({
128
139
  nextHeaderlessGestureDirection === 'vertical-inverted'
129
140
  ? forSlideUp
130
141
  : nextHeaderlessGestureDirection === 'horizontal-inverted'
131
- ? forSlideRight
132
- : forSlideLeft
142
+ ? forSlideRight
143
+ : forSlideLeft
133
144
  : headerStyleInterpolator
134
145
  : forNoAnimation,
135
146
  };
@@ -180,7 +191,7 @@ const styles = StyleSheet.create({
180
191
  header: {
181
192
  position: 'absolute',
182
193
  top: 0,
183
- left: 0,
184
- right: 0,
194
+ start: 0,
195
+ end: 0,
185
196
  },
186
197
  });
@@ -2,16 +2,17 @@ import {
2
2
  getDefaultHeaderHeight,
3
3
  Header,
4
4
  HeaderBackButton,
5
- HeaderBackButtonProps,
5
+ type HeaderBackButtonProps,
6
6
  HeaderTitle,
7
7
  } from '@react-navigation/elements';
8
+ import { useLocale } from '@react-navigation/native';
8
9
  import * as React from 'react';
9
10
  import {
10
11
  Animated,
11
- LayoutChangeEvent,
12
+ type LayoutChangeEvent,
12
13
  Platform,
13
14
  StyleSheet,
14
- ViewStyle,
15
+ type ViewStyle,
15
16
  } from 'react-native';
16
17
 
17
18
  import type {
@@ -28,11 +29,14 @@ type Props = Omit<StackHeaderOptions, 'headerStatusBarHeight'> & {
28
29
  title: string;
29
30
  modal: boolean;
30
31
  onGoBack?: () => void;
32
+ backHref?: string;
31
33
  progress: SceneProgress;
32
34
  styleInterpolator: StackHeaderStyleInterpolator;
33
35
  };
34
36
 
35
37
  export function HeaderSegment(props: Props) {
38
+ const { direction } = useLocale();
39
+
36
40
  const [leftLabelLayout, setLeftLabelLayout] = React.useState<
37
41
  Layout | undefined
38
42
  >(undefined);
@@ -84,6 +88,7 @@ export function HeaderSegment(props: Props) {
84
88
  styleInterpolator({
85
89
  current: { progress: current },
86
90
  next: next && { progress: next },
91
+ direction,
87
92
  layouts: {
88
93
  header: {
89
94
  height: headerHeight,
@@ -101,6 +106,7 @@ export function HeaderSegment(props: Props) {
101
106
  layout,
102
107
  modal,
103
108
  onGoBack,
109
+ backHref,
104
110
  headerTitle: title,
105
111
  headerLeft: left = onGoBack
106
112
  ? (props: HeaderBackButtonProps) => <HeaderBackButton {...props} />
@@ -154,6 +160,7 @@ export function HeaderSegment(props: Props) {
154
160
  ? (props) =>
155
161
  left({
156
162
  ...props,
163
+ href: backHref,
157
164
  backImage: headerBackImage,
158
165
  accessibilityLabel: headerBackAccessibilityLabel,
159
166
  testID: headerBackTestID,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Animated, View, ViewProps } from 'react-native';
2
+ import { Animated, View, type ViewProps } from 'react-native';
3
3
 
4
4
  let Screens: typeof import('react-native-screens') | undefined;
5
5
 
@@ -32,6 +32,7 @@ export const MaybeScreen = ({
32
32
  active: 0 | 1 | Animated.AnimatedInterpolation<0 | 1>;
33
33
  children: React.ReactNode;
34
34
  freezeOnBlur?: boolean;
35
+ homeIndicatorHidden?: boolean;
35
36
  }) => {
36
37
  if (Screens != null) {
37
38
  return (