@react-navigation/native-stack 6.6.2 → 6.7.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.
@@ -32,7 +32,7 @@ function NativeStackView(_ref) {
32
32
  const previousKey = (_state$routes = state.routes[i - 1]) === null || _state$routes === void 0 ? void 0 : _state$routes.key;
33
33
  const nextKey = (_state$routes2 = state.routes[i + 1]) === null || _state$routes2 === void 0 ? void 0 : _state$routes2.key;
34
34
  const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
35
- const nexDescriptor = nextKey ? descriptors[nextKey] : undefined;
35
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
36
36
  const {
37
37
  options,
38
38
  navigation,
@@ -56,7 +56,7 @@ function NativeStackView(_ref) {
56
56
  presentation,
57
57
  contentStyle
58
58
  } = options;
59
- const nextPresentation = nexDescriptor === null || nexDescriptor === void 0 ? void 0 : nexDescriptor.options.presentation;
59
+ const nextPresentation = nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation;
60
60
  return /*#__PURE__*/React.createElement(_elements.Screen, {
61
61
  key: route.key,
62
62
  focused: isFocused,
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.tsx"],"names":["TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","styles","container","routes","map","route","i","isFocused","index","canGoBack","previousKey","key","nextKey","previousDescriptor","undefined","nexDescriptor","options","navigation","render","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","back","title","name","tintColor","label","backImage","goBack","children","StyleSheet","absoluteFill","display","includes","backgroundColor","contentContainer","create","flex","height","width","margin","resizeMode"],"mappings":";;;;;;;AAAA;;AAWA;;AACA;;;;;;AAeA,MAAMA,yBAAyB,GAAG,CAChC,kBADgC,EAEhC,2BAFgC,CAAlC;;AAK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AR,EAA0Bf,YAA1B;AAAb,OACGhB,MAAM,EADT,CA9FF,CADF;AAoGD,GApIA,CADH,CADF,CADF;AA2ID;;AAED,MAAMjB,MAAM,GAAG2C,wBAAWM,MAAX,CAAkB;AAC/BhD,EAAAA,SAAS,EAAE;AACTiD,IAAAA,IAAI,EAAE;AADG,GADoB;AAI/BF,EAAAA,gBAAgB,EAAE;AAChBE,IAAAA,IAAI,EAAE;AADU,GAJa;AAO/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,MAAM,EAAE,EADC;AAETC,IAAAA,KAAK,EAAE,EAFE;AAGTC,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,UAAU,EAAE;AAJH;AAPoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport type {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n // This is used for the native implementation of the stack.\n // eslint-disable-next-line react/no-unused-prop-types\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nconst TRANSPARENT_PRESENTATIONS = [\n 'transparentModal',\n 'containedTransparentModal',\n];\n\nexport default function NativeStackView({ state, descriptors }: Props) {\n return (\n <SafeAreaProviderCompat>\n <View style={styles.container}>\n {state.routes.map((route, i) => {\n const isFocused = state.index === i;\n const canGoBack = i !== 0;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nexDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } = descriptors[route.key];\n\n const {\n header,\n headerShown,\n headerTintColor,\n headerBackImageSource,\n headerLeft,\n headerRight,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerStyle,\n headerShadowVisible,\n headerTransparent,\n headerBackground,\n headerBackTitle,\n presentation,\n contentStyle,\n } = options;\n\n const nextPresentation = nexDescriptor?.options.presentation;\n\n return (\n <Screen\n key={route.key}\n focused={isFocused}\n route={route}\n navigation={navigation}\n headerShown={headerShown}\n headerTransparent={headerTransparent}\n header={\n header !== undefined ? (\n header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })\n ) : (\n <Header\n title={getHeaderTitle(options, route.name)}\n headerTintColor={headerTintColor}\n headerLeft={\n typeof headerLeft === 'function'\n ? ({ tintColor }) =>\n headerLeft({\n tintColor,\n canGoBack,\n label: headerBackTitle,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor }) => (\n <HeaderBackButton\n tintColor={tintColor}\n backImage={\n headerBackImageSource !== undefined\n ? () => (\n <Image\n source={headerBackImageSource}\n style={[\n styles.backImage,\n { tintColor },\n ]}\n />\n )\n : undefined\n }\n onPress={navigation.goBack}\n canGoBack={canGoBack}\n />\n )\n : headerLeft\n }\n headerRight={\n typeof headerRight === 'function'\n ? ({ tintColor }) =>\n headerRight({ tintColor, canGoBack })\n : headerRight\n }\n headerTitle={\n typeof headerTitle === 'function'\n ? ({ children, tintColor }) =>\n headerTitle({ children, tintColor })\n : headerTitle\n }\n headerTitleAlign={headerTitleAlign}\n headerTitleStyle={headerTitleStyle}\n headerTransparent={headerTransparent}\n headerShadowVisible={headerShadowVisible}\n headerBackground={headerBackground}\n headerStyle={headerStyle}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))\n ? 'flex'\n : 'none',\n },\n presentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}\n >\n <View style={[styles.contentContainer, contentStyle]}>\n {render()}\n </View>\n </Screen>\n );\n })}\n </View>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n});\n"]}
1
+ {"version":3,"sources":["NativeStackView.tsx"],"names":["TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","styles","container","routes","map","route","i","isFocused","index","canGoBack","previousKey","key","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","back","title","name","tintColor","label","backImage","goBack","children","StyleSheet","absoluteFill","display","includes","backgroundColor","contentContainer","create","flex","height","width","margin","resizeMode"],"mappings":";;;;;;;AAAA;;AAWA;;AACA;;;;;;AAeA,MAAMA,yBAAyB,GAAG,CAChC,kBADgC,EAEhC,2BAFgC,CAAlC;;AAKe,SAASC,eAAT,OAAwD;AAAA,MAA/B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA+B;AACrE,sBACE,oBAAC,gCAAD,qBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,KACGH,KAAK,CAACI,MAAN,CAAaC,GAAb,CAAiB,CAACC,KAAD,EAAQC,CAAR,KAAc;AAAA;;AAC9B,UAAMC,SAAS,GAAGR,KAAK,CAACS,KAAN,KAAgBF,CAAlC;AACA,UAAMG,SAAS,GAAGH,CAAC,KAAK,CAAxB;AACA,UAAMI,WAAW,oBAAGX,KAAK,CAACI,MAAN,CAAaG,CAAC,GAAG,CAAjB,CAAH,kDAAG,cAAqBK,GAAzC;AACA,UAAMC,OAAO,qBAAGb,KAAK,CAACI,MAAN,CAAaG,CAAC,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,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport type {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n // This is used for the native implementation of the stack.\n // eslint-disable-next-line react/no-unused-prop-types\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nconst TRANSPARENT_PRESENTATIONS = [\n 'transparentModal',\n 'containedTransparentModal',\n];\n\nexport default function NativeStackView({ state, descriptors }: Props) {\n return (\n <SafeAreaProviderCompat>\n <View style={styles.container}>\n {state.routes.map((route, i) => {\n const isFocused = state.index === i;\n const canGoBack = i !== 0;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } = descriptors[route.key];\n\n const {\n header,\n headerShown,\n headerTintColor,\n headerBackImageSource,\n headerLeft,\n headerRight,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerStyle,\n headerShadowVisible,\n headerTransparent,\n headerBackground,\n headerBackTitle,\n presentation,\n contentStyle,\n } = options;\n\n const nextPresentation = nextDescriptor?.options.presentation;\n\n return (\n <Screen\n key={route.key}\n focused={isFocused}\n route={route}\n navigation={navigation}\n headerShown={headerShown}\n headerTransparent={headerTransparent}\n header={\n header !== undefined ? (\n header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })\n ) : (\n <Header\n title={getHeaderTitle(options, route.name)}\n headerTintColor={headerTintColor}\n headerLeft={\n typeof headerLeft === 'function'\n ? ({ tintColor }) =>\n headerLeft({\n tintColor,\n canGoBack,\n label: headerBackTitle,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor }) => (\n <HeaderBackButton\n tintColor={tintColor}\n backImage={\n headerBackImageSource !== undefined\n ? () => (\n <Image\n source={headerBackImageSource}\n style={[\n styles.backImage,\n { tintColor },\n ]}\n />\n )\n : undefined\n }\n onPress={navigation.goBack}\n canGoBack={canGoBack}\n />\n )\n : headerLeft\n }\n headerRight={\n typeof headerRight === 'function'\n ? ({ tintColor }) =>\n headerRight({ tintColor, canGoBack })\n : headerRight\n }\n headerTitle={\n typeof headerTitle === 'function'\n ? ({ children, tintColor }) =>\n headerTitle({ children, tintColor })\n : headerTitle\n }\n headerTitleAlign={headerTitleAlign}\n headerTitleStyle={headerTitleStyle}\n headerTransparent={headerTransparent}\n headerShadowVisible={headerShadowVisible}\n headerBackground={headerBackground}\n headerStyle={headerStyle}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))\n ? 'flex'\n : 'none',\n },\n presentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}\n >\n <View style={[styles.contentContainer, contentStyle]}>\n {render()}\n </View>\n </Screen>\n );\n })}\n </View>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n});\n"]}
@@ -82,6 +82,7 @@ const SceneView = _ref2 => {
82
82
  let {
83
83
  descriptor,
84
84
  previousDescriptor,
85
+ nextDescriptor,
85
86
  index,
86
87
  onWillDisappear,
87
88
  onAppear,
@@ -95,22 +96,53 @@ const SceneView = _ref2 => {
95
96
  render
96
97
  } = descriptor;
97
98
  const {
98
- animation,
99
+ animationDuration,
99
100
  animationTypeForReplace = 'push',
100
- customAnimationOnGesture,
101
- fullScreenGestureEnabled,
102
101
  gestureEnabled,
103
102
  header,
104
103
  headerShown,
104
+ autoHideHomeIndicator,
105
+ navigationBarColor,
106
+ navigationBarHidden,
105
107
  orientation,
106
108
  statusBarAnimation,
107
109
  statusBarHidden,
108
- statusBarStyle
110
+ statusBarStyle,
111
+ statusBarTranslucent,
112
+ statusBarColor
109
113
  } = options;
110
114
  let {
111
- presentation = 'card'
115
+ animation,
116
+ customAnimationOnGesture,
117
+ fullScreenGestureEnabled,
118
+ presentation = 'card',
119
+ gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical'
112
120
  } = options;
113
121
 
122
+ if (gestureDirection === 'vertical' && _reactNative.Platform.OS === 'ios') {
123
+ // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
124
+ // so the screen can be dismissed from any point on screen.
125
+ // `customAnimationOnGesture` needs to be set to `true` so the `animation` set by user can be used,
126
+ // otherwise `simple_push` will be used.
127
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
128
+ if (fullScreenGestureEnabled === undefined) {
129
+ fullScreenGestureEnabled = true;
130
+ }
131
+
132
+ if (customAnimationOnGesture === undefined) {
133
+ customAnimationOnGesture = true;
134
+ }
135
+
136
+ if (animation === undefined) {
137
+ animation = 'slide_from_bottom';
138
+ }
139
+ } // workaround for rn-screens where gestureDirection has to be set on both
140
+ // current and previous screen - software-mansion/react-native-screens/pull/1509
141
+
142
+
143
+ const nextGestureDirection = nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.gestureDirection;
144
+ const gestureDirectionOverride = nextGestureDirection != null ? nextGestureDirection : gestureDirection;
145
+
114
146
  if (index === 0) {
115
147
  // first screen should always be treated as `card`, it resolves problems with no header animation
116
148
  // for navigator with first screen as `modal` and the next as `card`
@@ -123,7 +155,7 @@ const SceneView = _ref2 => {
123
155
 
124
156
  const isModal = presentation === 'modal' || presentation === 'formSheet'; // Modals are fullscreen in landscape only on iPhone
125
157
 
126
- const isIPhone = _reactNative.Platform.OS === 'ios' && !(_reactNative.Platform.isPad && _reactNative.Platform.isTVOS);
158
+ const isIPhone = _reactNative.Platform.OS === 'ios' && !(_reactNative.Platform.isPad || _reactNative.Platform.isTVOS);
127
159
  const isLandscape = frame.width > frame.height;
128
160
  const topInset = isModal || isIPhone && isLandscape ? 0 : insets.top;
129
161
  const isParentHeaderShown = React.useContext(_elements.HeaderShownContext);
@@ -140,6 +172,9 @@ const SceneView = _ref2 => {
140
172
  gestureEnabled: isAndroid ? // This prop enables handling of system back gestures on Android
141
173
  // Since we handle them in JS side, we disable this
142
174
  false : gestureEnabled,
175
+ homeIndicatorHidden: autoHideHomeIndicator,
176
+ navigationBarColor: navigationBarColor,
177
+ navigationBarHidden: navigationBarHidden,
143
178
  replaceAnimation: animationTypeForReplace,
144
179
  stackPresentation: presentation === 'card' ? 'push' : presentation,
145
180
  stackAnimation: animation,
@@ -147,6 +182,10 @@ const SceneView = _ref2 => {
147
182
  statusBarAnimation: statusBarAnimation,
148
183
  statusBarHidden: statusBarHidden,
149
184
  statusBarStyle: statusBarStyle,
185
+ statusBarColor: statusBarColor,
186
+ statusBarTranslucent: statusBarTranslucent,
187
+ swipeDirection: gestureDirectionOverride,
188
+ transitionDuration: animationDuration,
150
189
  onWillDisappear: onWillDisappear,
151
190
  onAppear: onAppear,
152
191
  onDisappear: onDisappear,
@@ -203,16 +242,19 @@ function NativeStackViewInner(_ref3) {
203
242
  return /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStack, {
204
243
  style: styles.container
205
244
  }, state.routes.map((route, index) => {
206
- var _state$routes;
245
+ var _state$routes, _state$routes2;
207
246
 
208
247
  const descriptor = descriptors[route.key];
209
248
  const previousKey = (_state$routes = state.routes[index - 1]) === null || _state$routes === void 0 ? void 0 : _state$routes.key;
249
+ const nextKey = (_state$routes2 = state.routes[index + 1]) === null || _state$routes2 === void 0 ? void 0 : _state$routes2.key;
210
250
  const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
251
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
211
252
  return /*#__PURE__*/React.createElement(SceneView, {
212
253
  key: route.key,
213
254
  index: index,
214
255
  descriptor: descriptor,
215
256
  previousDescriptor: previousDescriptor,
257
+ nextDescriptor: nextDescriptor,
216
258
  onWillDisappear: () => {
217
259
  navigation.emit({
218
260
  type: 'transitionStart',
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.native.tsx"],"names":["isAndroid","Platform","OS","MaybeNestedStack","options","route","presentation","headerHeight","children","colors","header","headerShown","contentStyle","isHeaderInModal","undefined","headerShownPreviousRef","React","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","StyleSheet","absoluteFill","SceneView","descriptor","previousDescriptor","index","onWillDisappear","onAppear","onDisappear","onDismissed","navigation","render","animation","animationTypeForReplace","customAnimationOnGesture","fullScreenGestureEnabled","gestureEnabled","orientation","statusBarAnimation","statusBarHidden","statusBarStyle","isHeaderInPush","insets","frame","isModal","isIPhone","isPad","isTVOS","isLandscape","width","height","topInset","top","isParentHeaderShown","useContext","HeaderShownContext","parentHeaderHeight","HeaderHeightContext","defaultHeaderHeight","customHeaderHeight","setCustomHeaderHeight","useState","key","e","nativeEvent","layout","back","title","NativeStackViewInner","state","descriptors","nextDismissedKey","setNextDismissedKey","dismissedRouteName","routes","find","message","console","error","map","previousKey","emit","type","data","closing","target","event","dispatch","StackActions","pop","dismissCount","source","NativeStackView","props","create","flex"],"mappings":";;;;;;;AAAA;;AAOA;;AASA;;AACA;;AACA;;AAKA;;AAKA;;AAQA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAGC,sBAASC,EAAT,KAAgB,SAAlC;;AAEA,MAAMC,gBAAgB,GAAG,QAYnB;AAAA,MAZoB;AACxBC,IAAAA,OADwB;AAExBC,IAAAA,KAFwB;AAGxBC,IAAAA,YAHwB;AAIxBC,IAAAA,YAJwB;AAKxBC,IAAAA;AALwB,GAYpB;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AACA,QAAM;AAAEC,IAAAA,MA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BAAW0E,MAAX,CAAkB;AAC/B7E,EAAAA,SAAS,EAAE;AACT8E,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport type { ScreenProps } from 'react-native-screens';\nimport {\n Screen,\n ScreenStack,\n StackPresentationTypes,\n} from 'react-native-screens';\nimport warnOnce from 'warn-once';\n\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport DebugContainer from './DebugContainer';\nimport HeaderConfig from './HeaderConfig';\n\nconst isAndroid = Platform.OS === 'android';\n\nconst MaybeNestedStack = ({\n options,\n route,\n presentation,\n headerHeight,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n presentation: Exclude<StackPresentationTypes, 'push'> | 'card';\n headerHeight: number;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { header, headerShown = true, contentStyle } = options;\n\n const isHeaderInModal = isAndroid\n ? false\n : presentation !== 'card' && headerShown === true && header === undefined;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n presentation !== 'card' &&\n headerShownPreviousRef.current !== headerShown,\n `Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`\n );\n\n headerShownPreviousRef.current = headerShown;\n }, [headerShown, presentation, route.name]);\n\n const content = (\n <DebugContainer\n style={[\n styles.container,\n presentation !== 'transparentModal' &&\n presentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n >\n {children}\n </DebugContainer>\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled style={StyleSheet.absoluteFill}>\n <HeaderConfig\n {...options}\n route={route}\n headerHeight={headerHeight}\n canGoBack\n />\n {content}\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype SceneViewProps = {\n index: number;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n onWillDisappear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n};\n\nconst SceneView = ({\n descriptor,\n previousDescriptor,\n index,\n onWillDisappear,\n onAppear,\n onDisappear,\n onDismissed,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n const {\n animation,\n animationTypeForReplace = 'push',\n customAnimationOnGesture,\n fullScreenGestureEnabled,\n gestureEnabled,\n header,\n headerShown,\n orientation,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n } = options;\n\n let { presentation = 'card' } = options;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : presentation === 'card' && headerShown !== false;\n\n const insets = useSafeAreaInsets();\n const frame = useSafeAreaFrame();\n\n // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.\n const isModal = presentation === 'modal' || presentation === 'formSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone =\n Platform.OS === 'ios' && !(Platform.isPad && Platform.isTVOS);\n const isLandscape = frame.width > frame.height;\n\n const topInset = isModal || (isIPhone && isLandscape) ? 0 : insets.top;\n\n const isParentHeaderShown = React.useContext(HeaderShownContext);\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n\n const defaultHeaderHeight = getDefaultHeaderHeight(frame, isModal, topInset);\n\n const [customHeaderHeight, setCustomHeaderHeight] =\n React.useState(defaultHeaderHeight);\n\n const headerHeight = header ? customHeaderHeight : defaultHeaderHeight;\n\n return (\n <Screen\n key={route.key}\n enabled\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnGesture}\n fullScreenSwipeEnabled={fullScreenGestureEnabled}\n gestureEnabled={\n isAndroid\n ? // This prop enables handling of system back gestures on Android\n // Since we handle them in JS side, we disable this\n false\n : gestureEnabled\n }\n replaceAnimation={animationTypeForReplace}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n stackAnimation={animation}\n screenOrientation={orientation}\n statusBarAnimation={statusBarAnimation}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n onWillDisappear={onWillDisappear}\n onAppear={onAppear}\n onDisappear={onDisappear}\n onDismissed={onDismissed}\n isNativeStack\n >\n <NavigationContext.Provider value={navigation}>\n <NavigationRouteContext.Provider value={route}>\n <HeaderShownContext.Provider\n value={isParentHeaderShown || isHeaderInPush !== false}\n >\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false\n ? headerHeight\n : parentHeaderHeight ?? 0\n }\n >\n {header !== undefined && headerShown !== false ? (\n <View\n onLayout={(e) => {\n setCustomHeaderHeight(e.nativeEvent.layout.height);\n }}\n >\n {header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })}\n </View>\n ) : (\n <HeaderConfig\n {...options}\n route={route}\n headerShown={isHeaderInPush}\n headerHeight={headerHeight}\n canGoBack={index !== 0}\n />\n )}\n <MaybeNestedStack\n options={options}\n route={route}\n presentation={presentation}\n headerHeight={headerHeight}\n >\n {render()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </HeaderShownContext.Provider>\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({ state, navigation, descriptors }: Props) {\n const [nextDismissedKey, setNextDismissedKey] = React.useState<string | null>(\n null\n );\n\n const dismissedRouteName = nextDismissedKey\n ? state.routes.find((route) => route.key === nextDismissedKey)?.name\n : null;\n\n React.useEffect(() => {\n if (dismissedRouteName) {\n const message =\n `The screen '${dismissedRouteName}' was removed natively but didn't get removed from JS state. ` +\n `This can happen if the action was prevented in a 'beforeRemove' listener, which is not fully supported in native-stack.\\n\\n` +\n `Consider using 'gestureEnabled: false' to prevent back gesture and use a custom back button with 'headerLeft' option to override the native behavior.`;\n\n console.error(message);\n }\n }, [dismissedRouteName]);\n\n return (\n <ScreenStack style={styles.container}>\n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const previousKey = state.routes[index - 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n\n return (\n <SceneView\n key={route.key}\n index={index}\n descriptor={descriptor}\n previousDescriptor={previousDescriptor}\n onWillDisappear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n />\n );\n })}\n </ScreenStack>\n );\n}\n\nexport default function NativeStackView(props: Props) {\n return (\n <SafeAreaProviderCompat>\n <NativeStackViewInner {...props} />\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"sources":["NativeStackView.native.tsx"],"names":["isAndroid","Platform","OS","MaybeNestedStack","options","route","presentation","headerHeight","children","colors","header","headerShown","contentStyle","isHeaderInModal","undefined","headerShownPreviousRef","React","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","StyleSheet","absoluteFill","SceneView","descriptor","previousDescriptor","nextDescriptor","index","onWillDisappear","onAppear","onDisappear","onDismissed","navigation","render","animationDuration","animationTypeForReplace","gestureEnabled","autoHideHomeIndicator","navigationBarColor","navigationBarHidden","orientation","statusBarAnimation","statusBarHidden","statusBarStyle","statusBarTranslucent","statusBarColor","animation","customAnimationOnGesture","fullScreenGestureEnabled","gestureDirection","nextGestureDirection","gestureDirectionOverride","isHeaderInPush","insets","frame","isModal","isIPhone","isPad","isTVOS","isLandscape","width","height","topInset","top","isParentHeaderShown","useContext","HeaderShownContext","parentHeaderHeight","HeaderHeightContext","defaultHeaderHeight","customHeaderHeight","setCustomHeaderHeight","useState","key","e","nativeEvent","layout","back","title","NativeStackViewInner","state","descriptors","nextDismissedKey","setNextDismissedKey","dismissedRouteName","routes","find","message","console","error","map","previousKey","nextKey","emit","type","data","closing","target","event","dispatch","StackActions","pop","dismissCount","source","NativeStackView","props","create","flex"],"mappings":";;;;;;;AAAA;;AAOA;;AASA;;AACA;;AACA;;AAKA;;AAKA;;AAQA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAGC,sBAASC,EAAT,KAAgB,SAAlC;;AAEA,MAAMC,gBAAgB,GAAG,QAYnB;AAAA,MAZoB;AACxBC,IAAAA,OADwB;AAExBC,IAAAA,KAFwB;AAGxBC,IAAAA,YAHwB;AAIxBC,IAAAA,YAJwB;AAKxBC,IAAAA;AALwB,GAYpB;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AACA,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,WAAW,GAAG,IAAxB;AAA8BC,IAAAA;AAA9B,MAA+CR,OAArD;AAEA,QAAMS,eAAe,GAAGb,SAAS,GAC7B,KAD6B,GAE7BM,YAAY,KAAK,MAAjB,IAA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Content":["import {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport type { ScreenProps } from 'react-native-screens';\nimport {\n Screen,\n ScreenStack,\n StackPresentationTypes,\n} from 'react-native-screens';\nimport warnOnce from 'warn-once';\n\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport DebugContainer from './DebugContainer';\nimport HeaderConfig from './HeaderConfig';\n\nconst isAndroid = Platform.OS === 'android';\n\nconst MaybeNestedStack = ({\n options,\n route,\n presentation,\n headerHeight,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n presentation: Exclude<StackPresentationTypes, 'push'> | 'card';\n headerHeight: number;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { header, headerShown = true, contentStyle } = options;\n\n const isHeaderInModal = isAndroid\n ? false\n : presentation !== 'card' && headerShown === true && header === undefined;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n presentation !== 'card' &&\n headerShownPreviousRef.current !== headerShown,\n `Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`\n );\n\n headerShownPreviousRef.current = headerShown;\n }, [headerShown, presentation, route.name]);\n\n const content = (\n <DebugContainer\n style={[\n styles.container,\n presentation !== 'transparentModal' &&\n presentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n >\n {children}\n </DebugContainer>\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled style={StyleSheet.absoluteFill}>\n <HeaderConfig\n {...options}\n route={route}\n headerHeight={headerHeight}\n canGoBack\n />\n {content}\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype SceneViewProps = {\n index: number;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n nextDescriptor?: NativeStackDescriptor;\n onWillDisappear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n};\n\nconst SceneView = ({\n descriptor,\n previousDescriptor,\n nextDescriptor,\n index,\n onWillDisappear,\n onAppear,\n onDisappear,\n onDismissed,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n const {\n animationDuration,\n animationTypeForReplace = 'push',\n gestureEnabled,\n header,\n headerShown,\n autoHideHomeIndicator,\n navigationBarColor,\n navigationBarHidden,\n orientation,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n statusBarColor,\n } = options;\n\n let {\n animation,\n customAnimationOnGesture,\n fullScreenGestureEnabled,\n presentation = 'card',\n gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',\n } = options;\n\n if (gestureDirection === 'vertical' && Platform.OS === 'ios') {\n // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `customAnimationOnGesture` needs to be set to `true` so the `animation` set by user can be used,\n // otherwise `simple_push` will be used.\n // Also, the default animation for this direction seems to be `slide_from_bottom`.\n if (fullScreenGestureEnabled === undefined) {\n fullScreenGestureEnabled = true;\n }\n if (customAnimationOnGesture === undefined) {\n customAnimationOnGesture = true;\n }\n if (animation === undefined) {\n animation = 'slide_from_bottom';\n }\n }\n\n // workaround for rn-screens where gestureDirection has to be set on both\n // current and previous screen - software-mansion/react-native-screens/pull/1509\n const nextGestureDirection = nextDescriptor?.options.gestureDirection;\n const gestureDirectionOverride =\n nextGestureDirection != null ? nextGestureDirection : gestureDirection;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : presentation === 'card' && headerShown !== false;\n\n const insets = useSafeAreaInsets();\n const frame = useSafeAreaFrame();\n\n // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.\n const isModal = presentation === 'modal' || presentation === 'formSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone =\n Platform.OS === 'ios' && !(Platform.isPad || Platform.isTVOS);\n const isLandscape = frame.width > frame.height;\n\n const topInset = isModal || (isIPhone && isLandscape) ? 0 : insets.top;\n\n const isParentHeaderShown = React.useContext(HeaderShownContext);\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n\n const defaultHeaderHeight = getDefaultHeaderHeight(frame, isModal, topInset);\n\n const [customHeaderHeight, setCustomHeaderHeight] =\n React.useState(defaultHeaderHeight);\n\n const headerHeight = header ? customHeaderHeight : defaultHeaderHeight;\n\n return (\n <Screen\n key={route.key}\n enabled\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnGesture}\n fullScreenSwipeEnabled={fullScreenGestureEnabled}\n gestureEnabled={\n isAndroid\n ? // This prop enables handling of system back gestures on Android\n // Since we handle them in JS side, we disable this\n false\n : gestureEnabled\n }\n homeIndicatorHidden={autoHideHomeIndicator}\n navigationBarColor={navigationBarColor}\n navigationBarHidden={navigationBarHidden}\n replaceAnimation={animationTypeForReplace}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n stackAnimation={animation}\n screenOrientation={orientation}\n statusBarAnimation={statusBarAnimation}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarColor={statusBarColor}\n statusBarTranslucent={statusBarTranslucent}\n swipeDirection={gestureDirectionOverride}\n transitionDuration={animationDuration}\n onWillDisappear={onWillDisappear}\n onAppear={onAppear}\n onDisappear={onDisappear}\n onDismissed={onDismissed}\n isNativeStack\n >\n <NavigationContext.Provider value={navigation}>\n <NavigationRouteContext.Provider value={route}>\n <HeaderShownContext.Provider\n value={isParentHeaderShown || isHeaderInPush !== false}\n >\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false\n ? headerHeight\n : parentHeaderHeight ?? 0\n }\n >\n {header !== undefined && headerShown !== false ? (\n <View\n onLayout={(e) => {\n setCustomHeaderHeight(e.nativeEvent.layout.height);\n }}\n >\n {header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })}\n </View>\n ) : (\n <HeaderConfig\n {...options}\n route={route}\n headerShown={isHeaderInPush}\n headerHeight={headerHeight}\n canGoBack={index !== 0}\n />\n )}\n <MaybeNestedStack\n options={options}\n route={route}\n presentation={presentation}\n headerHeight={headerHeight}\n >\n {render()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </HeaderShownContext.Provider>\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({ state, navigation, descriptors }: Props) {\n const [nextDismissedKey, setNextDismissedKey] = React.useState<string | null>(\n null\n );\n\n const dismissedRouteName = nextDismissedKey\n ? state.routes.find((route) => route.key === nextDismissedKey)?.name\n : null;\n\n React.useEffect(() => {\n if (dismissedRouteName) {\n const message =\n `The screen '${dismissedRouteName}' was removed natively but didn't get removed from JS state. ` +\n `This can happen if the action was prevented in a 'beforeRemove' listener, which is not fully supported in native-stack.\\n\\n` +\n `Consider using 'gestureEnabled: false' to prevent back gesture and use a custom back button with 'headerLeft' option to override the native behavior.`;\n\n console.error(message);\n }\n }, [dismissedRouteName]);\n\n return (\n <ScreenStack style={styles.container}>\n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const previousKey = state.routes[index - 1]?.key;\n const nextKey = state.routes[index + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n\n return (\n <SceneView\n key={route.key}\n index={index}\n descriptor={descriptor}\n previousDescriptor={previousDescriptor}\n nextDescriptor={nextDescriptor}\n onWillDisappear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n />\n );\n })}\n </ScreenStack>\n );\n}\n\nexport default function NativeStackView(props: Props) {\n return (\n <SafeAreaProviderCompat>\n <NativeStackViewInner {...props} />\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
@@ -17,7 +17,7 @@ export default function NativeStackView(_ref) {
17
17
  const previousKey = (_state$routes = state.routes[i - 1]) === null || _state$routes === void 0 ? void 0 : _state$routes.key;
18
18
  const nextKey = (_state$routes2 = state.routes[i + 1]) === null || _state$routes2 === void 0 ? void 0 : _state$routes2.key;
19
19
  const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
20
- const nexDescriptor = nextKey ? descriptors[nextKey] : undefined;
20
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
21
21
  const {
22
22
  options,
23
23
  navigation,
@@ -41,7 +41,7 @@ export default function NativeStackView(_ref) {
41
41
  presentation,
42
42
  contentStyle
43
43
  } = options;
44
- const nextPresentation = nexDescriptor === null || nexDescriptor === void 0 ? void 0 : nexDescriptor.options.presentation;
44
+ const nextPresentation = nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation;
45
45
  return /*#__PURE__*/React.createElement(Screen, {
46
46
  key: route.key,
47
47
  focused: isFocused,
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.tsx"],"names":["getHeaderTitle","Header","HeaderBackButton","SafeAreaProviderCompat","Screen","React","Image","StyleSheet","View","TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","styles","container","routes","map","route","i","isFocused","index","canGoBack","previousKey","key","nextKey","previousDescriptor","undefined","nexDescriptor","options","navigation","render","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","back","title","name","tintColor","label","backImage","goBack","children","absoluteFill","display","includes","backgroundColor","contentContainer","create","flex","height","width","margin","resizeMode"],"mappings":"AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,gBAHF,EAIEC,sBAJF,EAKEC,MALF,QAMO,4BANP;AAWA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,KAAT,EAAgBC,UAAhB,EAA4BC,IAA5B,QAAwC,cAAxC;AAeA,MAAMC,yBAAyB,GAAG,CAChC,kBADgC,EAEhC,2BAFgC,CAAlC;AAKA,eAAe,SAASC,eAAT,OAAwD;AAAA,MAA/B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA+B;AACrE,sBACE,oBAAC,sBAAD,qBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,KACGH,KAAK,CAACI,MAAN,CAAaC,GAAb,CAAiB,CAACC,KAAD,EAAQC,CAAR,KAAc;AAAA;;AAC9B,UAAMC,SAAS,GAAGR,KAAK,CAACS,KAAN,KAAgBF,CAAlC;AACA,UAAMG,SAAS,GAAGH,CAAC,KAAK,CAAxB;AACA,UAAMI,WAAW,oBAAGX,KAAK,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AAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,UAAU,EAAE;AAJH;AAPoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport type {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n // This is used for the native implementation of the stack.\n // eslint-disable-next-line react/no-unused-prop-types\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nconst TRANSPARENT_PRESENTATIONS = [\n 'transparentModal',\n 'containedTransparentModal',\n];\n\nexport default function NativeStackView({ state, descriptors }: Props) {\n return (\n <SafeAreaProviderCompat>\n <View style={styles.container}>\n {state.routes.map((route, i) => {\n const isFocused = state.index === i;\n const canGoBack = i !== 0;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nexDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } = descriptors[route.key];\n\n const {\n header,\n headerShown,\n headerTintColor,\n headerBackImageSource,\n headerLeft,\n headerRight,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerStyle,\n headerShadowVisible,\n headerTransparent,\n headerBackground,\n headerBackTitle,\n presentation,\n contentStyle,\n } = options;\n\n const nextPresentation = nexDescriptor?.options.presentation;\n\n return (\n <Screen\n key={route.key}\n focused={isFocused}\n route={route}\n navigation={navigation}\n headerShown={headerShown}\n headerTransparent={headerTransparent}\n header={\n header !== undefined ? (\n header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })\n ) : (\n <Header\n title={getHeaderTitle(options, route.name)}\n headerTintColor={headerTintColor}\n headerLeft={\n typeof headerLeft === 'function'\n ? ({ tintColor }) =>\n headerLeft({\n tintColor,\n canGoBack,\n label: headerBackTitle,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor }) => (\n <HeaderBackButton\n tintColor={tintColor}\n backImage={\n headerBackImageSource !== undefined\n ? () => (\n <Image\n source={headerBackImageSource}\n style={[\n styles.backImage,\n { tintColor },\n ]}\n />\n )\n : undefined\n }\n onPress={navigation.goBack}\n canGoBack={canGoBack}\n />\n )\n : headerLeft\n }\n headerRight={\n typeof headerRight === 'function'\n ? ({ tintColor }) =>\n headerRight({ tintColor, canGoBack })\n : headerRight\n }\n headerTitle={\n typeof headerTitle === 'function'\n ? ({ children, tintColor }) =>\n headerTitle({ children, tintColor })\n : headerTitle\n }\n headerTitleAlign={headerTitleAlign}\n headerTitleStyle={headerTitleStyle}\n headerTransparent={headerTransparent}\n headerShadowVisible={headerShadowVisible}\n headerBackground={headerBackground}\n headerStyle={headerStyle}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))\n ? 'flex'\n : 'none',\n },\n presentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}\n >\n <View style={[styles.contentContainer, contentStyle]}>\n {render()}\n </View>\n </Screen>\n );\n })}\n </View>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n});\n"]}
1
+ {"version":3,"sources":["NativeStackView.tsx"],"names":["getHeaderTitle","Header","HeaderBackButton","SafeAreaProviderCompat","Screen","React","Image","StyleSheet","View","TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","styles","container","routes","map","route","i","isFocused","index","canGoBack","previousKey","key","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","headerBackground","headerBackTitle","presentation","contentStyle","nextPresentation","back","title","name","tintColor","label","backImage","goBack","children","absoluteFill","display","includes","backgroundColor","contentContainer","create","flex","height","width","margin","resizeMode"],"mappings":"AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,gBAHF,EAIEC,sBAJF,EAKEC,MALF,QAMO,4BANP;AAWA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,KAAT,EAAgBC,UAAhB,EAA4BC,IAA5B,QAAwC,cAAxC;AAeA,MAAMC,yBAAyB,GAAG,CAChC,kBADgC,EAEhC,2BAFgC,CAAlC;AAKA,eAAe,SAASC,eAAT,OAAwD;AAAA,MAA/B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA+B;AACrE,sBACE,oBAAC,sBAAD,qBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,KACGH,KAAK,CAACI,MAAN,CAAaC,GAAb,CAAiB,CAACC,KAAD,EAAQC,CAAR,KAAc;AAAA;;AAC9B,UAAMC,SAAS,GAAGR,KAAK,CAACS,KAAN,KAAgBF,CAAlC;AACA,UAAMG,SAAS,GAAGH,CAAC,KAAK,CAAxB;AACA,UAAMI,WAAW,oBAAGX,KAAK,CAACI,MAAN,CAAaG,CAAC,GAAG,CAAjB,CAAH,kDAAG,cAAqBK,GAAzC;AACA,UAAMC,OAAO,qBAAGb,KAAK,CAACI,MAAN,CAAaG,CAAC,GAAG,CAAjB,CAAH,mDAAG,eAAqBK,GAArC;AACA,UAAME,kBAAkB,GAAGH,WAAW,GAClCV,WAAW,CAACU,WAAD,CADuB,GAElCI,SAFJ;AAGA,UAAMC,cAAc,GAAGH,OAAO,GAAGZ,W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CpB;AAgDE,QAAA,iBAAiB,EAAEG,iBAhDrB;AAiDE,QAAA,mBAAmB,EAAED,mBAjDvB;AAkDE,QAAA,gBAAgB,EAAEE,gBAlDpB;AAmDE,QAAA,WAAW,EAAEH;AAnDf,QAvBN;AA8EE,MAAA,KAAK,EAAE,CACLjC,UAAU,CAACiD,YADN,EAEL;AACEC,QAAAA,OAAO,EACLtC,SAAS,IACR4B,gBAAgB,IAAI,IAApB,IACCtC,yBAAyB,CAACiD,QAA1B,CAAmCX,gBAAnC,CAFF,GAGI,MAHJ,GAII;AANR,OAFK,EAULF,YAAY,IAAI,IAAhB,IACApC,yBAAyB,CAACiD,QAA1B,CAAmCb,YAAnC,CADA,GAEI;AAAEc,QAAAA,eAAe,EAAE;AAAnB,OAFJ,GAGI,IAbC;AA9ET,oBA8FE,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAAC9C,MAAM,CAAC+C,gBAAR,EAA0Bd,YAA1B;AAAb,OACGhB,MAAM,EADT,CA9FF,CADF;AAoGD,GApIA,CADH,CADF,CADF;AA2ID;AAED,MAAMjB,MAAM,GAAGN,UAAU,CAACsD,MAAX,CAAkB;AAC/B/C,EAAAA,SAAS,EAAE;AACTgD,IAAAA,IAAI,EAAE;AADG,GADoB;AAI/BF,EAAAA,gBAAgB,EAAE;AAChBE,IAAAA,IAAI,EAAE;AADU,GAJa;AAO/BT,EAAAA,SAAS,EAAE;AACTU,IAAAA,MAAM,EAAE,EADC;AAETC,IAAAA,KAAK,EAAE,EAFE;AAGTC,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,UAAU,EAAE;AAJH;AAPoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport type {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n // This is used for the native implementation of the stack.\n // eslint-disable-next-line react/no-unused-prop-types\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nconst TRANSPARENT_PRESENTATIONS = [\n 'transparentModal',\n 'containedTransparentModal',\n];\n\nexport default function NativeStackView({ state, descriptors }: Props) {\n return (\n <SafeAreaProviderCompat>\n <View style={styles.container}>\n {state.routes.map((route, i) => {\n const isFocused = state.index === i;\n const canGoBack = i !== 0;\n const previousKey = state.routes[i - 1]?.key;\n const nextKey = state.routes[i + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n const { options, navigation, render } = descriptors[route.key];\n\n const {\n header,\n headerShown,\n headerTintColor,\n headerBackImageSource,\n headerLeft,\n headerRight,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerStyle,\n headerShadowVisible,\n headerTransparent,\n headerBackground,\n headerBackTitle,\n presentation,\n contentStyle,\n } = options;\n\n const nextPresentation = nextDescriptor?.options.presentation;\n\n return (\n <Screen\n key={route.key}\n focused={isFocused}\n route={route}\n navigation={navigation}\n headerShown={headerShown}\n headerTransparent={headerTransparent}\n header={\n header !== undefined ? (\n header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })\n ) : (\n <Header\n title={getHeaderTitle(options, route.name)}\n headerTintColor={headerTintColor}\n headerLeft={\n typeof headerLeft === 'function'\n ? ({ tintColor }) =>\n headerLeft({\n tintColor,\n canGoBack,\n label: headerBackTitle,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor }) => (\n <HeaderBackButton\n tintColor={tintColor}\n backImage={\n headerBackImageSource !== undefined\n ? () => (\n <Image\n source={headerBackImageSource}\n style={[\n styles.backImage,\n { tintColor },\n ]}\n />\n )\n : undefined\n }\n onPress={navigation.goBack}\n canGoBack={canGoBack}\n />\n )\n : headerLeft\n }\n headerRight={\n typeof headerRight === 'function'\n ? ({ tintColor }) =>\n headerRight({ tintColor, canGoBack })\n : headerRight\n }\n headerTitle={\n typeof headerTitle === 'function'\n ? ({ children, tintColor }) =>\n headerTitle({ children, tintColor })\n : headerTitle\n }\n headerTitleAlign={headerTitleAlign}\n headerTitleStyle={headerTitleStyle}\n headerTransparent={headerTransparent}\n headerShadowVisible={headerShadowVisible}\n headerBackground={headerBackground}\n headerStyle={headerStyle}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n {\n display:\n isFocused ||\n (nextPresentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(nextPresentation))\n ? 'flex'\n : 'none',\n },\n presentation != null &&\n TRANSPARENT_PRESENTATIONS.includes(presentation)\n ? { backgroundColor: 'transparent' }\n : null,\n ]}\n >\n <View style={[styles.contentContainer, contentStyle]}>\n {render()}\n </View>\n </Screen>\n );\n })}\n </View>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n});\n"]}
@@ -60,6 +60,7 @@ const SceneView = _ref2 => {
60
60
  let {
61
61
  descriptor,
62
62
  previousDescriptor,
63
+ nextDescriptor,
63
64
  index,
64
65
  onWillDisappear,
65
66
  onAppear,
@@ -73,22 +74,53 @@ const SceneView = _ref2 => {
73
74
  render
74
75
  } = descriptor;
75
76
  const {
76
- animation,
77
+ animationDuration,
77
78
  animationTypeForReplace = 'push',
78
- customAnimationOnGesture,
79
- fullScreenGestureEnabled,
80
79
  gestureEnabled,
81
80
  header,
82
81
  headerShown,
82
+ autoHideHomeIndicator,
83
+ navigationBarColor,
84
+ navigationBarHidden,
83
85
  orientation,
84
86
  statusBarAnimation,
85
87
  statusBarHidden,
86
- statusBarStyle
88
+ statusBarStyle,
89
+ statusBarTranslucent,
90
+ statusBarColor
87
91
  } = options;
88
92
  let {
89
- presentation = 'card'
93
+ animation,
94
+ customAnimationOnGesture,
95
+ fullScreenGestureEnabled,
96
+ presentation = 'card',
97
+ gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical'
90
98
  } = options;
91
99
 
100
+ if (gestureDirection === 'vertical' && Platform.OS === 'ios') {
101
+ // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
102
+ // so the screen can be dismissed from any point on screen.
103
+ // `customAnimationOnGesture` needs to be set to `true` so the `animation` set by user can be used,
104
+ // otherwise `simple_push` will be used.
105
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
106
+ if (fullScreenGestureEnabled === undefined) {
107
+ fullScreenGestureEnabled = true;
108
+ }
109
+
110
+ if (customAnimationOnGesture === undefined) {
111
+ customAnimationOnGesture = true;
112
+ }
113
+
114
+ if (animation === undefined) {
115
+ animation = 'slide_from_bottom';
116
+ }
117
+ } // workaround for rn-screens where gestureDirection has to be set on both
118
+ // current and previous screen - software-mansion/react-native-screens/pull/1509
119
+
120
+
121
+ const nextGestureDirection = nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.gestureDirection;
122
+ const gestureDirectionOverride = nextGestureDirection != null ? nextGestureDirection : gestureDirection;
123
+
92
124
  if (index === 0) {
93
125
  // first screen should always be treated as `card`, it resolves problems with no header animation
94
126
  // for navigator with first screen as `modal` and the next as `card`
@@ -101,7 +133,7 @@ const SceneView = _ref2 => {
101
133
 
102
134
  const isModal = presentation === 'modal' || presentation === 'formSheet'; // Modals are fullscreen in landscape only on iPhone
103
135
 
104
- const isIPhone = Platform.OS === 'ios' && !(Platform.isPad && Platform.isTVOS);
136
+ const isIPhone = Platform.OS === 'ios' && !(Platform.isPad || Platform.isTVOS);
105
137
  const isLandscape = frame.width > frame.height;
106
138
  const topInset = isModal || isIPhone && isLandscape ? 0 : insets.top;
107
139
  const isParentHeaderShown = React.useContext(HeaderShownContext);
@@ -118,6 +150,9 @@ const SceneView = _ref2 => {
118
150
  gestureEnabled: isAndroid ? // This prop enables handling of system back gestures on Android
119
151
  // Since we handle them in JS side, we disable this
120
152
  false : gestureEnabled,
153
+ homeIndicatorHidden: autoHideHomeIndicator,
154
+ navigationBarColor: navigationBarColor,
155
+ navigationBarHidden: navigationBarHidden,
121
156
  replaceAnimation: animationTypeForReplace,
122
157
  stackPresentation: presentation === 'card' ? 'push' : presentation,
123
158
  stackAnimation: animation,
@@ -125,6 +160,10 @@ const SceneView = _ref2 => {
125
160
  statusBarAnimation: statusBarAnimation,
126
161
  statusBarHidden: statusBarHidden,
127
162
  statusBarStyle: statusBarStyle,
163
+ statusBarColor: statusBarColor,
164
+ statusBarTranslucent: statusBarTranslucent,
165
+ swipeDirection: gestureDirectionOverride,
166
+ transitionDuration: animationDuration,
128
167
  onWillDisappear: onWillDisappear,
129
168
  onAppear: onAppear,
130
169
  onDisappear: onDisappear,
@@ -181,16 +220,19 @@ function NativeStackViewInner(_ref3) {
181
220
  return /*#__PURE__*/React.createElement(ScreenStack, {
182
221
  style: styles.container
183
222
  }, state.routes.map((route, index) => {
184
- var _state$routes;
223
+ var _state$routes, _state$routes2;
185
224
 
186
225
  const descriptor = descriptors[route.key];
187
226
  const previousKey = (_state$routes = state.routes[index - 1]) === null || _state$routes === void 0 ? void 0 : _state$routes.key;
227
+ const nextKey = (_state$routes2 = state.routes[index + 1]) === null || _state$routes2 === void 0 ? void 0 : _state$routes2.key;
188
228
  const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
229
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
189
230
  return /*#__PURE__*/React.createElement(SceneView, {
190
231
  key: route.key,
191
232
  index: index,
192
233
  descriptor: descriptor,
193
234
  previousDescriptor: previousDescriptor,
235
+ nextDescriptor: nextDescriptor,
194
236
  onWillDisappear: () => {
195
237
  navigation.emit({
196
238
  type: 'transitionStart',
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.native.tsx"],"names":["getDefaultHeaderHeight","getHeaderTitle","HeaderHeightContext","HeaderShownContext","SafeAreaProviderCompat","NavigationContext","NavigationRouteContext","StackActions","useTheme","React","Platform","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","Screen","ScreenStack","warnOnce","DebugContainer","HeaderConfig","isAndroid","OS","MaybeNestedStack","options","route","presentation","headerHeight","children","colors","header","headerShown","contentStyle","isHeaderInModal","undefined","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","absoluteFill","SceneView","descriptor","previousDescriptor","index","onWillDisappear","onAppear","onDisappear","onDismissed","navigation","render","animation","animationTypeForReplace","customAnimationOnGesture","fullScreenGestureEnabled","gestureEnabled","orientation","statusBarAnimation","statusBarHidden","statusBarStyle","isHeaderInPush","insets","frame","isModal","isIPhone","isPad","isTVOS","isLandscape","width","height","topInset","top","isParentHeaderShown","useContext","parentHeaderHeight","defaultHeaderHeight","customHeaderHeight","setCustomHeaderHeight","useState","key","e","nativeEvent","layout","back","title","NativeStackViewInner","state","descriptors","nextDismissedKey","setNextDismissedKey","dismissedRouteName","routes","find","message","console","error","map","previousKey","emit","type","data","closing","target","event","dispatch","pop","dismissCount","source","NativeStackView","props","create","flex"],"mappings":";;AAAA,SACEA,sBADF,EAEEC,cAFF,EAGEC,mBAHF,EAIEC,kBAJF,EAKEC,sBALF,QAMO,4BANP;AAOA,SACEC,iBADF,EAEEC,sBAFF,EAKEC,YALF,EAOEC,QAPF,QAQO,0BARP;AASA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA2C,cAA3C;AACA,SACEC,gBADF,EAEEC,iBAFF,QAGO,gCAHP;AAKA,SACEC,MADF,EAEEC,WAFF,QAIO,sBAJP;AAKA,OAAOC,QAAP,MAAqB,WAArB;AAQA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,YAAP,MAAyB,gBAA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,CAAiBF,KAAK,CAACtB,WAAN,CAAkByB,YAAnC,CADe;AAElBC,UAAAA,MAAM,EAAEvF,KAAK,CAAC2D,GAFI;AAGlBuB,UAAAA,MAAM,EAAEhB,KAAK,CAACP;AAHI,SAApB;AAMAU,QAAAA,mBAAmB,CAACrE,KAAK,CAAC2D,GAAP,CAAnB;AACD;AAlCH,MADF;AAsCD,GA7CA,CADH,CADF;AAkDD;;AAED,eAAe,SAAS6B,eAAT,CAAyBC,KAAzB,EAAuC;AACpD,sBACE,oBAAC,sBAAD,qBACE,oBAAC,oBAAD,EAA0BA,KAA1B,CADF,CADF;AAKD;AAED,MAAMzE,MAAM,GAAG7B,UAAU,CAACuG,MAAX,CAAkB;AAC/BzE,EAAAA,SAAS,EAAE;AACT0E,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport type { ScreenProps } from 'react-native-screens';\nimport {\n Screen,\n ScreenStack,\n StackPresentationTypes,\n} from 'react-native-screens';\nimport warnOnce from 'warn-once';\n\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport DebugContainer from './DebugContainer';\nimport HeaderConfig from './HeaderConfig';\n\nconst isAndroid = Platform.OS === 'android';\n\nconst MaybeNestedStack = ({\n options,\n route,\n presentation,\n headerHeight,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n presentation: Exclude<StackPresentationTypes, 'push'> | 'card';\n headerHeight: number;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { header, headerShown = true, contentStyle } = options;\n\n const isHeaderInModal = isAndroid\n ? false\n : presentation !== 'card' && headerShown === true && header === undefined;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n presentation !== 'card' &&\n headerShownPreviousRef.current !== headerShown,\n `Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`\n );\n\n headerShownPreviousRef.current = headerShown;\n }, [headerShown, presentation, route.name]);\n\n const content = (\n <DebugContainer\n style={[\n styles.container,\n presentation !== 'transparentModal' &&\n presentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n >\n {children}\n </DebugContainer>\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled style={StyleSheet.absoluteFill}>\n <HeaderConfig\n {...options}\n route={route}\n headerHeight={headerHeight}\n canGoBack\n />\n {content}\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype SceneViewProps = {\n index: number;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n onWillDisappear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n};\n\nconst SceneView = ({\n descriptor,\n previousDescriptor,\n index,\n onWillDisappear,\n onAppear,\n onDisappear,\n onDismissed,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n const {\n animation,\n animationTypeForReplace = 'push',\n customAnimationOnGesture,\n fullScreenGestureEnabled,\n gestureEnabled,\n header,\n headerShown,\n orientation,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n } = options;\n\n let { presentation = 'card' } = options;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : presentation === 'card' && headerShown !== false;\n\n const insets = useSafeAreaInsets();\n const frame = useSafeAreaFrame();\n\n // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.\n const isModal = presentation === 'modal' || presentation === 'formSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone =\n Platform.OS === 'ios' && !(Platform.isPad && Platform.isTVOS);\n const isLandscape = frame.width > frame.height;\n\n const topInset = isModal || (isIPhone && isLandscape) ? 0 : insets.top;\n\n const isParentHeaderShown = React.useContext(HeaderShownContext);\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n\n const defaultHeaderHeight = getDefaultHeaderHeight(frame, isModal, topInset);\n\n const [customHeaderHeight, setCustomHeaderHeight] =\n React.useState(defaultHeaderHeight);\n\n const headerHeight = header ? customHeaderHeight : defaultHeaderHeight;\n\n return (\n <Screen\n key={route.key}\n enabled\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnGesture}\n fullScreenSwipeEnabled={fullScreenGestureEnabled}\n gestureEnabled={\n isAndroid\n ? // This prop enables handling of system back gestures on Android\n // Since we handle them in JS side, we disable this\n false\n : gestureEnabled\n }\n replaceAnimation={animationTypeForReplace}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n stackAnimation={animation}\n screenOrientation={orientation}\n statusBarAnimation={statusBarAnimation}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n onWillDisappear={onWillDisappear}\n onAppear={onAppear}\n onDisappear={onDisappear}\n onDismissed={onDismissed}\n isNativeStack\n >\n <NavigationContext.Provider value={navigation}>\n <NavigationRouteContext.Provider value={route}>\n <HeaderShownContext.Provider\n value={isParentHeaderShown || isHeaderInPush !== false}\n >\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false\n ? headerHeight\n : parentHeaderHeight ?? 0\n }\n >\n {header !== undefined && headerShown !== false ? (\n <View\n onLayout={(e) => {\n setCustomHeaderHeight(e.nativeEvent.layout.height);\n }}\n >\n {header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })}\n </View>\n ) : (\n <HeaderConfig\n {...options}\n route={route}\n headerShown={isHeaderInPush}\n headerHeight={headerHeight}\n canGoBack={index !== 0}\n />\n )}\n <MaybeNestedStack\n options={options}\n route={route}\n presentation={presentation}\n headerHeight={headerHeight}\n >\n {render()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </HeaderShownContext.Provider>\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({ state, navigation, descriptors }: Props) {\n const [nextDismissedKey, setNextDismissedKey] = React.useState<string | null>(\n null\n );\n\n const dismissedRouteName = nextDismissedKey\n ? state.routes.find((route) => route.key === nextDismissedKey)?.name\n : null;\n\n React.useEffect(() => {\n if (dismissedRouteName) {\n const message =\n `The screen '${dismissedRouteName}' was removed natively but didn't get removed from JS state. ` +\n `This can happen if the action was prevented in a 'beforeRemove' listener, which is not fully supported in native-stack.\\n\\n` +\n `Consider using 'gestureEnabled: false' to prevent back gesture and use a custom back button with 'headerLeft' option to override the native behavior.`;\n\n console.error(message);\n }\n }, [dismissedRouteName]);\n\n return (\n <ScreenStack style={styles.container}>\n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const previousKey = state.routes[index - 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n\n return (\n <SceneView\n key={route.key}\n index={index}\n descriptor={descriptor}\n previousDescriptor={previousDescriptor}\n onWillDisappear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n />\n );\n })}\n </ScreenStack>\n );\n}\n\nexport default function NativeStackView(props: Props) {\n return (\n <SafeAreaProviderCompat>\n <NativeStackViewInner {...props} />\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"sources":["NativeStackView.native.tsx"],"names":["getDefaultHeaderHeight","getHeaderTitle","HeaderHeightContext","HeaderShownContext","SafeAreaProviderCompat","NavigationContext","NavigationRouteContext","StackActions","useTheme","React","Platform","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","Screen","ScreenStack","warnOnce","DebugContainer","HeaderConfig","isAndroid","OS","MaybeNestedStack","options","route","presentation","headerHeight","children","colors","header","headerShown","contentStyle","isHeaderInModal","undefined","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","absoluteFill","SceneView","descriptor","previousDescriptor","nextDescriptor","index","onWillDisappear","onAppear","onDisappear","onDismissed","navigation","render","animationDuration","animationTypeForReplace","gestureEnabled","autoHideHomeIndicator","navigationBarColor","navigationBarHidden","orientation","statusBarAnimation","statusBarHidden","statusBarStyle","statusBarTranslucent","statusBarColor","animation","customAnimationOnGesture","fullScreenGestureEnabled","gestureDirection","nextGestureDirection","gestureDirectionOverride","isHeaderInPush","insets","frame","isModal","isIPhone","isPad","isTVOS","isLandscape","width","height","topInset","top","isParentHeaderShown","useContext","parentHeaderHeight","defaultHeaderHeight","customHeaderHeight","setCustomHeaderHeight","useState","key","e","nativeEvent","layout","back","title","NativeStackViewInner","state","descriptors","nextDismissedKey","setNextDismissedKey","dismissedRouteName","routes","find","message","console","error","map","previousKey","nextKey","emit","type","data","closing","target","event","dispatch","pop","dismiss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AX,CAAgB;AACdC,UAAAA,IAAI,EAAE,eADQ;AAEdC,UAAAA,IAAI,EAAE;AAAEC,YAAAA,OAAO,EAAE;AAAX,WAFQ;AAGdC,UAAAA,MAAM,EAAE7F,KAAK,CAACqE;AAHA,SAAhB;AAKD,OAnBH;AAoBE,MAAA,WAAW,EAAE,MAAM;AACjBvC,QAAAA,UAAU,CAAC2D,IAAX,CAAgB;AACdC,UAAAA,IAAI,EAAE,eADQ;AAEdC,UAAAA,IAAI,EAAE;AAAEC,YAAAA,OAAO,EAAE;AAAX,WAFQ;AAGdC,UAAAA,MAAM,EAAE7F,KAAK,CAACqE;AAHA,SAAhB;AAKD,OA1BH;AA2BE,MAAA,WAAW,EAAGyB,KAAD,IAAW;AACtBhE,QAAAA,UAAU,CAACiE,QAAX,CAAoB,EAClB,GAAGhH,YAAY,CAACiH,GAAb,CAAiBF,KAAK,CAACvB,WAAN,CAAkB0B,YAAnC,CADe;AAElBC,UAAAA,MAAM,EAAElG,KAAK,CAACqE,GAFI;AAGlBwB,UAAAA,MAAM,EAAEjB,KAAK,CAACP;AAHI,SAApB;AAMAU,QAAAA,mBAAmB,CAAC/E,KAAK,CAACqE,GAAP,CAAnB;AACD;AAnCH,MADF;AAuCD,GAhDA,CADH,CADF;AAqDD;;AAED,eAAe,SAAS8B,eAAT,CAAyBC,KAAzB,EAAuC;AACpD,sBACE,oBAAC,sBAAD,qBACE,oBAAC,oBAAD,EAA0BA,KAA1B,CADF,CADF;AAKD;AAED,MAAMpF,MAAM,GAAG7B,UAAU,CAACkH,MAAX,CAAkB;AAC/BpF,EAAAA,SAAS,EAAE;AACTqF,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getDefaultHeaderHeight,\n getHeaderTitle,\n HeaderHeightContext,\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport type { ScreenProps } from 'react-native-screens';\nimport {\n Screen,\n ScreenStack,\n StackPresentationTypes,\n} from 'react-native-screens';\nimport warnOnce from 'warn-once';\n\nimport type {\n NativeStackDescriptor,\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport DebugContainer from './DebugContainer';\nimport HeaderConfig from './HeaderConfig';\n\nconst isAndroid = Platform.OS === 'android';\n\nconst MaybeNestedStack = ({\n options,\n route,\n presentation,\n headerHeight,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n presentation: Exclude<StackPresentationTypes, 'push'> | 'card';\n headerHeight: number;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { header, headerShown = true, contentStyle } = options;\n\n const isHeaderInModal = isAndroid\n ? false\n : presentation !== 'card' && headerShown === true && header === undefined;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n presentation !== 'card' &&\n headerShownPreviousRef.current !== headerShown,\n `Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`\n );\n\n headerShownPreviousRef.current = headerShown;\n }, [headerShown, presentation, route.name]);\n\n const content = (\n <DebugContainer\n style={[\n styles.container,\n presentation !== 'transparentModal' &&\n presentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n >\n {children}\n </DebugContainer>\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled style={StyleSheet.absoluteFill}>\n <HeaderConfig\n {...options}\n route={route}\n headerHeight={headerHeight}\n canGoBack\n />\n {content}\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype SceneViewProps = {\n index: number;\n descriptor: NativeStackDescriptor;\n previousDescriptor?: NativeStackDescriptor;\n nextDescriptor?: NativeStackDescriptor;\n onWillDisappear: () => void;\n onAppear: () => void;\n onDisappear: () => void;\n onDismissed: ScreenProps['onDismissed'];\n};\n\nconst SceneView = ({\n descriptor,\n previousDescriptor,\n nextDescriptor,\n index,\n onWillDisappear,\n onAppear,\n onDisappear,\n onDismissed,\n}: SceneViewProps) => {\n const { route, navigation, options, render } = descriptor;\n const {\n animationDuration,\n animationTypeForReplace = 'push',\n gestureEnabled,\n header,\n headerShown,\n autoHideHomeIndicator,\n navigationBarColor,\n navigationBarHidden,\n orientation,\n statusBarAnimation,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n statusBarColor,\n } = options;\n\n let {\n animation,\n customAnimationOnGesture,\n fullScreenGestureEnabled,\n presentation = 'card',\n gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',\n } = options;\n\n if (gestureDirection === 'vertical' && Platform.OS === 'ios') {\n // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `customAnimationOnGesture` needs to be set to `true` so the `animation` set by user can be used,\n // otherwise `simple_push` will be used.\n // Also, the default animation for this direction seems to be `slide_from_bottom`.\n if (fullScreenGestureEnabled === undefined) {\n fullScreenGestureEnabled = true;\n }\n if (customAnimationOnGesture === undefined) {\n customAnimationOnGesture = true;\n }\n if (animation === undefined) {\n animation = 'slide_from_bottom';\n }\n }\n\n // workaround for rn-screens where gestureDirection has to be set on both\n // current and previous screen - software-mansion/react-native-screens/pull/1509\n const nextGestureDirection = nextDescriptor?.options.gestureDirection;\n const gestureDirectionOverride =\n nextGestureDirection != null ? nextGestureDirection : gestureDirection;\n\n if (index === 0) {\n // first screen should always be treated as `card`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `card`\n presentation = 'card';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : presentation === 'card' && headerShown !== false;\n\n const insets = useSafeAreaInsets();\n const frame = useSafeAreaFrame();\n\n // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.\n const isModal = presentation === 'modal' || presentation === 'formSheet';\n\n // Modals are fullscreen in landscape only on iPhone\n const isIPhone =\n Platform.OS === 'ios' && !(Platform.isPad || Platform.isTVOS);\n const isLandscape = frame.width > frame.height;\n\n const topInset = isModal || (isIPhone && isLandscape) ? 0 : insets.top;\n\n const isParentHeaderShown = React.useContext(HeaderShownContext);\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n\n const defaultHeaderHeight = getDefaultHeaderHeight(frame, isModal, topInset);\n\n const [customHeaderHeight, setCustomHeaderHeight] =\n React.useState(defaultHeaderHeight);\n\n const headerHeight = header ? customHeaderHeight : defaultHeaderHeight;\n\n return (\n <Screen\n key={route.key}\n enabled\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnGesture}\n fullScreenSwipeEnabled={fullScreenGestureEnabled}\n gestureEnabled={\n isAndroid\n ? // This prop enables handling of system back gestures on Android\n // Since we handle them in JS side, we disable this\n false\n : gestureEnabled\n }\n homeIndicatorHidden={autoHideHomeIndicator}\n navigationBarColor={navigationBarColor}\n navigationBarHidden={navigationBarHidden}\n replaceAnimation={animationTypeForReplace}\n stackPresentation={presentation === 'card' ? 'push' : presentation}\n stackAnimation={animation}\n screenOrientation={orientation}\n statusBarAnimation={statusBarAnimation}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarColor={statusBarColor}\n statusBarTranslucent={statusBarTranslucent}\n swipeDirection={gestureDirectionOverride}\n transitionDuration={animationDuration}\n onWillDisappear={onWillDisappear}\n onAppear={onAppear}\n onDisappear={onDisappear}\n onDismissed={onDismissed}\n isNativeStack\n >\n <NavigationContext.Provider value={navigation}>\n <NavigationRouteContext.Provider value={route}>\n <HeaderShownContext.Provider\n value={isParentHeaderShown || isHeaderInPush !== false}\n >\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false\n ? headerHeight\n : parentHeaderHeight ?? 0\n }\n >\n {header !== undefined && headerShown !== false ? (\n <View\n onLayout={(e) => {\n setCustomHeaderHeight(e.nativeEvent.layout.height);\n }}\n >\n {header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })}\n </View>\n ) : (\n <HeaderConfig\n {...options}\n route={route}\n headerShown={isHeaderInPush}\n headerHeight={headerHeight}\n canGoBack={index !== 0}\n />\n )}\n <MaybeNestedStack\n options={options}\n route={route}\n presentation={presentation}\n headerHeight={headerHeight}\n >\n {render()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </HeaderShownContext.Provider>\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({ state, navigation, descriptors }: Props) {\n const [nextDismissedKey, setNextDismissedKey] = React.useState<string | null>(\n null\n );\n\n const dismissedRouteName = nextDismissedKey\n ? state.routes.find((route) => route.key === nextDismissedKey)?.name\n : null;\n\n React.useEffect(() => {\n if (dismissedRouteName) {\n const message =\n `The screen '${dismissedRouteName}' was removed natively but didn't get removed from JS state. ` +\n `This can happen if the action was prevented in a 'beforeRemove' listener, which is not fully supported in native-stack.\\n\\n` +\n `Consider using 'gestureEnabled: false' to prevent back gesture and use a custom back button with 'headerLeft' option to override the native behavior.`;\n\n console.error(message);\n }\n }, [dismissedRouteName]);\n\n return (\n <ScreenStack style={styles.container}>\n {state.routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const previousKey = state.routes[index - 1]?.key;\n const nextKey = state.routes[index + 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;\n\n return (\n <SceneView\n key={route.key}\n index={index}\n descriptor={descriptor}\n previousDescriptor={previousDescriptor}\n nextDescriptor={nextDescriptor}\n onWillDisappear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: true },\n target: route.key,\n });\n }}\n onAppear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: false },\n target: route.key,\n });\n }}\n onDisappear={() => {\n navigation.emit({\n type: 'transitionEnd',\n data: { closing: true },\n target: route.key,\n });\n }}\n onDismissed={(event) => {\n navigation.dispatch({\n ...StackActions.pop(event.nativeEvent.dismissCount),\n source: route.key,\n target: state.key,\n });\n\n setNextDismissedKey(route.key);\n }}\n />\n );\n })}\n </ScreenStack>\n );\n}\n\nexport default function NativeStackView(props: Props) {\n return (\n <SafeAreaProviderCompat>\n <NativeStackViewInner {...props} />\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
@@ -280,6 +280,24 @@ export declare type NativeStackNavigationOptions = {
280
280
  * @platform ios
281
281
  */
282
282
  headerBackButtonMenuEnabled?: boolean;
283
+ /**
284
+ * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
285
+ *
286
+ * @platform ios
287
+ */
288
+ autoHideHomeIndicator?: boolean;
289
+ /**
290
+ * Sets the navigation bar color. Defaults to initial navigation bar color.
291
+ *
292
+ * @platform android
293
+ */
294
+ navigationBarColor?: string;
295
+ /**
296
+ * Sets the visibility of the navigation bar. Defaults to `false`.
297
+ *
298
+ * @platform android
299
+ */
300
+ navigationBarHidden?: boolean;
283
301
  /**
284
302
  * Sets the status bar animation (similar to the `StatusBar` component).
285
303
  * Requires setting `View controller-based status bar appearance -> YES` (or removing the config) in your `Info.plist` file.
@@ -289,6 +307,12 @@ export declare type NativeStackNavigationOptions = {
289
307
  * @platform ios
290
308
  */
291
309
  statusBarAnimation?: ScreenProps['statusBarAnimation'];
310
+ /**
311
+ * Sets the status bar color (similar to the `StatusBar` component). Defaults to initial status bar color.
312
+ *
313
+ * @platform android
314
+ */
315
+ statusBarColor?: string;
292
316
  /**
293
317
  * Whether the status bar should be hidden on this screen.
294
318
  * Requires setting `View controller-based status bar appearance -> YES` in your Info.plist file.
@@ -307,6 +331,23 @@ export declare type NativeStackNavigationOptions = {
307
331
  * @platform ios
308
332
  */
309
333
  statusBarStyle?: ScreenProps['statusBarStyle'];
334
+ /**
335
+ * Sets the translucency of the status bar. Defaults to `false`.
336
+ *
337
+ * @platform android
338
+ */
339
+ statusBarTranslucent?: boolean;
340
+ /**
341
+ * Sets the direction in which you should swipe to dismiss the screen.
342
+ * When using `vertical` option, options `fullScreenGestureEnabled: true`, `customAnimationOnGesture: true` and `animation: 'slide_from_bottom'` are set by default.
343
+ *
344
+ * Supported values:
345
+ * - `vertical` – dismiss screen vertically
346
+ * - `horizontal` – dismiss screen horizontally (default)
347
+ *
348
+ * @platform ios
349
+ */
350
+ gestureDirection?: ScreenProps['swipeDirection'];
310
351
  /**
311
352
  * Style object for the scene content.
312
353
  */
@@ -363,6 +404,13 @@ export declare type NativeStackNavigationOptions = {
363
404
  * Only supported on iOS and Android.
364
405
  */
365
406
  animation?: ScreenProps['stackAnimation'];
407
+ /**
408
+ * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.
409
+ * The duration of `default` and `flip` transitions isn't customizable.
410
+ *
411
+ * @platform ios
412
+ */
413
+ animationDuration?: number;
366
414
  /**
367
415
  * How should the screen be presented.
368
416
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/native-stack",
3
3
  "description": "Native stack navigator using react-native-screens",
4
- "version": "6.6.2",
4
+ "version": "6.7.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -41,19 +41,19 @@
41
41
  "clean": "del lib"
42
42
  },
43
43
  "dependencies": {
44
- "@react-navigation/elements": "^1.3.3",
44
+ "@react-navigation/elements": "^1.3.4",
45
45
  "warn-once": "^0.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@react-navigation/native": "^6.0.10",
48
+ "@react-navigation/native": "^6.0.11",
49
49
  "@testing-library/react-native": "^7.2.0",
50
- "@types/react": "^17.0.9",
51
- "@types/react-native": "~0.64.9",
52
- "react": "17.0.1",
53
- "react-native": "~0.64.3",
50
+ "@types/react": "^17.0.47",
51
+ "@types/react-native": "~0.68.1",
52
+ "react": "17.0.2",
53
+ "react-native": "~0.68.2",
54
54
  "react-native-builder-bob": "^0.18.1",
55
- "react-native-screens": "^3.3.0",
56
- "typescript": "^4.3.2"
55
+ "react-native-screens": "^3.11.1",
56
+ "typescript": "^4.7.4"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@react-navigation/native": "^6.0.0",
@@ -75,6 +75,5 @@
75
75
  }
76
76
  ]
77
77
  ]
78
- },
79
- "gitHead": "4c2b69f2e339e21714a841f4e8e9e3d5c7120269"
78
+ }
80
79
  }
package/src/types.tsx CHANGED
@@ -324,6 +324,24 @@ export type NativeStackNavigationOptions = {
324
324
  * @platform ios
325
325
  */
326
326
  headerBackButtonMenuEnabled?: boolean;
327
+ /**
328
+ * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
329
+ *
330
+ * @platform ios
331
+ */
332
+ autoHideHomeIndicator?: boolean;
333
+ /**
334
+ * Sets the navigation bar color. Defaults to initial navigation bar color.
335
+ *
336
+ * @platform android
337
+ */
338
+ navigationBarColor?: string;
339
+ /**
340
+ * Sets the visibility of the navigation bar. Defaults to `false`.
341
+ *
342
+ * @platform android
343
+ */
344
+ navigationBarHidden?: boolean;
327
345
  /**
328
346
  * Sets the status bar animation (similar to the `StatusBar` component).
329
347
  * Requires setting `View controller-based status bar appearance -> YES` (or removing the config) in your `Info.plist` file.
@@ -333,6 +351,12 @@ export type NativeStackNavigationOptions = {
333
351
  * @platform ios
334
352
  */
335
353
  statusBarAnimation?: ScreenProps['statusBarAnimation'];
354
+ /**
355
+ * Sets the status bar color (similar to the `StatusBar` component). Defaults to initial status bar color.
356
+ *
357
+ * @platform android
358
+ */
359
+ statusBarColor?: string;
336
360
  /**
337
361
  * Whether the status bar should be hidden on this screen.
338
362
  * Requires setting `View controller-based status bar appearance -> YES` in your Info.plist file.
@@ -351,6 +375,23 @@ export type NativeStackNavigationOptions = {
351
375
  * @platform ios
352
376
  */
353
377
  statusBarStyle?: ScreenProps['statusBarStyle'];
378
+ /**
379
+ * Sets the translucency of the status bar. Defaults to `false`.
380
+ *
381
+ * @platform android
382
+ */
383
+ statusBarTranslucent?: boolean;
384
+ /**
385
+ * Sets the direction in which you should swipe to dismiss the screen.
386
+ * When using `vertical` option, options `fullScreenGestureEnabled: true`, `customAnimationOnGesture: true` and `animation: 'slide_from_bottom'` are set by default.
387
+ *
388
+ * Supported values:
389
+ * - `vertical` – dismiss screen vertically
390
+ * - `horizontal` – dismiss screen horizontally (default)
391
+ *
392
+ * @platform ios
393
+ */
394
+ gestureDirection?: ScreenProps['swipeDirection'];
354
395
  /**
355
396
  * Style object for the scene content.
356
397
  */
@@ -407,6 +448,13 @@ export type NativeStackNavigationOptions = {
407
448
  * Only supported on iOS and Android.
408
449
  */
409
450
  animation?: ScreenProps['stackAnimation'];
451
+ /**
452
+ * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.
453
+ * The duration of `default` and `flip` transitions isn't customizable.
454
+ *
455
+ * @platform ios
456
+ */
457
+ animationDuration?: number;
410
458
  /**
411
459
  * How should the screen be presented.
412
460
  *
@@ -111,6 +111,7 @@ type SceneViewProps = {
111
111
  index: number;
112
112
  descriptor: NativeStackDescriptor;
113
113
  previousDescriptor?: NativeStackDescriptor;
114
+ nextDescriptor?: NativeStackDescriptor;
114
115
  onWillDisappear: () => void;
115
116
  onAppear: () => void;
116
117
  onDisappear: () => void;
@@ -120,6 +121,7 @@ type SceneViewProps = {
120
121
  const SceneView = ({
121
122
  descriptor,
122
123
  previousDescriptor,
124
+ nextDescriptor,
123
125
  index,
124
126
  onWillDisappear,
125
127
  onAppear,
@@ -128,20 +130,52 @@ const SceneView = ({
128
130
  }: SceneViewProps) => {
129
131
  const { route, navigation, options, render } = descriptor;
130
132
  const {
131
- animation,
133
+ animationDuration,
132
134
  animationTypeForReplace = 'push',
133
- customAnimationOnGesture,
134
- fullScreenGestureEnabled,
135
135
  gestureEnabled,
136
136
  header,
137
137
  headerShown,
138
+ autoHideHomeIndicator,
139
+ navigationBarColor,
140
+ navigationBarHidden,
138
141
  orientation,
139
142
  statusBarAnimation,
140
143
  statusBarHidden,
141
144
  statusBarStyle,
145
+ statusBarTranslucent,
146
+ statusBarColor,
142
147
  } = options;
143
148
 
144
- let { presentation = 'card' } = options;
149
+ let {
150
+ animation,
151
+ customAnimationOnGesture,
152
+ fullScreenGestureEnabled,
153
+ presentation = 'card',
154
+ gestureDirection = presentation === 'card' ? 'horizontal' : 'vertical',
155
+ } = options;
156
+
157
+ if (gestureDirection === 'vertical' && Platform.OS === 'ios') {
158
+ // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
159
+ // so the screen can be dismissed from any point on screen.
160
+ // `customAnimationOnGesture` needs to be set to `true` so the `animation` set by user can be used,
161
+ // otherwise `simple_push` will be used.
162
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
163
+ if (fullScreenGestureEnabled === undefined) {
164
+ fullScreenGestureEnabled = true;
165
+ }
166
+ if (customAnimationOnGesture === undefined) {
167
+ customAnimationOnGesture = true;
168
+ }
169
+ if (animation === undefined) {
170
+ animation = 'slide_from_bottom';
171
+ }
172
+ }
173
+
174
+ // workaround for rn-screens where gestureDirection has to be set on both
175
+ // current and previous screen - software-mansion/react-native-screens/pull/1509
176
+ const nextGestureDirection = nextDescriptor?.options.gestureDirection;
177
+ const gestureDirectionOverride =
178
+ nextGestureDirection != null ? nextGestureDirection : gestureDirection;
145
179
 
146
180
  if (index === 0) {
147
181
  // first screen should always be treated as `card`, it resolves problems with no header animation
@@ -161,7 +195,7 @@ const SceneView = ({
161
195
 
162
196
  // Modals are fullscreen in landscape only on iPhone
163
197
  const isIPhone =
164
- Platform.OS === 'ios' && !(Platform.isPad && Platform.isTVOS);
198
+ Platform.OS === 'ios' && !(Platform.isPad || Platform.isTVOS);
165
199
  const isLandscape = frame.width > frame.height;
166
200
 
167
201
  const topInset = isModal || (isIPhone && isLandscape) ? 0 : insets.top;
@@ -190,6 +224,9 @@ const SceneView = ({
190
224
  false
191
225
  : gestureEnabled
192
226
  }
227
+ homeIndicatorHidden={autoHideHomeIndicator}
228
+ navigationBarColor={navigationBarColor}
229
+ navigationBarHidden={navigationBarHidden}
193
230
  replaceAnimation={animationTypeForReplace}
194
231
  stackPresentation={presentation === 'card' ? 'push' : presentation}
195
232
  stackAnimation={animation}
@@ -197,6 +234,10 @@ const SceneView = ({
197
234
  statusBarAnimation={statusBarAnimation}
198
235
  statusBarHidden={statusBarHidden}
199
236
  statusBarStyle={statusBarStyle}
237
+ statusBarColor={statusBarColor}
238
+ statusBarTranslucent={statusBarTranslucent}
239
+ swipeDirection={gestureDirectionOverride}
240
+ transitionDuration={animationDuration}
200
241
  onWillDisappear={onWillDisappear}
201
242
  onAppear={onAppear}
202
243
  onDisappear={onDisappear}
@@ -291,9 +332,11 @@ function NativeStackViewInner({ state, navigation, descriptors }: Props) {
291
332
  {state.routes.map((route, index) => {
292
333
  const descriptor = descriptors[route.key];
293
334
  const previousKey = state.routes[index - 1]?.key;
335
+ const nextKey = state.routes[index + 1]?.key;
294
336
  const previousDescriptor = previousKey
295
337
  ? descriptors[previousKey]
296
338
  : undefined;
339
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
297
340
 
298
341
  return (
299
342
  <SceneView
@@ -301,6 +344,7 @@ function NativeStackViewInner({ state, navigation, descriptors }: Props) {
301
344
  index={index}
302
345
  descriptor={descriptor}
303
346
  previousDescriptor={previousDescriptor}
347
+ nextDescriptor={nextDescriptor}
304
348
  onWillDisappear={() => {
305
349
  navigation.emit({
306
350
  type: 'transitionStart',
@@ -42,7 +42,7 @@ export default function NativeStackView({ state, descriptors }: Props) {
42
42
  const previousDescriptor = previousKey
43
43
  ? descriptors[previousKey]
44
44
  : undefined;
45
- const nexDescriptor = nextKey ? descriptors[nextKey] : undefined;
45
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
46
46
  const { options, navigation, render } = descriptors[route.key];
47
47
 
48
48
  const {
@@ -64,7 +64,7 @@ export default function NativeStackView({ state, descriptors }: Props) {
64
64
  contentStyle,
65
65
  } = options;
66
66
 
67
- const nextPresentation = nexDescriptor?.options.presentation;
67
+ const nextPresentation = nextDescriptor?.options.presentation;
68
68
 
69
69
  return (
70
70
  <Screen