@react-navigation/native-stack 7.0.0-rc.8 → 7.0.0

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 (173) hide show
  1. package/lib/commonjs/{index.cjs → index.js} +4 -4
  2. package/lib/commonjs/navigators/{createNativeStackNavigator.cjs → createNativeStackNavigator.js} +5 -3
  3. package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -0
  4. package/lib/commonjs/package.json +1 -0
  5. package/lib/commonjs/{types.cjs → types.js} +1 -1
  6. package/lib/commonjs/utils/{debounce.cjs → debounce.js} +1 -1
  7. package/lib/commonjs/utils/{debounce.cjs.map → debounce.js.map} +1 -1
  8. package/lib/commonjs/utils/{getModalRoutesKeys.cjs → getModalRoutesKeys.js} +1 -1
  9. package/lib/commonjs/utils/{useAnimatedHeaderHeight.cjs → useAnimatedHeaderHeight.js} +1 -1
  10. package/lib/commonjs/utils/{useDismissedRouteError.cjs → useDismissedRouteError.js} +1 -1
  11. package/lib/commonjs/utils/{useInvalidPreventRemoveError.cjs → useInvalidPreventRemoveError.js} +1 -1
  12. package/lib/commonjs/views/{FontProcessor.cjs → FontProcessor.js} +1 -1
  13. package/lib/commonjs/views/{FontProcessor.native.cjs → FontProcessor.native.js} +1 -1
  14. package/lib/commonjs/views/FooterComponent.js +19 -0
  15. package/lib/commonjs/views/FooterComponent.js.map +1 -0
  16. package/lib/commonjs/views/{NativeStackView.cjs → NativeStackView.js} +46 -50
  17. package/lib/commonjs/views/NativeStackView.js.map +1 -0
  18. package/lib/commonjs/views/{NativeStackView.native.cjs → NativeStackView.native.js} +132 -145
  19. package/lib/commonjs/views/NativeStackView.native.js.map +1 -0
  20. package/lib/commonjs/views/{HeaderConfig.cjs → useHeaderConfigProps.js} +70 -49
  21. package/lib/commonjs/views/useHeaderConfigProps.js.map +1 -0
  22. package/lib/module/{index.mjs → index.js} +6 -4
  23. package/lib/module/index.js.map +1 -0
  24. package/lib/module/navigators/{createNativeStackNavigator.mjs → createNativeStackNavigator.js} +7 -3
  25. package/lib/module/navigators/createNativeStackNavigator.js.map +1 -0
  26. package/lib/module/package.json +1 -0
  27. package/lib/module/types.js +4 -0
  28. package/lib/module/utils/{debounce.mjs → debounce.js} +3 -1
  29. package/lib/module/utils/debounce.js.map +1 -0
  30. package/lib/module/utils/{getModalRoutesKeys.mjs → getModalRoutesKeys.js} +3 -1
  31. package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
  32. package/lib/module/utils/{useAnimatedHeaderHeight.mjs → useAnimatedHeaderHeight.js} +3 -1
  33. package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -0
  34. package/lib/module/utils/{useDismissedRouteError.mjs → useDismissedRouteError.js} +3 -1
  35. package/lib/module/utils/useDismissedRouteError.js.map +1 -0
  36. package/lib/module/utils/{useInvalidPreventRemoveError.mjs → useInvalidPreventRemoveError.js} +3 -1
  37. package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -0
  38. package/lib/module/views/{FontProcessor.mjs → FontProcessor.js} +3 -1
  39. package/lib/module/views/{FontProcessor.mjs.map → FontProcessor.js.map} +1 -1
  40. package/lib/module/views/{FontProcessor.native.mjs → FontProcessor.native.js} +3 -1
  41. package/lib/module/views/FontProcessor.native.js.map +1 -0
  42. package/lib/module/views/FooterComponent.js +14 -0
  43. package/lib/module/views/FooterComponent.js.map +1 -0
  44. package/lib/module/views/{NativeStackView.mjs → NativeStackView.js} +50 -52
  45. package/lib/module/views/NativeStackView.js.map +1 -0
  46. package/lib/module/views/{NativeStackView.native.mjs → NativeStackView.native.js} +135 -145
  47. package/lib/module/views/NativeStackView.native.js.map +1 -0
  48. package/lib/module/views/{HeaderConfig.mjs → useHeaderConfigProps.js} +72 -49
  49. package/lib/module/views/useHeaderConfigProps.js.map +1 -0
  50. package/lib/typescript/commonjs/package.json +1 -0
  51. package/lib/typescript/{src → commonjs/src}/index.d.ts +1 -1
  52. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  53. package/lib/typescript/{src → commonjs/src}/navigators/createNativeStackNavigator.d.ts +2 -2
  54. package/lib/typescript/commonjs/src/navigators/createNativeStackNavigator.d.ts.map +1 -0
  55. package/lib/typescript/{src → commonjs/src}/types.d.ts +113 -35
  56. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/src/utils/debounce.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/src/utils/useDismissedRouteError.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/src/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
  62. package/lib/typescript/commonjs/src/views/FontProcessor.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/src/views/FontProcessor.native.d.ts.map +1 -0
  64. package/lib/typescript/commonjs/src/views/FooterComponent.d.ts +7 -0
  65. package/lib/typescript/commonjs/src/views/FooterComponent.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/src/views/NativeStackView.d.ts +11 -0
  67. package/lib/typescript/commonjs/src/views/NativeStackView.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/src/views/NativeStackView.native.d.ts +11 -0
  69. package/lib/typescript/commonjs/src/views/NativeStackView.native.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/src/views/useHeaderConfigProps.d.ts +41 -0
  71. package/lib/typescript/commonjs/src/views/useHeaderConfigProps.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
  73. package/lib/typescript/module/package.json +1 -0
  74. package/lib/typescript/module/src/index.d.ts +17 -0
  75. package/lib/typescript/module/src/index.d.ts.map +1 -0
  76. package/lib/typescript/module/src/navigators/createNativeStackNavigator.d.ts +16 -0
  77. package/lib/typescript/module/src/navigators/createNativeStackNavigator.d.ts.map +1 -0
  78. package/lib/typescript/module/src/types.d.ts +623 -0
  79. package/lib/typescript/module/src/types.d.ts.map +1 -0
  80. package/lib/typescript/module/src/utils/debounce.d.ts +2 -0
  81. package/lib/typescript/module/src/utils/debounce.d.ts.map +1 -0
  82. package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts +4 -0
  83. package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  84. package/lib/typescript/module/src/utils/useAnimatedHeaderHeight.d.ts +5 -0
  85. package/lib/typescript/module/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  86. package/lib/typescript/module/src/utils/useDismissedRouteError.d.ts +6 -0
  87. package/lib/typescript/module/src/utils/useDismissedRouteError.d.ts.map +1 -0
  88. package/lib/typescript/module/src/utils/useInvalidPreventRemoveError.d.ts +3 -0
  89. package/lib/typescript/module/src/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
  90. package/lib/typescript/module/src/views/FontProcessor.d.ts +2 -0
  91. package/lib/typescript/module/src/views/FontProcessor.d.ts.map +1 -0
  92. package/lib/typescript/module/src/views/FontProcessor.native.d.ts +2 -0
  93. package/lib/typescript/module/src/views/FontProcessor.native.d.ts.map +1 -0
  94. package/lib/typescript/module/src/views/FooterComponent.d.ts +7 -0
  95. package/lib/typescript/module/src/views/FooterComponent.d.ts.map +1 -0
  96. package/lib/typescript/module/src/views/NativeStackView.d.ts +11 -0
  97. package/lib/typescript/module/src/views/NativeStackView.d.ts.map +1 -0
  98. package/lib/typescript/module/src/views/NativeStackView.native.d.ts +11 -0
  99. package/lib/typescript/module/src/views/NativeStackView.native.d.ts.map +1 -0
  100. package/lib/typescript/module/src/views/useHeaderConfigProps.d.ts +41 -0
  101. package/lib/typescript/module/src/views/useHeaderConfigProps.d.ts.map +1 -0
  102. package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
  103. package/package.json +36 -19
  104. package/src/index.tsx +2 -0
  105. package/src/navigators/createNativeStackNavigator.tsx +6 -5
  106. package/src/types.tsx +107 -35
  107. package/src/utils/debounce.tsx +1 -1
  108. package/src/views/FooterComponent.tsx +10 -0
  109. package/src/views/NativeStackView.native.tsx +168 -202
  110. package/src/views/NativeStackView.tsx +62 -50
  111. package/src/views/{HeaderConfig.tsx → useHeaderConfigProps.tsx} +80 -63
  112. package/lib/commonjs/navigators/createNativeStackNavigator.cjs.map +0 -1
  113. package/lib/commonjs/views/DebugContainer.cjs +0 -22
  114. package/lib/commonjs/views/DebugContainer.cjs.map +0 -1
  115. package/lib/commonjs/views/DebugContainer.native.cjs +0 -49
  116. package/lib/commonjs/views/DebugContainer.native.cjs.map +0 -1
  117. package/lib/commonjs/views/HeaderConfig.cjs.map +0 -1
  118. package/lib/commonjs/views/NativeStackView.cjs.map +0 -1
  119. package/lib/commonjs/views/NativeStackView.native.cjs.map +0 -1
  120. package/lib/module/index.mjs.map +0 -1
  121. package/lib/module/navigators/createNativeStackNavigator.mjs.map +0 -1
  122. package/lib/module/types.mjs +0 -2
  123. package/lib/module/utils/debounce.mjs.map +0 -1
  124. package/lib/module/utils/getModalRoutesKeys.mjs.map +0 -1
  125. package/lib/module/utils/useAnimatedHeaderHeight.mjs.map +0 -1
  126. package/lib/module/utils/useDismissedRouteError.mjs.map +0 -1
  127. package/lib/module/utils/useInvalidPreventRemoveError.mjs.map +0 -1
  128. package/lib/module/views/DebugContainer.mjs +0 -14
  129. package/lib/module/views/DebugContainer.mjs.map +0 -1
  130. package/lib/module/views/DebugContainer.native.mjs +0 -38
  131. package/lib/module/views/DebugContainer.native.mjs.map +0 -1
  132. package/lib/module/views/FontProcessor.native.mjs.map +0 -1
  133. package/lib/module/views/HeaderConfig.mjs.map +0 -1
  134. package/lib/module/views/NativeStackView.mjs.map +0 -1
  135. package/lib/module/views/NativeStackView.native.mjs.map +0 -1
  136. package/lib/typescript/src/index.d.ts.map +0 -1
  137. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +0 -1
  138. package/lib/typescript/src/types.d.ts.map +0 -1
  139. package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
  140. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +0 -1
  141. package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +0 -1
  142. package/lib/typescript/src/utils/useDismissedRouteError.d.ts.map +0 -1
  143. package/lib/typescript/src/utils/useInvalidPreventRemoveError.d.ts.map +0 -1
  144. package/lib/typescript/src/views/DebugContainer.d.ts +0 -10
  145. package/lib/typescript/src/views/DebugContainer.d.ts.map +0 -1
  146. package/lib/typescript/src/views/DebugContainer.native.d.ts +0 -15
  147. package/lib/typescript/src/views/DebugContainer.native.d.ts.map +0 -1
  148. package/lib/typescript/src/views/FontProcessor.d.ts.map +0 -1
  149. package/lib/typescript/src/views/FontProcessor.native.d.ts.map +0 -1
  150. package/lib/typescript/src/views/HeaderConfig.d.ts +0 -11
  151. package/lib/typescript/src/views/HeaderConfig.d.ts.map +0 -1
  152. package/lib/typescript/src/views/NativeStackView.d.ts +0 -10
  153. package/lib/typescript/src/views/NativeStackView.d.ts.map +0 -1
  154. package/lib/typescript/src/views/NativeStackView.native.d.ts +0 -10
  155. package/lib/typescript/src/views/NativeStackView.native.d.ts.map +0 -1
  156. package/src/views/DebugContainer.native.tsx +0 -36
  157. package/src/views/DebugContainer.tsx +0 -14
  158. /package/lib/commonjs/{index.cjs.map → index.js.map} +0 -0
  159. /package/lib/commonjs/{types.cjs.map → types.js.map} +0 -0
  160. /package/lib/commonjs/utils/{getModalRoutesKeys.cjs.map → getModalRoutesKeys.js.map} +0 -0
  161. /package/lib/commonjs/utils/{useAnimatedHeaderHeight.cjs.map → useAnimatedHeaderHeight.js.map} +0 -0
  162. /package/lib/commonjs/utils/{useDismissedRouteError.cjs.map → useDismissedRouteError.js.map} +0 -0
  163. /package/lib/commonjs/utils/{useInvalidPreventRemoveError.cjs.map → useInvalidPreventRemoveError.js.map} +0 -0
  164. /package/lib/commonjs/views/{FontProcessor.cjs.map → FontProcessor.js.map} +0 -0
  165. /package/lib/commonjs/views/{FontProcessor.native.cjs.map → FontProcessor.native.js.map} +0 -0
  166. /package/lib/module/{types.mjs.map → types.js.map} +0 -0
  167. /package/lib/typescript/{src → commonjs/src}/utils/debounce.d.ts +0 -0
  168. /package/lib/typescript/{src → commonjs/src}/utils/getModalRoutesKeys.d.ts +0 -0
  169. /package/lib/typescript/{src → commonjs/src}/utils/useAnimatedHeaderHeight.d.ts +0 -0
  170. /package/lib/typescript/{src → commonjs/src}/utils/useDismissedRouteError.d.ts +0 -0
  171. /package/lib/typescript/{src → commonjs/src}/utils/useInvalidPreventRemoveError.d.ts +0 -0
  172. /package/lib/typescript/{src → commonjs/src}/views/FontProcessor.d.ts +0 -0
  173. /package/lib/typescript/{src → commonjs/src}/views/FontProcessor.native.d.ts +0 -0
@@ -1,68 +1,20 @@
1
+ "use strict";
2
+
1
3
  import { getDefaultHeaderHeight, getHeaderTitle, HeaderBackContext, HeaderHeightContext, HeaderShownContext, SafeAreaProviderCompat } from '@react-navigation/elements';
2
4
  import { NavigationContext, NavigationRouteContext, StackActions, usePreventRemoveContext, useTheme } from '@react-navigation/native';
3
5
  import * as React from 'react';
4
6
  import { Animated, Platform, StatusBar, StyleSheet, useAnimatedValue, View } from 'react-native';
5
7
  import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import { Screen, ScreenStack } from 'react-native-screens';
7
- import warnOnce from 'warn-once';
8
- import { debounce } from "../utils/debounce.mjs";
9
- import { getModalRouteKeys } from "../utils/getModalRoutesKeys.mjs";
10
- import { AnimatedHeaderHeightContext } from "../utils/useAnimatedHeaderHeight.mjs";
11
- import { useDismissedRouteError } from "../utils/useDismissedRouteError.mjs";
12
- import { useInvalidPreventRemoveError } from "../utils/useInvalidPreventRemoveError.mjs";
13
- import { DebugContainer } from "./DebugContainer.mjs";
14
- import { HeaderConfig } from "./HeaderConfig.mjs";
8
+ import { ScreenStack, ScreenStackItem } from 'react-native-screens';
9
+ import { debounce } from "../utils/debounce.js";
10
+ import { getModalRouteKeys } from "../utils/getModalRoutesKeys.js";
11
+ import { AnimatedHeaderHeightContext } from "../utils/useAnimatedHeaderHeight.js";
12
+ import { useDismissedRouteError } from "../utils/useDismissedRouteError.js";
13
+ import { useInvalidPreventRemoveError } from "../utils/useInvalidPreventRemoveError.js";
14
+ import { FooterComponent } from "./FooterComponent.js";
15
+ import { useHeaderConfigProps } from "./useHeaderConfigProps.js";
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
- const isAndroid = Platform.OS === 'android';
17
- const MaybeNestedStack = ({
18
- options,
19
- route,
20
- presentation,
21
- headerHeight,
22
- headerTopInsetEnabled,
23
- children
24
- }) => {
25
- const {
26
- colors
27
- } = useTheme();
28
- const {
29
- header,
30
- headerShown = true,
31
- contentStyle
32
- } = options;
33
- const isHeaderInModal = isAndroid ? false : presentation !== 'card' && headerShown === true && header === undefined;
34
- const headerShownPreviousRef = React.useRef(headerShown);
35
- React.useEffect(() => {
36
- warnOnce(!isAndroid && presentation !== 'card' && headerShownPreviousRef.current !== headerShown, `Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`);
37
- headerShownPreviousRef.current = headerShown;
38
- }, [headerShown, presentation, route.name]);
39
- const content = /*#__PURE__*/_jsx(DebugContainer, {
40
- style: [styles.container, presentation !== 'transparentModal' && presentation !== 'containedTransparentModal' && {
41
- backgroundColor: colors.background
42
- }, contentStyle],
43
- stackPresentation: presentation === 'card' ? 'push' : presentation,
44
- children: children
45
- });
46
- if (isHeaderInModal) {
47
- return /*#__PURE__*/_jsx(ScreenStack, {
48
- style: styles.container,
49
- children: /*#__PURE__*/_jsxs(Screen, {
50
- enabled: true,
51
- isNativeStack: true,
52
- hasLargeHeader: options.headerLargeTitle ?? false,
53
- style: StyleSheet.absoluteFill,
54
- children: [content, /*#__PURE__*/_jsx(HeaderConfig, {
55
- ...options,
56
- route: route,
57
- headerHeight: headerHeight,
58
- headerTopInsetEnabled: headerTopInsetEnabled,
59
- canGoBack: true
60
- })]
61
- })
62
- });
63
- }
64
- return content;
65
- };
17
+ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
66
18
  const SceneView = ({
67
19
  index,
68
20
  focused,
@@ -70,6 +22,7 @@ const SceneView = ({
70
22
  previousDescriptor,
71
23
  nextDescriptor,
72
24
  isPresentationModal,
25
+ isPreloaded,
73
26
  onWillDisappear,
74
27
  onWillAppear,
75
28
  onAppear,
@@ -77,7 +30,8 @@ const SceneView = ({
77
30
  onDismissed,
78
31
  onHeaderBackButtonClicked,
79
32
  onNativeDismissCancelled,
80
- onGestureCancel
33
+ onGestureCancel,
34
+ onSheetDetentChanged
81
35
  }) => {
82
36
  const {
83
37
  route,
@@ -94,6 +48,7 @@ const SceneView = ({
94
48
  const {
95
49
  animationDuration,
96
50
  animationTypeForReplace = 'push',
51
+ fullScreenGestureShadowEnabled = true,
97
52
  gestureEnabled,
98
53
  gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',
99
54
  gestureResponseDistance,
@@ -108,17 +63,21 @@ const SceneView = ({
108
63
  navigationBarTranslucent,
109
64
  navigationBarHidden,
110
65
  orientation,
111
- sheetAllowedDetents = 'large',
112
- sheetLargestUndimmedDetent = 'all',
66
+ sheetAllowedDetents = [1.0],
67
+ sheetLargestUndimmedDetentIndex = -1,
113
68
  sheetGrabberVisible = false,
114
69
  sheetCornerRadius = -1.0,
70
+ sheetElevation = 24,
115
71
  sheetExpandsWhenScrolledToEdge = true,
72
+ sheetInitialDetentIndex = 0,
116
73
  statusBarAnimation,
117
74
  statusBarHidden,
118
75
  statusBarStyle,
119
76
  statusBarTranslucent,
120
77
  statusBarBackgroundColor,
121
- freezeOnBlur
78
+ unstable_sheetFooter = null,
79
+ freezeOnBlur,
80
+ contentStyle
122
81
  } = options;
123
82
  if (gestureDirection === 'vertical' && Platform.OS === 'ios') {
124
83
  // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
@@ -146,6 +105,9 @@ const SceneView = ({
146
105
  // for navigator with first screen as `modal` and the next as `card`
147
106
  presentation = 'card';
148
107
  }
108
+ const {
109
+ colors
110
+ } = useTheme();
149
111
  const insets = useSafeAreaInsets();
150
112
  const frame = useSafeAreaFrame();
151
113
 
@@ -166,7 +128,7 @@ const SceneView = ({
166
128
  // FIXME: Currently screens isn't using Material 3
167
129
  // So our `getDefaultHeaderHeight` doesn't return the correct value
168
130
  // So we hardcode the value here for now until screens is updated
169
- android: 56 + topInset,
131
+ android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,
170
132
  default: getDefaultHeaderHeight(frame, isModal, topInset)
171
133
  });
172
134
  const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);
@@ -177,7 +139,7 @@ const SceneView = ({
177
139
  debounce(setHeaderHeight, 100), []);
178
140
  const hasCustomHeader = header !== undefined;
179
141
  let headerHeightCorrectionOffset = 0;
180
- if (isAndroid && !hasCustomHeader) {
142
+ if (Platform.OS === 'android' && !hasCustomHeader) {
181
143
  const statusBarHeight = StatusBar.currentHeight ?? 0;
182
144
 
183
145
  // FIXME: On Android, the native header height is not correctly calculated
@@ -196,29 +158,46 @@ const SceneView = ({
196
158
  // we apply additional padding in header only if its true.
197
159
  // For more details see: https://github.com/react-navigation/react-navigation/pull/12014
198
160
  const headerTopInsetEnabled = typeof statusBarTranslucent === 'boolean' ? statusBarTranslucent : topInset !== 0;
161
+ const canGoBack = previousDescriptor != null || parentHeaderBack != null;
199
162
  const backTitle = previousDescriptor ? getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name) : parentHeaderBack?.title;
200
- const headerBack = React.useMemo(() => ({
201
- // No href needed for native
202
- href: undefined,
203
- title: backTitle
204
- }), [backTitle]);
163
+ const headerBack = React.useMemo(() => {
164
+ if (canGoBack) {
165
+ return {
166
+ href: undefined,
167
+ // No href needed for native
168
+ title: backTitle
169
+ };
170
+ }
171
+ return undefined;
172
+ }, [canGoBack, backTitle]);
205
173
  const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;
206
- return /*#__PURE__*/_jsx(Screen, {
207
- enabled: true,
208
- isNativeStack: true,
174
+ const headerConfig = useHeaderConfigProps({
175
+ ...options,
176
+ route,
177
+ canGoBack,
178
+ headerBackButtonMenuEnabled: isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,
179
+ headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,
180
+ headerHeight,
181
+ headerShown: header !== undefined ? false : headerShown,
182
+ headerTopInsetEnabled
183
+ });
184
+ return /*#__PURE__*/_jsx(ScreenStackItem, {
185
+ screenId: route.key,
186
+ activityState: isPreloaded ? 0 : 2,
209
187
  style: StyleSheet.absoluteFill,
210
- hasLargeHeader: options.headerLargeTitle ?? false,
188
+ accessibilityElementsHidden: !focused,
189
+ importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
211
190
  customAnimationOnSwipe: animationMatchesGesture,
212
191
  fullScreenSwipeEnabled: fullScreenGestureEnabled,
213
- gestureEnabled: isAndroid ?
192
+ fullScreenSwipeShadowEnabled: fullScreenGestureShadowEnabled,
193
+ freezeOnBlur: freezeOnBlur,
194
+ gestureEnabled: Platform.OS === 'android' ?
214
195
  // This prop enables handling of system back gestures on Android
215
196
  // Since we handle them in JS side, we disable this
216
197
  false : gestureEnabled,
217
198
  homeIndicatorHidden: autoHideHomeIndicator,
218
199
  hideKeyboardOnSwipe: keyboardHandlingEnabled,
219
- navigationBarColor: navigationBarColor
220
- // @ts-expect-error prop supported from react-native-screens 3.32.0 onwards
221
- ,
200
+ navigationBarColor: navigationBarColor,
222
201
  navigationBarTranslucent: navigationBarTranslucent,
223
202
  navigationBarHidden: navigationBarHidden,
224
203
  replaceAnimation: animationTypeForReplace,
@@ -226,9 +205,11 @@ const SceneView = ({
226
205
  stackAnimation: animation,
227
206
  screenOrientation: orientation,
228
207
  sheetAllowedDetents: sheetAllowedDetents,
229
- sheetLargestUndimmedDetent: sheetLargestUndimmedDetent,
208
+ sheetLargestUndimmedDetentIndex: sheetLargestUndimmedDetentIndex,
230
209
  sheetGrabberVisible: sheetGrabberVisible,
210
+ sheetInitialDetentIndex: sheetInitialDetentIndex,
231
211
  sheetCornerRadius: sheetCornerRadius,
212
+ sheetElevation: sheetElevation,
232
213
  sheetExpandsWhenScrolledToEdge: sheetExpandsWhenScrolledToEdge,
233
214
  statusBarAnimation: statusBarAnimation,
234
215
  statusBarHidden: statusBarHidden,
@@ -243,6 +224,7 @@ const SceneView = ({
243
224
  onDisappear: onDisappear,
244
225
  onDismissed: onDismissed,
245
226
  onGestureCancel: onGestureCancel,
227
+ onSheetDetentChanged: onSheetDetentChanged,
246
228
  gestureResponseDistance: gestureResponseDistance,
247
229
  nativeBackButtonDismissalEnabled: false // on Android
248
230
  ,
@@ -262,6 +244,12 @@ const SceneView = ({
262
244
  }], {
263
245
  useNativeDriver: true,
264
246
  listener: e => {
247
+ if (Platform.OS === 'android' && (options.headerBackground != null || options.headerTransparent)) {
248
+ // FIXME: On Android, we get 0 if the header is translucent
249
+ // So we set a default height in that case
250
+ setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
251
+ return;
252
+ }
265
253
  if (e.nativeEvent && typeof e.nativeEvent === 'object' && 'headerHeight' in e.nativeEvent && typeof e.nativeEvent.headerHeight === 'number') {
266
254
  const headerHeight = e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
267
255
 
@@ -275,70 +263,56 @@ const SceneView = ({
275
263
  }
276
264
  }
277
265
  }
278
- })
279
- // this prop is available since rn-screens 3.16
266
+ }),
267
+ contentStyle: [presentation !== 'transparentModal' && presentation !== 'containedTransparentModal' && {
268
+ backgroundColor: colors.background
269
+ }, contentStyle],
270
+ headerConfig: headerConfig
271
+ // When ts-expect-error is added, it affects all the props below it
272
+ // So we keep any props that need it at the end
273
+ // Otherwise invalid props may not be caught by TypeScript
280
274
  ,
281
- freezeOnBlur: freezeOnBlur,
282
275
  children: /*#__PURE__*/_jsx(NavigationContext.Provider, {
283
276
  value: navigation,
284
277
  children: /*#__PURE__*/_jsx(NavigationRouteContext.Provider, {
285
278
  value: route,
286
- children: /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
287
- value: isParentHeaderShown || headerShown !== false,
288
- children: /*#__PURE__*/_jsx(AnimatedHeaderHeightContext.Provider, {
289
- value: animatedHeaderHeight,
290
- children: /*#__PURE__*/_jsxs(HeaderHeightContext.Provider, {
291
- value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0,
292
- children: [headerBackground != null ?
293
- /*#__PURE__*/
294
- /**
295
- * To show a custom header background, we render it at the top of the screen below the header
296
- * The header also needs to be positioned absolutely (with `translucent` style)
297
- */
298
- _jsx(View, {
299
- style: [styles.background, headerTransparent ? styles.translucent : null, {
300
- height: headerHeight
301
- }],
302
- children: headerBackground()
303
- }) : null, /*#__PURE__*/_jsxs(View, {
304
- accessibilityElementsHidden: !focused,
305
- importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
306
- style: styles.scene,
307
- children: [/*#__PURE__*/_jsx(MaybeNestedStack, {
308
- options: options,
309
- route: route,
310
- presentation: presentation,
311
- headerHeight: headerHeight,
312
- headerTopInsetEnabled: headerTopInsetEnabled,
313
- children: /*#__PURE__*/_jsx(HeaderBackContext.Provider, {
314
- value: headerBack,
315
- children: render()
316
- })
317
- }), header !== undefined && headerShown !== false ? /*#__PURE__*/_jsx(View, {
318
- onLayout: e => {
319
- const headerHeight = e.nativeEvent.layout.height;
320
- setHeaderHeight(headerHeight);
321
- rawAnimatedHeaderHeight.setValue(headerHeight);
322
- },
323
- style: headerTransparent ? styles.absolute : null,
324
- children: header({
325
- back: headerBack,
326
- options,
327
- route,
328
- navigation
329
- })
330
- }) : null]
331
- }), /*#__PURE__*/_jsx(HeaderConfig, {
332
- ...options,
333
- route: route,
334
- headerBackButtonMenuEnabled: isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,
335
- headerShown: header !== undefined ? false : headerShown,
336
- headerHeight: headerHeight,
337
- headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,
338
- headerTopInsetEnabled: headerTopInsetEnabled,
339
- canGoBack: headerBack !== undefined
340
- })]
341
- })
279
+ children: /*#__PURE__*/_jsx(AnimatedHeaderHeightContext.Provider, {
280
+ value: animatedHeaderHeight,
281
+ children: /*#__PURE__*/_jsxs(HeaderHeightContext.Provider, {
282
+ value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0,
283
+ children: [headerBackground != null ?
284
+ /*#__PURE__*/
285
+ /**
286
+ * To show a custom header background, we render it at the top of the screen below the header
287
+ * The header also needs to be positioned absolutely (with `translucent` style)
288
+ */
289
+ _jsx(View, {
290
+ style: [styles.background, headerTransparent ? styles.translucent : null, {
291
+ height: headerHeight
292
+ }],
293
+ children: headerBackground()
294
+ }) : null, header !== undefined && headerShown !== false ? /*#__PURE__*/_jsx(View, {
295
+ onLayout: e => {
296
+ const headerHeight = e.nativeEvent.layout.height;
297
+ setHeaderHeight(headerHeight);
298
+ rawAnimatedHeaderHeight.setValue(headerHeight);
299
+ },
300
+ style: [styles.header, headerTransparent ? styles.absolute : null],
301
+ children: header({
302
+ back: headerBack,
303
+ options,
304
+ route,
305
+ navigation
306
+ })
307
+ }) : null, /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
308
+ value: isParentHeaderShown || headerShown !== false,
309
+ children: /*#__PURE__*/_jsx(HeaderBackContext.Provider, {
310
+ value: headerBack,
311
+ children: render()
312
+ })
313
+ }), presentation === 'formSheet' && unstable_sheetFooter && /*#__PURE__*/_jsx(FooterComponent, {
314
+ children: unstable_sheetFooter()
315
+ })]
342
316
  })
343
317
  })
344
318
  })
@@ -348,7 +322,8 @@ const SceneView = ({
348
322
  export function NativeStackView({
349
323
  state,
350
324
  navigation,
351
- descriptors
325
+ descriptors,
326
+ describe
352
327
  }) {
353
328
  const {
354
329
  setNextDismissedKey
@@ -358,20 +333,25 @@ export function NativeStackView({
358
333
  } = useTheme();
359
334
  useInvalidPreventRemoveError(descriptors);
360
335
  const modalRouteKeys = getModalRouteKeys(state.routes, descriptors);
336
+ const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
337
+ acc[route.key] = acc[route.key] || describe(route, true);
338
+ return acc;
339
+ }, {});
361
340
  return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
362
341
  style: {
363
342
  backgroundColor: colors.background
364
343
  },
365
344
  children: /*#__PURE__*/_jsx(ScreenStack, {
366
345
  style: styles.container,
367
- children: state.routes.map((route, index) => {
368
- const descriptor = descriptors[route.key];
346
+ children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
347
+ const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
369
348
  const isFocused = state.index === index;
370
349
  const previousKey = state.routes[index - 1]?.key;
371
350
  const nextKey = state.routes[index + 1]?.key;
372
351
  const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
373
352
  const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
374
353
  const isModal = modalRouteKeys.includes(route.key);
354
+ const isPreloaded = preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;
375
355
  return /*#__PURE__*/_jsx(SceneView, {
376
356
  index: index,
377
357
  focused: isFocused,
@@ -379,6 +359,7 @@ export function NativeStackView({
379
359
  previousDescriptor: previousDescriptor,
380
360
  nextDescriptor: nextDescriptor,
381
361
  isPresentationModal: isModal,
362
+ isPreloaded: isPreloaded,
382
363
  onWillDisappear: () => {
383
364
  navigation.emit({
384
365
  type: 'transitionStart',
@@ -442,6 +423,16 @@ export function NativeStackView({
442
423
  type: 'gestureCancel',
443
424
  target: route.key
444
425
  });
426
+ },
427
+ onSheetDetentChanged: event => {
428
+ navigation.emit({
429
+ type: 'sheetDetentChange',
430
+ target: route.key,
431
+ data: {
432
+ index: event.nativeEvent.index,
433
+ stable: event.nativeEvent.isStable
434
+ }
435
+ });
445
436
  }
446
437
  }, route.key);
447
438
  })
@@ -452,9 +443,8 @@ const styles = StyleSheet.create({
452
443
  container: {
453
444
  flex: 1
454
445
  },
455
- scene: {
456
- flex: 1,
457
- flexDirection: 'column-reverse'
446
+ header: {
447
+ zIndex: 1
458
448
  },
459
449
  absolute: {
460
450
  position: 'absolute',
@@ -474,4 +464,4 @@ const styles = StyleSheet.create({
474
464
  overflow: 'hidden'
475
465
  }
476
466
  });
477
- //# sourceMappingURL=NativeStackView.native.mjs.map
467
+ //# sourceMappingURL=NativeStackView.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultHeaderHeight","getHeaderTitle","HeaderBackContext","HeaderHeightContext","HeaderShownContext","SafeAreaProviderCompat","NavigationContext","NavigationRouteContext","StackActions","usePreventRemoveContext","useTheme","React","Animated","Platform","StatusBar","StyleSheet","useAnimatedValue","View","useSafeAreaFrame","useSafeAreaInsets","ScreenStack","ScreenStackItem","debounce","getModalRouteKeys","AnimatedHeaderHeightContext","useDismissedRouteError","useInvalidPreventRemoveError","FooterComponent","useHeaderConfigProps","jsx","_jsx","jsxs","_jsxs","ANDROID_DEFAULT_HEADER_HEIGHT","SceneView","index","focused","descriptor","previousDescriptor","nextDescriptor","isPresentationModal","isPreloaded","onWillDisappear","onWillAppear","onAppear","onDisappear","onDismissed","onHeaderBackButtonClicked","onNativeDismissCancelled","onGestureCancel","onSheetDetentChanged","route","navigation","options","render","animation","animationMatchesGesture","presentation","fullScreenGestureEnabled","animationDuration","animationTypeForReplace","fullScreenGestureShadowEnabled","gestureEnabled","gestureDirection","gestureResponseDistance","header","headerBackButtonMenuEnabled","headerShown","headerBackground","headerTransparent","autoHideHomeIndicator","keyboardHandlingEnabled","navigationBarColor","navigationBarTranslucent","navigationBarHidden","orientation","sheetAllowedDetents","sheetLargestUndimmedDetentIndex","sheetGrabberVisible","sheetCornerRadius","sheetElevation","sheetExpandsWhenScrolledToEdge","sheetInitialDetentIndex","statusBarAnimation","statusBarHidden","statusBarStyle","statusBarTranslucent","statusBarBackgroundColor","unstable_sheetFooter","freezeOnBlur","contentStyle","OS","undefined","nextGestureDirection","gestureDirectionOverride","colors","insets","frame","isModal","isIPhone","isPad","isTV","isLandscape","width","height","isParentHeaderShown","useContext","parentHeaderHeight","parentHeaderBack","topInset","top","preventedRoutes","defaultHeaderHeight","select","android","default","headerHeight","setHeaderHeight","useState","setHeaderHeightDebounced","useCallback","hasCustomHeader","headerHeightCorrectionOffset","statusBarHeight","currentHeight","rawAnimatedHeaderHeight","animatedHeaderHeight","useMemo","add","headerTopInsetEnabled","canGoBack","backTitle","name","title","headerBack","href","isRemovePrevented","key","preventRemove","headerConfig","headerBackTitle","screenId","activityState","style","absoluteFill","accessibilityElementsHidden","importantForAccessibility","customAnimationOnSwipe","fullScreenSwipeEnabled","fullScreenSwipeShadowEnabled","homeIndicatorHidden","hideKeyboardOnSwipe","replaceAnimation","stackPresentation","stackAnimation","screenOrientation","statusBarColor","swipeDirection","transitionDuration","nativeBackButtonDismissalEnabled","preventNativeDismiss","onHeaderHeightChange","event","nativeEvent","useNativeDriver","listener","e","doesHeaderAnimate","headerLargeTitle","headerSearchBarOptions","backgroundColor","background","children","Provider","value","styles","translucent","onLayout","layout","setValue","absolute","back","NativeStackView","state","descriptors","describe","setNextDismissedKey","modalRouteKeys","routes","preloadedDescriptors","preloadedRoutes","reduce","acc","container","concat","map","isFocused","previousKey","nextKey","includes","emit","type","data","closing","target","dispatch","pop","dismissCount","source","stable","isStable","create","flex","zIndex","position","start","end","elevation","overflow"],"sourceRoot":"../../../src","sources":["views/NativeStackView.native.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,sBAAsB,QACjB,4BAA4B;AACnC,SACEC,iBAAiB,EACjBC,sBAAsB,EAGtBC,YAAY,EAEZC,uBAAuB,EACvBC,QAAQ,QACH,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,gBAAgB,EAChBC,IAAI,QACC,cAAc;AACrB,SACEC,gBAAgB,EACh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AAK,CAACC,WAAW,CAAC+C;cAC5B;YACF,CAAC,CAAC;UACJ;QAAE,GA1EG/J,KAAK,CAACsF,GA2EZ,CAAC;MAEN,CAAC;IAAC,CACS;EAAC,CACQ,CAAC;AAE7B;AAEA,MAAMsC,MAAM,GAAGhK,UAAU,CAACoM,MAAM,CAAC;EAC/BlB,SAAS,EAAE;IACTmB,IAAI,EAAE;EACR,CAAC;EACDnJ,MAAM,EAAE;IACNoJ,MAAM,EAAE;EACV,CAAC;EACDjC,QAAQ,EAAE;IACRkC,QAAQ,EAAE,UAAU;IACpBxG,GAAG,EAAE,CAAC;IACNyG,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE;EACP,CAAC;EACDxC,WAAW,EAAE;IACXsC,QAAQ,EAAE,UAAU;IACpBxG,GAAG,EAAE,CAAC;IACNyG,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE,CAAC;IACNH,MAAM,EAAE,CAAC;IACTI,SAAS,EAAE;EACb,CAAC;EACD9C,UAAU,EAAE;IACV+C,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,15 +1,17 @@
1
+ "use strict";
2
+
1
3
  import { getHeaderTitle, HeaderTitle } from '@react-navigation/elements';
2
4
  import { useLocale, useTheme } from '@react-navigation/native';
3
5
  import { Platform, StyleSheet, View } from 'react-native';
4
- import { isSearchBarAvailableForCurrentPlatform, ScreenStackHeaderBackButtonImage, ScreenStackHeaderCenterView, ScreenStackHeaderConfig, ScreenStackHeaderLeftView, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView, SearchBar } from 'react-native-screens';
5
- import { processFonts } from "./FontProcessor.mjs";
6
+ import { isSearchBarAvailableForCurrentPlatform, ScreenStackHeaderBackButtonImage, ScreenStackHeaderCenterView, ScreenStackHeaderLeftView, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView, SearchBar } from 'react-native-screens';
7
+ import { processFonts } from './FontProcessor';
6
8
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
- export function HeaderConfig({
9
+ export function useHeaderConfigProps({
8
10
  headerBackImageSource,
11
+ headerBackButtonDisplayMode,
9
12
  headerBackButtonMenuEnabled,
10
13
  headerBackTitle,
11
14
  headerBackTitleStyle,
12
- headerBackTitleVisible = true,
13
15
  headerBackVisible,
14
16
  headerShadowVisible,
15
17
  headerLargeStyle,
@@ -106,40 +108,21 @@ export function HeaderConfig({
106
108
  * - Back button should stay visible when `headerLeft` is specified
107
109
  * - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button
108
110
  */
109
- const backButtonInCustomView = headerBackVisible ? headerLeftElement != null : Platform.OS === 'android' && headerTitleElement != null;
111
+ const backButtonInCustomView = headerBackVisible || Platform.OS === 'android' && headerTitleElement != null && headerLeftElement == null;
110
112
  const translucent = headerBackground != null || headerTransparent ||
111
113
  // When using a SearchBar or large title, the header needs to be translucent for it to work on iOS
112
114
  (hasHeaderSearchBar || headerLargeTitle) && Platform.OS === 'ios' && headerTransparent !== false;
113
- return /*#__PURE__*/_jsxs(ScreenStackHeaderConfig, {
114
- backButtonInCustomView: backButtonInCustomView,
115
- backgroundColor: headerBackgroundColor,
116
- backTitle: headerBackTitle,
117
- backTitleVisible: headerBackTitleVisible,
118
- backTitleFontFamily: backTitleFontFamily,
119
- backTitleFontSize: backTitleFontSize,
120
- blurEffect: headerBlurEffect,
121
- color: tintColor,
122
- direction: direction,
123
- disableBackButtonMenu: headerBackButtonMenuEnabled === false,
124
- hidden: headerShown === false,
125
- hideBackButton: headerBackVisible === false,
126
- hideShadow: headerShadowVisible === false || headerBackground != null || headerTransparent && headerShadowVisible !== true,
127
- largeTitle: headerLargeTitle,
128
- largeTitleBackgroundColor: largeTitleBackgroundColor,
129
- largeTitleColor: largeTitleColor,
130
- largeTitleFontFamily: largeTitleFontFamily,
131
- largeTitleFontSize: largeTitleFontSize,
132
- largeTitleFontWeight: largeTitleFontWeight,
133
- largeTitleHideShadow: headerLargeTitleShadowVisible === false,
134
- title: titleText,
135
- titleColor: titleColor,
136
- titleFontFamily: titleFontFamily,
137
- titleFontSize: titleFontSize,
138
- titleFontWeight: String(titleFontWeight),
139
- topInsetEnabled: headerTopInsetEnabled,
140
- translucent:
141
- // This defaults to `true`, so we can't pass `undefined`
142
- translucent === true,
115
+ const isBackButtonDisplayModeAvailable =
116
+ // On iOS 14+
117
+ Platform.OS === 'ios' && parseInt(Platform.Version, 10) >= 14 &&
118
+ // Doesn't have custom back title
119
+ headerBackTitle == null &&
120
+ // Doesn't have custom styling
121
+ backTitleFontFamily == null && backTitleFontSize == null &&
122
+ // Back button menu is not disabled
123
+ headerBackButtonMenuEnabled !== false;
124
+ const isCenterViewRenderedAndroid = headerTitleAlign === 'center';
125
+ const children = /*#__PURE__*/_jsxs(_Fragment, {
143
126
  children: [Platform.OS === 'ios' ? /*#__PURE__*/_jsxs(_Fragment, {
144
127
  children: [headerLeftElement != null ? /*#__PURE__*/_jsx(ScreenStackHeaderLeftView, {
145
128
  children: headerLeftElement
@@ -147,16 +130,31 @@ export function HeaderConfig({
147
130
  children: headerTitleElement
148
131
  }) : null]
149
132
  }) : /*#__PURE__*/_jsxs(_Fragment, {
150
- children: [headerLeftElement != null || typeof headerTitle === 'function' ? /*#__PURE__*/_jsx(ScreenStackHeaderLeftView, {
151
- children: /*#__PURE__*/_jsxs(View, {
152
- style: styles.row,
153
- children: [headerLeftElement, headerTitleAlign !== 'center' ? typeof headerTitle === 'function' ? headerTitleElement : /*#__PURE__*/_jsx(HeaderTitle, {
133
+ children: [headerLeftElement != null || typeof headerTitle === 'function' ?
134
+ /*#__PURE__*/
135
+ // The style passed to header left, together with title element being wrapped
136
+ // in flex view is reqruied for proper header layout, in particular,
137
+ // for the text truncation to work.
138
+ _jsxs(ScreenStackHeaderLeftView, {
139
+ style: !isCenterViewRenderedAndroid ? {
140
+ flex: 1
141
+ } : null,
142
+ children: [headerLeftElement, headerTitleAlign !== 'center' ? typeof headerTitle === 'function' ? /*#__PURE__*/_jsx(View, {
143
+ style: {
144
+ flex: 1
145
+ },
146
+ children: headerTitleElement
147
+ }) : /*#__PURE__*/_jsx(View, {
148
+ style: {
149
+ flex: 1
150
+ },
151
+ children: /*#__PURE__*/_jsx(HeaderTitle, {
154
152
  tintColor: tintColor,
155
153
  style: headerTitleStyleSupported,
156
154
  children: titleText
157
- }) : null]
158
- })
159
- }) : null, headerTitleAlign === 'center' ? /*#__PURE__*/_jsx(ScreenStackHeaderCenterView, {
155
+ })
156
+ }) : null]
157
+ }) : null, isCenterViewRenderedAndroid ? /*#__PURE__*/_jsx(ScreenStackHeaderCenterView, {
160
158
  children: typeof headerTitle === 'function' ? headerTitleElement : /*#__PURE__*/_jsx(HeaderTitle, {
161
159
  tintColor: tintColor,
162
160
  style: headerTitleStyleSupported,
@@ -173,11 +171,36 @@ export function HeaderConfig({
173
171
  })
174
172
  }) : null]
175
173
  });
174
+ return {
175
+ backButtonInCustomView,
176
+ backgroundColor: headerBackgroundColor,
177
+ backTitle: headerBackTitle,
178
+ backTitleVisible: isBackButtonDisplayModeAvailable ? undefined : headerBackButtonDisplayMode !== 'minimal',
179
+ backButtonDisplayMode: isBackButtonDisplayModeAvailable ? headerBackButtonDisplayMode : undefined,
180
+ backTitleFontFamily,
181
+ backTitleFontSize,
182
+ blurEffect: headerBlurEffect,
183
+ color: tintColor,
184
+ direction,
185
+ disableBackButtonMenu: headerBackButtonMenuEnabled === false,
186
+ hidden: headerShown === false,
187
+ hideBackButton: headerBackVisible === false,
188
+ hideShadow: headerShadowVisible === false || headerBackground != null || headerTransparent && headerShadowVisible !== true,
189
+ largeTitle: headerLargeTitle,
190
+ largeTitleBackgroundColor,
191
+ largeTitleColor,
192
+ largeTitleFontFamily,
193
+ largeTitleFontSize,
194
+ largeTitleFontWeight,
195
+ largeTitleHideShadow: headerLargeTitleShadowVisible === false,
196
+ title: titleText,
197
+ titleColor,
198
+ titleFontFamily,
199
+ titleFontSize,
200
+ titleFontWeight: String(titleFontWeight),
201
+ topInsetEnabled: headerTopInsetEnabled,
202
+ translucent: translucent === true,
203
+ children
204
+ };
176
205
  }
177
- const styles = StyleSheet.create({
178
- row: {
179
- flexDirection: 'row',
180
- alignItems: 'center'
181
- }
182
- });
183
- //# sourceMappingURL=HeaderConfig.mjs.map
206
+ //# sourceMappingURL=useHeaderConfigProps.js.map