@react-navigation/native-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 (84) hide show
  1. package/lib/commonjs/index.js +7 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/navigators/createNativeStackNavigator.js +29 -25
  4. package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -1
  5. package/lib/commonjs/types.js.map +1 -1
  6. package/lib/commonjs/utils/getModalRoutesKeys.js +17 -0
  7. package/lib/commonjs/utils/getModalRoutesKeys.js.map +1 -0
  8. package/lib/commonjs/utils/useAnimatedHeaderHeight.js +19 -0
  9. package/lib/commonjs/utils/useAnimatedHeaderHeight.js.map +1 -0
  10. package/lib/commonjs/utils/useDismissedRouteError.js +3 -4
  11. package/lib/commonjs/utils/useDismissedRouteError.js.map +1 -1
  12. package/lib/commonjs/utils/useInvalidPreventRemoveError.js +4 -5
  13. package/lib/commonjs/utils/useInvalidPreventRemoveError.js.map +1 -1
  14. package/lib/commonjs/views/DebugContainer.js +2 -2
  15. package/lib/commonjs/views/DebugContainer.js.map +1 -1
  16. package/lib/commonjs/views/DebugContainer.native.js +19 -7
  17. package/lib/commonjs/views/DebugContainer.native.js.map +1 -1
  18. package/lib/commonjs/views/FontProcessor.js.map +1 -1
  19. package/lib/commonjs/views/FontProcessor.native.js +2 -4
  20. package/lib/commonjs/views/FontProcessor.native.js.map +1 -1
  21. package/lib/commonjs/views/HeaderConfig.js +18 -29
  22. package/lib/commonjs/views/HeaderConfig.js.map +1 -1
  23. package/lib/commonjs/views/NativeStackView.js +27 -17
  24. package/lib/commonjs/views/NativeStackView.js.map +1 -1
  25. package/lib/commonjs/views/NativeStackView.native.js +131 -49
  26. package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
  27. package/lib/module/index.js +5 -0
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/navigators/createNativeStackNavigator.js +26 -21
  30. package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
  31. package/lib/module/types.js.map +1 -1
  32. package/lib/module/utils/getModalRoutesKeys.js +10 -0
  33. package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
  34. package/lib/module/utils/useAnimatedHeaderHeight.js +10 -0
  35. package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -0
  36. package/lib/module/utils/useDismissedRouteError.js +1 -2
  37. package/lib/module/utils/useDismissedRouteError.js.map +1 -1
  38. package/lib/module/utils/useInvalidPreventRemoveError.js +2 -3
  39. package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -1
  40. package/lib/module/views/DebugContainer.js.map +1 -1
  41. package/lib/module/views/DebugContainer.native.js +18 -4
  42. package/lib/module/views/DebugContainer.native.js.map +1 -1
  43. package/lib/module/views/FontProcessor.js.map +1 -1
  44. package/lib/module/views/FontProcessor.native.js +2 -4
  45. package/lib/module/views/FontProcessor.native.js.map +1 -1
  46. package/lib/module/views/HeaderConfig.js +18 -29
  47. package/lib/module/views/HeaderConfig.js.map +1 -1
  48. package/lib/module/views/NativeStackView.js +25 -15
  49. package/lib/module/views/NativeStackView.js.map +1 -1
  50. package/lib/module/views/NativeStackView.native.js +130 -48
  51. package/lib/module/views/NativeStackView.native.js.map +1 -1
  52. package/lib/typescript/src/index.d.ts +5 -1
  53. package/lib/typescript/src/index.d.ts.map +1 -1
  54. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +14 -8
  55. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
  56. package/lib/typescript/src/types.d.ts +97 -12
  57. package/lib/typescript/src/types.d.ts.map +1 -1
  58. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
  59. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  60. package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts +5 -0
  61. package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  62. package/lib/typescript/src/views/DebugContainer.d.ts +2 -2
  63. package/lib/typescript/src/views/DebugContainer.d.ts.map +1 -1
  64. package/lib/typescript/src/views/DebugContainer.native.d.ts +7 -2
  65. package/lib/typescript/src/views/DebugContainer.native.d.ts.map +1 -1
  66. package/lib/typescript/src/views/FontProcessor.native.d.ts.map +1 -1
  67. package/lib/typescript/src/views/HeaderConfig.d.ts +2 -2
  68. package/lib/typescript/src/views/HeaderConfig.d.ts.map +1 -1
  69. package/lib/typescript/src/views/NativeStackView.d.ts +3 -2
  70. package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
  71. package/lib/typescript/src/views/NativeStackView.native.d.ts +3 -2
  72. package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
  73. package/package.json +15 -16
  74. package/src/index.tsx +6 -0
  75. package/src/navigators/createNativeStackNavigator.tsx +39 -11
  76. package/src/types.tsx +104 -12
  77. package/src/utils/getModalRoutesKeys.ts +21 -0
  78. package/src/utils/useAnimatedHeaderHeight.tsx +18 -0
  79. package/src/views/DebugContainer.native.tsx +12 -6
  80. package/src/views/DebugContainer.tsx +1 -1
  81. package/src/views/FontProcessor.native.tsx +1 -2
  82. package/src/views/HeaderConfig.tsx +106 -134
  83. package/src/views/NativeStackView.native.tsx +273 -167
  84. package/src/views/NativeStackView.tsx +132 -123
package/src/types.tsx CHANGED
@@ -9,6 +9,7 @@ import type {
9
9
  StackActionHelpers,
10
10
  StackNavigationState,
11
11
  StackRouterOptions,
12
+ Theme,
12
13
  } from '@react-navigation/native';
13
14
  import type {
14
15
  ImageSourcePropType,
@@ -20,6 +21,7 @@ import type {
20
21
  ScreenProps,
21
22
  ScreenStackHeaderConfigProps,
22
23
  SearchBarProps,
24
+ SheetDetentTypes,
23
25
  } from 'react-native-screens';
24
26
 
25
27
  export type NativeStackNavigationEventMap = {
@@ -31,12 +33,16 @@ export type NativeStackNavigationEventMap = {
31
33
  * Event which fires when a transition animation ends.
32
34
  */
33
35
  transitionEnd: { data: { closing: boolean } };
36
+ /**
37
+ * Event which fires when a swipe back is canceled on iOS.
38
+ */
39
+ gestureCancel: { data: undefined };
34
40
  };
35
41
 
36
42
  export type NativeStackNavigationProp<
37
43
  ParamList extends ParamListBase,
38
44
  RouteName extends keyof ParamList = string,
39
- NavigatorID extends string | undefined = undefined
45
+ NavigatorID extends string | undefined = undefined,
40
46
  > = NavigationProp<
41
47
  ParamList,
42
48
  RouteName,
@@ -50,12 +56,20 @@ export type NativeStackNavigationProp<
50
56
  export type NativeStackScreenProps<
51
57
  ParamList extends ParamListBase,
52
58
  RouteName extends keyof ParamList = string,
53
- NavigatorID extends string | undefined = undefined
59
+ NavigatorID extends string | undefined = undefined,
54
60
  > = {
55
61
  navigation: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
56
62
  route: RouteProp<ParamList, RouteName>;
57
63
  };
58
64
 
65
+ export type NativeStackOptionsArgs<
66
+ ParamList extends ParamListBase,
67
+ RouteName extends keyof ParamList = keyof ParamList,
68
+ NavigatorID extends string | undefined = undefined,
69
+ > = NativeStackScreenProps<ParamList, RouteName, NavigatorID> & {
70
+ theme: Theme;
71
+ };
72
+
59
73
  export type NativeStackNavigationHelpers = NavigationHelpers<
60
74
  ParamListBase,
61
75
  NativeStackNavigationEventMap
@@ -72,7 +86,11 @@ export type NativeStackHeaderProps = {
72
86
  /**
73
87
  * Title of the previous screen.
74
88
  */
75
- title: string;
89
+ title: string | undefined;
90
+ /**
91
+ * The `href` to use for the anchor tag on web
92
+ */
93
+ href: string | undefined;
76
94
  };
77
95
  /**
78
96
  * Options for the current screen.
@@ -88,7 +106,7 @@ export type NativeStackHeaderProps = {
88
106
  navigation: NativeStackNavigationProp<ParamListBase>;
89
107
  };
90
108
 
91
- export type HeaderButtonProps = {
109
+ export type NativeStackHeaderRightProps = {
92
110
  /**
93
111
  * Tint color for the header.
94
112
  */
@@ -99,12 +117,16 @@ export type HeaderButtonProps = {
99
117
  canGoBack: boolean;
100
118
  };
101
119
 
102
- export type HeaderBackButtonProps = HeaderButtonProps & {
120
+ export type NativeStackHeaderLeftProps = NativeStackHeaderRightProps & {
103
121
  /**
104
122
  * Label text for the button. Usually the title of the previous screen.
105
123
  * By default, this is only shown on iOS.
106
124
  */
107
125
  label?: string;
126
+ /**
127
+ * The `href` to use for the anchor tag on web
128
+ */
129
+ href?: string;
108
130
  };
109
131
 
110
132
  export type NativeStackNavigationOptions = {
@@ -258,11 +280,11 @@ export type NativeStackNavigationOptions = {
258
280
  * Function which returns a React Element to display on the left side of the header.
259
281
  * This replaces the back button. See `headerBackVisible` to show the back button along side left element.
260
282
  */
261
- headerLeft?: (props: HeaderBackButtonProps) => React.ReactNode;
283
+ headerLeft?: (props: NativeStackHeaderLeftProps) => React.ReactNode;
262
284
  /**
263
285
  * Function which returns a React Element to display on the right side of the header.
264
286
  */
265
- headerRight?: (props: HeaderButtonProps) => React.ReactNode;
287
+ headerRight?: (props: NativeStackHeaderRightProps) => React.ReactNode;
266
288
  /**
267
289
  * String or a function that returns a React Element to be used by the header.
268
290
  * Defaults to screen `title` or route name.
@@ -326,6 +348,12 @@ export type NativeStackNavigationOptions = {
326
348
  * @platform ios
327
349
  */
328
350
  autoHideHomeIndicator?: boolean;
351
+ /**
352
+ * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
353
+ *
354
+ * @platform ios
355
+ */
356
+ keyboardHandlingEnabled?: boolean;
329
357
  /**
330
358
  * Sets the navigation bar color. Defaults to initial navigation bar color.
331
359
  *
@@ -352,7 +380,7 @@ export type NativeStackNavigationOptions = {
352
380
  *
353
381
  * @platform android
354
382
  */
355
- statusBarColor?: string;
383
+ statusBarBackgroundColor?: string;
356
384
  /**
357
385
  * Whether the status bar should be hidden on this screen.
358
386
  * Requires setting `View controller-based status bar appearance -> YES` in your Info.plist file.
@@ -379,7 +407,7 @@ export type NativeStackNavigationOptions = {
379
407
  statusBarTranslucent?: boolean;
380
408
  /**
381
409
  * Sets the direction in which you should swipe to dismiss the screen.
382
- * When using `vertical` option, options `fullScreenGestureEnabled: true`, `customAnimationOnGesture: true` and `animation: 'slide_from_bottom'` are set by default.
410
+ * When using `vertical` option, options `fullScreenGestureEnabled: true`, `animationMatchesGesture: true` and `animation: 'slide_from_bottom'` are set by default.
383
411
  *
384
412
  * Supported values:
385
413
  * - `vertical` – dismiss screen vertically
@@ -399,10 +427,10 @@ export type NativeStackNavigationOptions = {
399
427
  *
400
428
  * @platform ios
401
429
  */
402
- customAnimationOnGesture?: boolean;
430
+ animationMatchesGesture?: boolean;
403
431
  /**
404
432
  * Whether the gesture to dismiss should work on the whole screen. Using gesture to dismiss with this option results in the same
405
- * transition animation as `simple_push`. This behavior can be changed by setting `customAnimationOnGesture` prop. Achieving the
433
+ * transition animation as `simple_push`. This behavior can be changed by setting `animationMatchesGesture` prop. Achieving the
406
434
  * default iOS animation isn't possible due to platform limitations. Defaults to `false`.
407
435
  *
408
436
  * Doesn't affect the behavior of screens presented modally.
@@ -418,6 +446,12 @@ export type NativeStackNavigationOptions = {
418
446
  * @platform ios
419
447
  */
420
448
  gestureEnabled?: boolean;
449
+ /**
450
+ * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenGestureEnabled`.
451
+ *
452
+ * @platform ios
453
+ */
454
+ gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
421
455
  /**
422
456
  * The type of animation to use when this screen replaces another screen. Defaults to `pop`.
423
457
  *
@@ -466,6 +500,62 @@ export type NativeStackNavigationOptions = {
466
500
  * Only supported on iOS and Android.
467
501
  */
468
502
  presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card';
503
+ /**
504
+ * Describes heights where a sheet can rest.
505
+ * Works only when `presentation` is set to `formSheet`.
506
+ * Defaults to `large`.
507
+ *
508
+ * Available values:
509
+ *
510
+ * - `large` - only large detent level will be allowed
511
+ * - `medium` - only medium detent level will be allowed
512
+ * - `all` - all detent levels will be allowed
513
+ *
514
+ * @platform ios
515
+ */
516
+ sheetAllowedDetents?: SheetDetentTypes;
517
+ /**
518
+ * Whether the sheet should expand to larger detent when scrolling.
519
+ * Works only when `presentation` is set to `formSheet`.
520
+ * Defaults to `true`.
521
+ *
522
+ * @platform ios
523
+ */
524
+ sheetExpandsWhenScrolledToEdge?: boolean;
525
+ /**
526
+ * The corner radius that the sheet will try to render with.
527
+ * Works only when `presentation` is set to `formSheet`.
528
+ *
529
+ * If set to non-negative value it will try to render sheet with provided radius, else it will apply system default.
530
+ *
531
+ * If left unset system default is used.
532
+ *
533
+ * @platform ios
534
+ */
535
+ sheetCornerRadius?: number;
536
+ /**
537
+ * Boolean indicating whether the sheet shows a grabber at the top.
538
+ * Works only when `presentation` is set to `formSheet`.
539
+ * Defaults to `false`.
540
+ *
541
+ * @platform ios
542
+ */
543
+ sheetGrabberVisible?: boolean;
544
+ /**
545
+ * The largest sheet detent for which a view underneath won't be dimmed.
546
+ * Works only when `presentation` is se tto `formSheet`.
547
+ *
548
+ * If this prop is set to:
549
+ *
550
+ * - `large` - the view underneath won't be dimmed at any detent level
551
+ * - `medium` - the view underneath will be dimmed only when detent level is `large`
552
+ * - `all` - the view underneath will be dimmed for any detent level
553
+ *
554
+ * Defaults to `all`.
555
+ *
556
+ * @platform ios
557
+ */
558
+ sheetLargestUndimmedDetent?: SheetDetentTypes;
469
559
  /**
470
560
  * The display orientation to use for the screen.
471
561
  *
@@ -494,9 +584,11 @@ export type NativeStackNavigationOptions = {
494
584
 
495
585
  export type NativeStackNavigatorProps = DefaultNavigatorOptions<
496
586
  ParamListBase,
587
+ string | undefined,
497
588
  StackNavigationState<ParamListBase>,
498
589
  NativeStackNavigationOptions,
499
- NativeStackNavigationEventMap
590
+ NativeStackNavigationEventMap,
591
+ NativeStackNavigationProp<ParamListBase>
500
592
  > &
501
593
  StackRouterOptions &
502
594
  NativeStackNavigationConfig;
@@ -0,0 +1,21 @@
1
+ import type { Route } from '@react-navigation/native';
2
+
3
+ import type { NativeStackDescriptorMap } from '../types';
4
+
5
+ export const getModalRouteKeys = (
6
+ routes: Route<string>[],
7
+ descriptors: NativeStackDescriptorMap
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
+ }, []);
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import type { Animated } from 'react-native';
3
+
4
+ export const AnimatedHeaderHeightContext = React.createContext<
5
+ Animated.Value | undefined
6
+ >(undefined);
7
+
8
+ export function useAnimatedHeaderHeight() {
9
+ const animatedValue = React.useContext(AnimatedHeaderHeightContext);
10
+
11
+ if (animatedValue === undefined) {
12
+ throw new Error(
13
+ "Couldn't find the header height. Are you inside a screen in a native stack navigator?"
14
+ );
15
+ }
16
+
17
+ return animatedValue;
18
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { Platform, View, ViewProps } from 'react-native';
3
- // @ts-ignore Getting private component
2
+ import { Platform, View, type ViewProps } from 'react-native';
3
+ // @ts-expect-error Getting private component
4
4
  import AppContainer from 'react-native/Libraries/ReactNative/AppContainer';
5
5
  import type { StackPresentationTypes } from 'react-native-screens';
6
6
 
@@ -9,8 +9,14 @@ type ContainerProps = ViewProps & {
9
9
  children: React.ReactNode;
10
10
  };
11
11
 
12
- export let DebugContainer =
13
- View as unknown as React.ComponentType<ContainerProps>;
12
+ /**
13
+ * This view must *not* be flattened.
14
+ * See https://github.com/software-mansion/react-native-screens/pull/1825
15
+ * for detailed explanation.
16
+ */
17
+ export let DebugContainer = (props: ContainerProps) => {
18
+ return <View {...props} collapsable={false} />;
19
+ };
14
20
 
15
21
  if (process.env.NODE_ENV !== 'production') {
16
22
  DebugContainer = (props: ContainerProps) => {
@@ -20,11 +26,11 @@ if (process.env.NODE_ENV !== 'production') {
20
26
  // This is necessary for LogBox
21
27
  return (
22
28
  <AppContainer>
23
- <View {...rest} />
29
+ <View {...rest} collapsable={false} />
24
30
  </AppContainer>
25
31
  );
26
32
  }
27
33
 
28
- return <View {...rest} />;
34
+ return <View {...rest} collapsable={false} />;
29
35
  };
30
36
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { View, ViewProps } from 'react-native';
2
+ import { View, type ViewProps } from 'react-native';
3
3
  import type { StackPresentationTypes } from 'react-native-screens';
4
4
 
5
5
  type ContainerProps = ViewProps & {
@@ -1,10 +1,9 @@
1
- // @ts-ignore: No declaration available
1
+ // @ts-expect-error importing private module
2
2
  import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
3
3
 
4
4
  export function processFonts(
5
5
  fontFamilies: (string | undefined)[]
6
6
  ): (string | undefined)[] {
7
- // @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
8
7
  const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
9
8
  if (typeof fontFamilyProcessor === 'function') {
10
9
  return fontFamilies.map(fontFamilyProcessor);
@@ -1,13 +1,7 @@
1
1
  import { getHeaderTitle, HeaderTitle } from '@react-navigation/elements';
2
- import { Route, useTheme } from '@react-navigation/native';
2
+ import { type Route, useLocale, useTheme } from '@react-navigation/native';
3
3
  import * as React from 'react';
4
- import {
5
- I18nManager,
6
- Platform,
7
- StyleSheet,
8
- TextStyle,
9
- View,
10
- } from 'react-native';
4
+ import { Platform, StyleSheet, type TextStyle, View } from 'react-native';
11
5
  import {
12
6
  isSearchBarAvailableForCurrentPlatform,
13
7
  ScreenStackHeaderBackButtonImage,
@@ -30,7 +24,6 @@ type Props = NativeStackNavigationOptions & {
30
24
  };
31
25
 
32
26
  export function HeaderConfig({
33
- headerHeight,
34
27
  headerBackImageSource,
35
28
  headerBackButtonMenuEnabled,
36
29
  headerBackTitle,
@@ -59,21 +52,22 @@ export function HeaderConfig({
59
52
  title,
60
53
  canGoBack,
61
54
  }: Props): JSX.Element {
55
+ const { direction } = useLocale();
62
56
  const { colors, fonts } = useTheme();
63
57
  const tintColor =
64
58
  headerTintColor ?? (Platform.OS === 'ios' ? colors.primary : colors.text);
65
59
 
66
60
  const headerBackTitleStyleFlattened =
67
- StyleSheet.flatten([headerBackTitleStyle, fonts.regular]) || {};
61
+ StyleSheet.flatten([fonts.regular, headerBackTitleStyle]) || {};
68
62
  const headerLargeTitleStyleFlattened =
69
63
  StyleSheet.flatten([
70
- headerLargeTitleStyle,
71
64
  Platform.select({ ios: fonts.heavy, default: fonts.medium }),
65
+ headerLargeTitleStyle,
72
66
  ]) || {};
73
67
  const headerTitleStyleFlattened =
74
68
  StyleSheet.flatten([
75
- headerTitleStyle,
76
69
  Platform.select({ ios: fonts.bold, default: fonts.medium }),
70
+ headerTitleStyle,
77
71
  ]) || {};
78
72
  const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};
79
73
  const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};
@@ -136,6 +130,8 @@ export function HeaderConfig({
136
130
  tintColor,
137
131
  canGoBack,
138
132
  label: headerBackTitle,
133
+ // `href` is only applicable to web
134
+ href: undefined,
139
135
  });
140
136
  const headerRightElement = headerRight?.({
141
137
  tintColor,
@@ -182,118 +178,105 @@ export function HeaderConfig({
182
178
  headerTransparent !== false);
183
179
 
184
180
  return (
185
- <>
186
- {headerBackground != null ? (
187
- <View
188
- style={[
189
- styles.background,
190
- headerTransparent ? styles.translucent : null,
191
- { height: headerHeight },
192
- ]}
193
- >
194
- {headerBackground()}
195
- </View>
196
- ) : null}
197
- <ScreenStackHeaderConfig
198
- backButtonInCustomView={backButtonInCustomView}
199
- backgroundColor={headerBackgroundColor}
200
- backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
201
- backTitleFontFamily={backTitleFontFamily}
202
- backTitleFontSize={backTitleFontSize}
203
- blurEffect={headerBlurEffect}
204
- color={tintColor}
205
- direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
206
- disableBackButtonMenu={headerBackButtonMenuEnabled === false}
207
- hidden={headerShown === false}
208
- hideBackButton={headerBackVisible === false}
209
- hideShadow={
210
- headerShadowVisible === false ||
211
- headerBackground != null ||
212
- (headerTransparent && headerShadowVisible !== true)
213
- }
214
- largeTitle={headerLargeTitle}
215
- largeTitleBackgroundColor={largeTitleBackgroundColor}
216
- largeTitleColor={largeTitleColor}
217
- largeTitleFontFamily={largeTitleFontFamily}
218
- largeTitleFontSize={largeTitleFontSize}
219
- largeTitleFontWeight={largeTitleFontWeight}
220
- largeTitleHideShadow={headerLargeTitleShadowVisible === false}
221
- title={titleText}
222
- titleColor={titleColor}
223
- titleFontFamily={titleFontFamily}
224
- titleFontSize={titleFontSize}
225
- titleFontWeight={titleFontWeight}
226
- topInsetEnabled={headerTopInsetEnabled}
227
- translucent={
228
- // This defaults to `true`, so we can't pass `undefined`
229
- translucent === true
230
- }
231
- >
232
- {Platform.OS === 'ios' ? (
233
- <>
234
- {headerLeftElement != null ? (
235
- <ScreenStackHeaderLeftView>
181
+ <ScreenStackHeaderConfig
182
+ backButtonInCustomView={backButtonInCustomView}
183
+ backgroundColor={headerBackgroundColor}
184
+ backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
185
+ backTitleFontFamily={backTitleFontFamily}
186
+ backTitleFontSize={backTitleFontSize}
187
+ blurEffect={headerBlurEffect}
188
+ color={tintColor}
189
+ direction={direction}
190
+ disableBackButtonMenu={headerBackButtonMenuEnabled === false}
191
+ hidden={headerShown === false}
192
+ hideBackButton={headerBackVisible === false}
193
+ hideShadow={
194
+ headerShadowVisible === false ||
195
+ headerBackground != null ||
196
+ (headerTransparent && headerShadowVisible !== true)
197
+ }
198
+ largeTitle={headerLargeTitle}
199
+ largeTitleBackgroundColor={largeTitleBackgroundColor}
200
+ largeTitleColor={largeTitleColor}
201
+ largeTitleFontFamily={largeTitleFontFamily}
202
+ largeTitleFontSize={largeTitleFontSize}
203
+ largeTitleFontWeight={largeTitleFontWeight}
204
+ largeTitleHideShadow={headerLargeTitleShadowVisible === false}
205
+ title={titleText}
206
+ titleColor={titleColor}
207
+ titleFontFamily={titleFontFamily}
208
+ titleFontSize={titleFontSize}
209
+ titleFontWeight={titleFontWeight}
210
+ topInsetEnabled={headerTopInsetEnabled}
211
+ translucent={
212
+ // This defaults to `true`, so we can't pass `undefined`
213
+ translucent === true
214
+ }
215
+ >
216
+ {Platform.OS === 'ios' ? (
217
+ <>
218
+ {headerLeftElement != null ? (
219
+ <ScreenStackHeaderLeftView>
220
+ {headerLeftElement}
221
+ </ScreenStackHeaderLeftView>
222
+ ) : null}
223
+ {headerTitleElement != null ? (
224
+ <ScreenStackHeaderCenterView>
225
+ {headerTitleElement}
226
+ </ScreenStackHeaderCenterView>
227
+ ) : null}
228
+ </>
229
+ ) : (
230
+ <>
231
+ {headerLeftElement != null || typeof headerTitle === 'function' ? (
232
+ <ScreenStackHeaderLeftView>
233
+ <View style={styles.row}>
236
234
  {headerLeftElement}
237
- </ScreenStackHeaderLeftView>
238
- ) : null}
239
- {headerTitleElement != null ? (
240
- <ScreenStackHeaderCenterView>
241
- {headerTitleElement}
242
- </ScreenStackHeaderCenterView>
243
- ) : null}
244
- </>
245
- ) : (
246
- <>
247
- {headerLeftElement != null || typeof headerTitle === 'function' ? (
248
- <ScreenStackHeaderLeftView>
249
- <View style={styles.row}>
250
- {headerLeftElement}
251
- {headerTitleAlign !== 'center' ? (
252
- typeof headerTitle === 'function' ? (
253
- headerTitleElement
254
- ) : (
255
- <HeaderTitle
256
- tintColor={tintColor}
257
- style={headerTitleStyleSupported}
258
- >
259
- {titleText}
260
- </HeaderTitle>
261
- )
262
- ) : null}
263
- </View>
264
- </ScreenStackHeaderLeftView>
265
- ) : null}
266
- {headerTitleAlign === 'center' ? (
267
- <ScreenStackHeaderCenterView>
268
- {typeof headerTitle === 'function' ? (
269
- headerTitleElement
270
- ) : (
271
- <HeaderTitle
272
- tintColor={tintColor}
273
- style={headerTitleStyleSupported}
274
- >
275
- {titleText}
276
- </HeaderTitle>
277
- )}
278
- </ScreenStackHeaderCenterView>
279
- ) : null}
280
- </>
281
- )}
282
- {headerBackImageSource !== undefined ? (
283
- <ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
284
- ) : null}
285
- {headerRightElement != null ? (
286
- <ScreenStackHeaderRightView>
287
- {headerRightElement}
288
- </ScreenStackHeaderRightView>
289
- ) : null}
290
- {hasHeaderSearchBar ? (
291
- <ScreenStackHeaderSearchBarView>
292
- <SearchBar {...headerSearchBarOptions} />
293
- </ScreenStackHeaderSearchBarView>
294
- ) : null}
295
- </ScreenStackHeaderConfig>
296
- </>
235
+ {headerTitleAlign !== 'center' ? (
236
+ typeof headerTitle === 'function' ? (
237
+ headerTitleElement
238
+ ) : (
239
+ <HeaderTitle
240
+ tintColor={tintColor}
241
+ style={headerTitleStyleSupported}
242
+ >
243
+ {titleText}
244
+ </HeaderTitle>
245
+ )
246
+ ) : null}
247
+ </View>
248
+ </ScreenStackHeaderLeftView>
249
+ ) : null}
250
+ {headerTitleAlign === 'center' ? (
251
+ <ScreenStackHeaderCenterView>
252
+ {typeof headerTitle === 'function' ? (
253
+ headerTitleElement
254
+ ) : (
255
+ <HeaderTitle
256
+ tintColor={tintColor}
257
+ style={headerTitleStyleSupported}
258
+ >
259
+ {titleText}
260
+ </HeaderTitle>
261
+ )}
262
+ </ScreenStackHeaderCenterView>
263
+ ) : null}
264
+ </>
265
+ )}
266
+ {headerBackImageSource !== undefined ? (
267
+ <ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
268
+ ) : null}
269
+ {headerRightElement != null ? (
270
+ <ScreenStackHeaderRightView>
271
+ {headerRightElement}
272
+ </ScreenStackHeaderRightView>
273
+ ) : null}
274
+ {hasHeaderSearchBar ? (
275
+ <ScreenStackHeaderSearchBarView>
276
+ <SearchBar {...headerSearchBarOptions} />
277
+ </ScreenStackHeaderSearchBarView>
278
+ ) : null}
279
+ </ScreenStackHeaderConfig>
297
280
  );
298
281
  }
299
282
 
@@ -302,15 +285,4 @@ const styles = StyleSheet.create({
302
285
  flexDirection: 'row',
303
286
  alignItems: 'center',
304
287
  },
305
- translucent: {
306
- position: 'absolute',
307
- top: 0,
308
- left: 0,
309
- right: 0,
310
- zIndex: 1,
311
- elevation: 1,
312
- },
313
- background: {
314
- overflow: 'hidden',
315
- },
316
288
  });