@react-navigation/native-stack 7.0.0-alpha.1 → 7.0.0-alpha.10

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 (77) 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 +24 -24
  4. package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -1
  5. package/lib/commonjs/types.js.map +1 -1
  6. package/lib/commonjs/utils/useAnimatedHeaderHeight.js +19 -0
  7. package/lib/commonjs/utils/useAnimatedHeaderHeight.js.map +1 -0
  8. package/lib/commonjs/utils/useDismissedRouteError.js +3 -4
  9. package/lib/commonjs/utils/useDismissedRouteError.js.map +1 -1
  10. package/lib/commonjs/utils/useInvalidPreventRemoveError.js +4 -5
  11. package/lib/commonjs/utils/useInvalidPreventRemoveError.js.map +1 -1
  12. package/lib/commonjs/views/DebugContainer.js +2 -2
  13. package/lib/commonjs/views/DebugContainer.js.map +1 -1
  14. package/lib/commonjs/views/DebugContainer.native.js +19 -7
  15. package/lib/commonjs/views/DebugContainer.native.js.map +1 -1
  16. package/lib/commonjs/views/FontProcessor.js.map +1 -1
  17. package/lib/commonjs/views/FontProcessor.native.js +2 -4
  18. package/lib/commonjs/views/FontProcessor.native.js.map +1 -1
  19. package/lib/commonjs/views/HeaderConfig.js +10 -23
  20. package/lib/commonjs/views/HeaderConfig.js.map +1 -1
  21. package/lib/commonjs/views/NativeStackView.js +23 -11
  22. package/lib/commonjs/views/NativeStackView.js.map +1 -1
  23. package/lib/commonjs/views/NativeStackView.native.js +120 -42
  24. package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
  25. package/lib/module/index.js +5 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/navigators/createNativeStackNavigator.js +21 -20
  28. package/lib/module/navigators/createNativeStackNavigator.js.map +1 -1
  29. package/lib/module/types.js.map +1 -1
  30. package/lib/module/utils/useAnimatedHeaderHeight.js +10 -0
  31. package/lib/module/utils/useAnimatedHeaderHeight.js.map +1 -0
  32. package/lib/module/utils/useDismissedRouteError.js +1 -2
  33. package/lib/module/utils/useDismissedRouteError.js.map +1 -1
  34. package/lib/module/utils/useInvalidPreventRemoveError.js +2 -3
  35. package/lib/module/utils/useInvalidPreventRemoveError.js.map +1 -1
  36. package/lib/module/views/DebugContainer.js.map +1 -1
  37. package/lib/module/views/DebugContainer.native.js +18 -4
  38. package/lib/module/views/DebugContainer.native.js.map +1 -1
  39. package/lib/module/views/FontProcessor.js.map +1 -1
  40. package/lib/module/views/FontProcessor.native.js +2 -4
  41. package/lib/module/views/FontProcessor.native.js.map +1 -1
  42. package/lib/module/views/HeaderConfig.js +10 -23
  43. package/lib/module/views/HeaderConfig.js.map +1 -1
  44. package/lib/module/views/NativeStackView.js +21 -9
  45. package/lib/module/views/NativeStackView.js.map +1 -1
  46. package/lib/module/views/NativeStackView.native.js +119 -41
  47. package/lib/module/views/NativeStackView.native.js.map +1 -1
  48. package/lib/typescript/src/index.d.ts +4 -0
  49. package/lib/typescript/src/index.d.ts.map +1 -1
  50. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +4 -4
  51. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts.map +1 -1
  52. package/lib/typescript/src/types.d.ts +88 -10
  53. package/lib/typescript/src/types.d.ts.map +1 -1
  54. package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts +5 -0
  55. package/lib/typescript/src/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  56. package/lib/typescript/src/views/DebugContainer.d.ts +2 -2
  57. package/lib/typescript/src/views/DebugContainer.d.ts.map +1 -1
  58. package/lib/typescript/src/views/DebugContainer.native.d.ts +7 -2
  59. package/lib/typescript/src/views/DebugContainer.native.d.ts.map +1 -1
  60. package/lib/typescript/src/views/FontProcessor.native.d.ts.map +1 -1
  61. package/lib/typescript/src/views/HeaderConfig.d.ts +2 -3
  62. package/lib/typescript/src/views/HeaderConfig.d.ts.map +1 -1
  63. package/lib/typescript/src/views/NativeStackView.d.ts +3 -3
  64. package/lib/typescript/src/views/NativeStackView.d.ts.map +1 -1
  65. package/lib/typescript/src/views/NativeStackView.native.d.ts +3 -3
  66. package/lib/typescript/src/views/NativeStackView.native.d.ts.map +1 -1
  67. package/package.json +16 -17
  68. package/src/index.tsx +5 -0
  69. package/src/navigators/createNativeStackNavigator.tsx +9 -5
  70. package/src/types.tsx +88 -11
  71. package/src/utils/useAnimatedHeaderHeight.tsx +18 -0
  72. package/src/views/DebugContainer.native.tsx +12 -6
  73. package/src/views/DebugContainer.tsx +1 -1
  74. package/src/views/FontProcessor.native.tsx +1 -2
  75. package/src/views/HeaderConfig.tsx +101 -131
  76. package/src/views/NativeStackView.native.tsx +198 -92
  77. package/src/views/NativeStackView.tsx +40 -26
package/src/types.tsx CHANGED
@@ -20,6 +20,7 @@ import type {
20
20
  ScreenProps,
21
21
  ScreenStackHeaderConfigProps,
22
22
  SearchBarProps,
23
+ SheetDetentTypes,
23
24
  } from 'react-native-screens';
24
25
 
25
26
  export type NativeStackNavigationEventMap = {
@@ -31,12 +32,16 @@ export type NativeStackNavigationEventMap = {
31
32
  * Event which fires when a transition animation ends.
32
33
  */
33
34
  transitionEnd: { data: { closing: boolean } };
35
+ /**
36
+ * Event which fires when a swipe back is canceled on iOS.
37
+ */
38
+ gestureCancel: { data: undefined };
34
39
  };
35
40
 
36
41
  export type NativeStackNavigationProp<
37
42
  ParamList extends ParamListBase,
38
43
  RouteName extends keyof ParamList = string,
39
- NavigatorID extends string | undefined = undefined
44
+ NavigatorID extends string | undefined = undefined,
40
45
  > = NavigationProp<
41
46
  ParamList,
42
47
  RouteName,
@@ -50,7 +55,7 @@ export type NativeStackNavigationProp<
50
55
  export type NativeStackScreenProps<
51
56
  ParamList extends ParamListBase,
52
57
  RouteName extends keyof ParamList = string,
53
- NavigatorID extends string | undefined = undefined
58
+ NavigatorID extends string | undefined = undefined,
54
59
  > = {
55
60
  navigation: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
56
61
  route: RouteProp<ParamList, RouteName>;
@@ -72,7 +77,11 @@ export type NativeStackHeaderProps = {
72
77
  /**
73
78
  * Title of the previous screen.
74
79
  */
75
- title: string;
80
+ title: string | undefined;
81
+ /**
82
+ * The `href` to use for the anchor tag on web
83
+ */
84
+ href: string | undefined;
76
85
  };
77
86
  /**
78
87
  * Options for the current screen.
@@ -88,7 +97,7 @@ export type NativeStackHeaderProps = {
88
97
  navigation: NativeStackNavigationProp<ParamListBase>;
89
98
  };
90
99
 
91
- export type HeaderButtonProps = {
100
+ export type NativeStackHeaderRightProps = {
92
101
  /**
93
102
  * Tint color for the header.
94
103
  */
@@ -99,7 +108,7 @@ export type HeaderButtonProps = {
99
108
  canGoBack: boolean;
100
109
  };
101
110
 
102
- export type HeaderBackButtonProps = HeaderButtonProps & {
111
+ export type NativeStackHeaderLeftProps = NativeStackHeaderRightProps & {
103
112
  /**
104
113
  * Label text for the button. Usually the title of the previous screen.
105
114
  * By default, this is only shown on iOS.
@@ -258,11 +267,11 @@ export type NativeStackNavigationOptions = {
258
267
  * Function which returns a React Element to display on the left side of the header.
259
268
  * This replaces the back button. See `headerBackVisible` to show the back button along side left element.
260
269
  */
261
- headerLeft?: (props: HeaderBackButtonProps) => React.ReactNode;
270
+ headerLeft?: (props: NativeStackHeaderLeftProps) => React.ReactNode;
262
271
  /**
263
272
  * Function which returns a React Element to display on the right side of the header.
264
273
  */
265
- headerRight?: (props: HeaderButtonProps) => React.ReactNode;
274
+ headerRight?: (props: NativeStackHeaderRightProps) => React.ReactNode;
266
275
  /**
267
276
  * String or a function that returns a React Element to be used by the header.
268
277
  * Defaults to screen `title` or route name.
@@ -326,6 +335,12 @@ export type NativeStackNavigationOptions = {
326
335
  * @platform ios
327
336
  */
328
337
  autoHideHomeIndicator?: boolean;
338
+ /**
339
+ * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
340
+ *
341
+ * @platform ios
342
+ */
343
+ keyboardHandlingEnabled?: boolean;
329
344
  /**
330
345
  * Sets the navigation bar color. Defaults to initial navigation bar color.
331
346
  *
@@ -352,7 +367,7 @@ export type NativeStackNavigationOptions = {
352
367
  *
353
368
  * @platform android
354
369
  */
355
- statusBarColor?: string;
370
+ statusBarBackgroundColor?: string;
356
371
  /**
357
372
  * Whether the status bar should be hidden on this screen.
358
373
  * Requires setting `View controller-based status bar appearance -> YES` in your Info.plist file.
@@ -379,7 +394,7 @@ export type NativeStackNavigationOptions = {
379
394
  statusBarTranslucent?: boolean;
380
395
  /**
381
396
  * 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.
397
+ * When using `vertical` option, options `fullScreenGestureEnabled: true`, `animationMatchesGesture: true` and `animation: 'slide_from_bottom'` are set by default.
383
398
  *
384
399
  * Supported values:
385
400
  * - `vertical` – dismiss screen vertically
@@ -399,10 +414,10 @@ export type NativeStackNavigationOptions = {
399
414
  *
400
415
  * @platform ios
401
416
  */
402
- customAnimationOnGesture?: boolean;
417
+ animationMatchesGesture?: boolean;
403
418
  /**
404
419
  * 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
420
+ * transition animation as `simple_push`. This behavior can be changed by setting `animationMatchesGesture` prop. Achieving the
406
421
  * default iOS animation isn't possible due to platform limitations. Defaults to `false`.
407
422
  *
408
423
  * Doesn't affect the behavior of screens presented modally.
@@ -418,6 +433,12 @@ export type NativeStackNavigationOptions = {
418
433
  * @platform ios
419
434
  */
420
435
  gestureEnabled?: boolean;
436
+ /**
437
+ * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenGestureEnabled`.
438
+ *
439
+ * @platform ios
440
+ */
441
+ gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
421
442
  /**
422
443
  * The type of animation to use when this screen replaces another screen. Defaults to `pop`.
423
444
  *
@@ -466,6 +487,62 @@ export type NativeStackNavigationOptions = {
466
487
  * Only supported on iOS and Android.
467
488
  */
468
489
  presentation?: Exclude<ScreenProps['stackPresentation'], 'push'> | 'card';
490
+ /**
491
+ * Describes heights where a sheet can rest.
492
+ * Works only when `presentation` is set to `formSheet`.
493
+ * Defaults to `large`.
494
+ *
495
+ * Available values:
496
+ *
497
+ * - `large` - only large detent level will be allowed
498
+ * - `medium` - only medium detent level will be allowed
499
+ * - `all` - all detent levels will be allowed
500
+ *
501
+ * @platform ios
502
+ */
503
+ sheetAllowedDetents?: SheetDetentTypes;
504
+ /**
505
+ * Whether the sheet should expand to larger detent when scrolling.
506
+ * Works only when `presentation` is set to `formSheet`.
507
+ * Defaults to `true`.
508
+ *
509
+ * @platform ios
510
+ */
511
+ sheetExpandsWhenScrolledToEdge?: boolean;
512
+ /**
513
+ * The corner radius that the sheet will try to render with.
514
+ * Works only when `presentation` is set to `formSheet`.
515
+ *
516
+ * If set to non-negative value it will try to render sheet with provided radius, else it will apply system default.
517
+ *
518
+ * If left unset system default is used.
519
+ *
520
+ * @platform ios
521
+ */
522
+ sheetCornerRadius?: number;
523
+ /**
524
+ * Boolean indicating whether the sheet shows a grabber at the top.
525
+ * Works only when `presentation` is set to `formSheet`.
526
+ * Defaults to `false`.
527
+ *
528
+ * @platform ios
529
+ */
530
+ sheetGrabberVisible?: boolean;
531
+ /**
532
+ * The largest sheet detent for which a view underneath won't be dimmed.
533
+ * Works only when `presentation` is se tto `formSheet`.
534
+ *
535
+ * If this prop is set to:
536
+ *
537
+ * - `large` - the view underneath won't be dimmed at any detent level
538
+ * - `medium` - the view underneath will be dimmed only when detent level is `large`
539
+ * - `all` - the view underneath will be dimmed for any detent level
540
+ *
541
+ * Defaults to `all`.
542
+ *
543
+ * @platform ios
544
+ */
545
+ sheetLargestUndimmedDetent?: SheetDetentTypes;
469
546
  /**
470
547
  * The display orientation to use for the screen.
471
548
  *
@@ -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,6 +52,7 @@ 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);
@@ -182,118 +176,105 @@ export function HeaderConfig({
182
176
  headerTransparent !== false);
183
177
 
184
178
  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>
179
+ <ScreenStackHeaderConfig
180
+ backButtonInCustomView={backButtonInCustomView}
181
+ backgroundColor={headerBackgroundColor}
182
+ backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
183
+ backTitleFontFamily={backTitleFontFamily}
184
+ backTitleFontSize={backTitleFontSize}
185
+ blurEffect={headerBlurEffect}
186
+ color={tintColor}
187
+ direction={direction}
188
+ disableBackButtonMenu={headerBackButtonMenuEnabled === false}
189
+ hidden={headerShown === false}
190
+ hideBackButton={headerBackVisible === false}
191
+ hideShadow={
192
+ headerShadowVisible === false ||
193
+ headerBackground != null ||
194
+ (headerTransparent && headerShadowVisible !== true)
195
+ }
196
+ largeTitle={headerLargeTitle}
197
+ largeTitleBackgroundColor={largeTitleBackgroundColor}
198
+ largeTitleColor={largeTitleColor}
199
+ largeTitleFontFamily={largeTitleFontFamily}
200
+ largeTitleFontSize={largeTitleFontSize}
201
+ largeTitleFontWeight={largeTitleFontWeight}
202
+ largeTitleHideShadow={headerLargeTitleShadowVisible === false}
203
+ title={titleText}
204
+ titleColor={titleColor}
205
+ titleFontFamily={titleFontFamily}
206
+ titleFontSize={titleFontSize}
207
+ titleFontWeight={titleFontWeight}
208
+ topInsetEnabled={headerTopInsetEnabled}
209
+ translucent={
210
+ // This defaults to `true`, so we can't pass `undefined`
211
+ translucent === true
212
+ }
213
+ >
214
+ {Platform.OS === 'ios' ? (
215
+ <>
216
+ {headerLeftElement != null ? (
217
+ <ScreenStackHeaderLeftView>
218
+ {headerLeftElement}
219
+ </ScreenStackHeaderLeftView>
220
+ ) : null}
221
+ {headerTitleElement != null ? (
222
+ <ScreenStackHeaderCenterView>
223
+ {headerTitleElement}
224
+ </ScreenStackHeaderCenterView>
225
+ ) : null}
226
+ </>
227
+ ) : (
228
+ <>
229
+ {headerLeftElement != null || typeof headerTitle === 'function' ? (
230
+ <ScreenStackHeaderLeftView>
231
+ <View style={styles.row}>
236
232
  {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
- </>
233
+ {headerTitleAlign !== 'center' ? (
234
+ typeof headerTitle === 'function' ? (
235
+ headerTitleElement
236
+ ) : (
237
+ <HeaderTitle
238
+ tintColor={tintColor}
239
+ style={headerTitleStyleSupported}
240
+ >
241
+ {titleText}
242
+ </HeaderTitle>
243
+ )
244
+ ) : null}
245
+ </View>
246
+ </ScreenStackHeaderLeftView>
247
+ ) : null}
248
+ {headerTitleAlign === 'center' ? (
249
+ <ScreenStackHeaderCenterView>
250
+ {typeof headerTitle === 'function' ? (
251
+ headerTitleElement
252
+ ) : (
253
+ <HeaderTitle
254
+ tintColor={tintColor}
255
+ style={headerTitleStyleSupported}
256
+ >
257
+ {titleText}
258
+ </HeaderTitle>
259
+ )}
260
+ </ScreenStackHeaderCenterView>
261
+ ) : null}
262
+ </>
263
+ )}
264
+ {headerBackImageSource !== undefined ? (
265
+ <ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
266
+ ) : null}
267
+ {headerRightElement != null ? (
268
+ <ScreenStackHeaderRightView>
269
+ {headerRightElement}
270
+ </ScreenStackHeaderRightView>
271
+ ) : null}
272
+ {hasHeaderSearchBar ? (
273
+ <ScreenStackHeaderSearchBarView>
274
+ <SearchBar {...headerSearchBarOptions} />
275
+ </ScreenStackHeaderSearchBarView>
276
+ ) : null}
277
+ </ScreenStackHeaderConfig>
297
278
  );
298
279
  }
299
280
 
@@ -302,15 +283,4 @@ const styles = StyleSheet.create({
302
283
  flexDirection: 'row',
303
284
  alignItems: 'center',
304
285
  },
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
286
  });