react-native-screens 3.10.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -7
  3. package/android/build.gradle +1 -0
  4. package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +28 -11
  5. package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +1 -1
  6. package/android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt +64 -33
  7. package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +9 -31
  8. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +0 -30
  9. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +12 -5
  10. package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +10 -0
  11. package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +72 -11
  12. package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +18 -1
  13. package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +7 -2
  14. package/android/src/main/java/com/swmansion/rnscreens/SearchViewFormatter.kt +29 -2
  15. package/android/src/main/res/anim/rns_default_enter_in.xml +18 -0
  16. package/android/src/main/res/anim/rns_default_enter_out.xml +19 -0
  17. package/android/src/main/res/anim/rns_default_exit_in.xml +17 -0
  18. package/android/src/main/res/anim/rns_default_exit_out.xml +18 -0
  19. package/android/src/main/res/anim/rns_fade_in.xml +7 -0
  20. package/android/src/main/res/anim/rns_fade_out.xml +7 -0
  21. package/android/src/main/res/anim/rns_no_animation_20.xml +6 -0
  22. package/createNativeStackNavigator/README.md +12 -0
  23. package/ios/RNSScreen.h +10 -0
  24. package/ios/RNSScreen.m +34 -0
  25. package/ios/RNSScreenContainer.m +5 -0
  26. package/ios/RNSScreenStack.m +22 -7
  27. package/ios/RNSScreenStackAnimator.m +45 -14
  28. package/ios/RNSScreenStackHeaderConfig.m +4 -1
  29. package/ios/RNSScreenWindowTraits.h +1 -0
  30. package/ios/RNSScreenWindowTraits.m +20 -0
  31. package/ios/UIViewController+RNScreens.m +10 -0
  32. package/lib/commonjs/native-stack/views/NativeStackView.js +33 -4
  33. package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
  34. package/lib/module/native-stack/views/NativeStackView.js +33 -4
  35. package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
  36. package/lib/typescript/native-stack/types.d.ts +34 -0
  37. package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
  38. package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
  39. package/lib/typescript/types.d.ts +60 -5
  40. package/native-stack/README.md +39 -3
  41. package/package.json +1 -1
  42. package/reanimated/package.json +6 -0
  43. package/src/native-stack/types.tsx +34 -0
  44. package/src/native-stack/views/NativeStackView.tsx +33 -4
  45. package/src/types.tsx +60 -5
@@ -116,24 +116,48 @@ const RouteView = ({
116
116
  render: renderScene
117
117
  } = descriptors[route.key];
118
118
  const {
119
- customAnimationOnSwipe,
120
- fullScreenSwipeEnabled,
121
119
  gestureEnabled,
122
120
  headerShown,
121
+ homeIndicatorHidden,
123
122
  nativeBackButtonDismissalEnabled = false,
123
+ navigationBarColor,
124
+ navigationBarHidden,
124
125
  replaceAnimation = 'pop',
125
126
  screenOrientation,
126
- stackAnimation,
127
127
  statusBarAnimation,
128
128
  statusBarColor,
129
129
  statusBarHidden,
130
130
  statusBarStyle,
131
- statusBarTranslucent
131
+ statusBarTranslucent,
132
+ swipeDirection = 'horizontal',
133
+ transitionDuration
132
134
  } = options;
133
135
  let {
136
+ customAnimationOnSwipe,
137
+ fullScreenSwipeEnabled,
138
+ stackAnimation,
134
139
  stackPresentation = 'push'
135
140
  } = options;
136
141
 
142
+ if (swipeDirection === 'vertical') {
143
+ // for `vertical` direction to work, we need to set `fullScreenSwipeEnabled` to `true`
144
+ // so the screen can be dismissed from any point on screen.
145
+ // `customAnimationOnSwipe` needs to be set to `true` so the `stackAnimation` set by user can be used,
146
+ // otherwise `simple_push` will be used.
147
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
148
+ if (fullScreenSwipeEnabled === undefined) {
149
+ fullScreenSwipeEnabled = true;
150
+ }
151
+
152
+ if (customAnimationOnSwipe === undefined) {
153
+ customAnimationOnSwipe = true;
154
+ }
155
+
156
+ if (stackAnimation === undefined) {
157
+ stackAnimation = 'slide_from_bottom';
158
+ }
159
+ }
160
+
137
161
  if (index === 0) {
138
162
  // first screen should always be treated as `push`, it resolves problems with no header animation
139
163
  // for navigator with first screen as `modal` and the next as `push`
@@ -153,8 +177,11 @@ const RouteView = ({
153
177
  style: _reactNative.StyleSheet.absoluteFill,
154
178
  customAnimationOnSwipe: customAnimationOnSwipe,
155
179
  fullScreenSwipeEnabled: fullScreenSwipeEnabled,
180
+ homeIndicatorHidden: homeIndicatorHidden,
156
181
  gestureEnabled: isAndroid ? false : gestureEnabled,
157
182
  nativeBackButtonDismissalEnabled: nativeBackButtonDismissalEnabled,
183
+ navigationBarColor: navigationBarColor,
184
+ navigationBarHidden: navigationBarHidden,
158
185
  replaceAnimation: replaceAnimation,
159
186
  screenOrientation: screenOrientation,
160
187
  stackAnimation: stackAnimation,
@@ -164,6 +191,8 @@ const RouteView = ({
164
191
  statusBarHidden: statusBarHidden,
165
192
  statusBarStyle: statusBarStyle,
166
193
  statusBarTranslucent: statusBarTranslucent,
194
+ swipeDirection: swipeDirection,
195
+ transitionDuration: transitionDuration,
167
196
  onHeaderBackButtonClicked: () => {
168
197
  navigation.dispatch({ ..._native.StackActions.pop(),
169
198
  source: route.key,
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.tsx"],"names":["isAndroid","Platform","OS","Container","View","__DEV__","DebugContainer","props","stackPresentation","rest","MaybeNestedStack","options","route","children","colors","headerShown","contentStyle","Screen","React","useContext","ScreenContext","isHeaderInModal","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","topInset","top","dimensions","headerHeight","StyleSheet","absoluteFill","RouteView","descriptors","index","navigation","stateKey","render","renderScene","key","customAnimationOnSwipe","fullScreenSwipeEnabled","gestureEnabled","nativeBackButtonDismissalEnabled","replaceAnimation","screenOrientation","stackAnimation","statusBarAnimation","statusBarColor","statusBarHidden","statusBarStyle","statusBarTranslucent","isHeaderInPush","parentHeaderHeight","HeaderHeightContext","dispatch","StackActions","pop","source","target","emit","type","data","closing","e","dismissCount","nativeEvent","NativeStackViewInner","state","routes","map","NativeStackView","create","flex"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AASA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAGC,sBAASC,EAAT,KAAgB,SAAlC;AAEA,IAAIC,SAAS,GAAGC,iBAAhB;;AAEA,IAAIC,OAAJ,EAAa;AACX,QAAMC,cAAc,GAClBC,KADqB,IAElB;AACH,UAAM;AAAEC,MAAAA,iBAAF;AAAqB,SAAGC;AAAxB,QAAiCF,KAAvC;;AACA,QAAIN,sBAASC,EAAT,KAAgB,KAAhB,IAAyBM,iBAAiB,KAAK,MAAnD,EAA2D;AACzD,0BACE,oBAAC,qBAAD,qBACE,oBAAC,iBAAD,EAAUC,IAAV,CADF,CADF;AAKD;;AACD,wBAAO,oBAAC,iBAAD,EAAUA,IAAV,CAAP;AACD,GAZD,CADW,CAcX;;;AACAN,EAAAA,SAAS,GAAGG,cAAZ;AACD;;AAED,MAAMI,gBAAgB,GAAG,CAAC;AACxBC,EAAAA,OADwB;AAExBC,EAAAA,KAFwB;AAGxBJ,EAAAA,iBAHwB;AAIxBK,EAAAA;AAJwB,CAAD,KAUnB;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AACA,QAAM;AAAEC,IAAAA,WAAW,GAAG,IAAhB;AAAsBC,IAAAA;AAAtB,MAAuCL,OAA7C;AAEA,QAAMM,MAAM,GAAGC,KAAK,CAACC,UAAN,CAAiBC,i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,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, StyleSheet, View, ViewProps } from 'react-native';\n// @ts-ignore Getting private component\nimport AppContainer from 'react-native/Libraries/ReactNative/AppContainer';\nimport warnOnce from 'warn-once';\nimport {\n ScreenStack,\n StackPresentationTypes,\n ScreenContext,\n} from 'react-native-screens';\nimport {\n ParamListBase,\n StackActions,\n StackNavigationState,\n useTheme,\n Route,\n NavigationState,\n PartialState,\n} from '@react-navigation/native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport HeaderConfig from './HeaderConfig';\nimport SafeAreaProviderCompat from '../utils/SafeAreaProviderCompat';\nimport getDefaultHeaderHeight from '../utils/getDefaultHeaderHeight';\nimport HeaderHeightContext from '../utils/HeaderHeightContext';\n\nconst isAndroid = Platform.OS === 'android';\n\nlet Container = View;\n\nif (__DEV__) {\n const DebugContainer = (\n props: ViewProps & { stackPresentation: StackPresentationTypes }\n ) => {\n const { stackPresentation, ...rest } = props;\n if (Platform.OS === 'ios' && stackPresentation !== 'push') {\n return (\n <AppContainer>\n <View {...rest} />\n </AppContainer>\n );\n }\n return <View {...rest} />;\n };\n // @ts-ignore Wrong props\n Container = DebugContainer;\n}\n\nconst MaybeNestedStack = ({\n options,\n route,\n stackPresentation,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { headerShown = true, contentStyle } = options;\n\n const Screen = React.useContext(ScreenContext);\n\n const isHeaderInModal = isAndroid\n ? false\n : stackPresentation !== 'push' && headerShown === true;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n stackPresentation !== 'push' &&\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, stackPresentation, route.name]);\n\n const content = (\n <Container\n style={[\n styles.container,\n stackPresentation !== 'transparentModal' &&\n stackPresentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n // @ts-ignore Wrong props passed to View\n stackPresentation={stackPresentation}>\n {children}\n </Container>\n );\n\n const topInset = useSafeAreaInsets().top;\n const dimensions = useSafeAreaFrame();\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled isNativeStack style={StyleSheet.absoluteFill}>\n <HeaderHeightContext.Provider value={headerHeight}>\n <HeaderConfig {...options} route={route} />\n {content}\n </HeaderHeightContext.Provider>\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype NavigationRoute<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList\n> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {\n state?: NavigationState | PartialState<NavigationState>;\n};\n\nconst RouteView = ({\n descriptors,\n route,\n index,\n navigation,\n stateKey,\n}: {\n descriptors: NativeStackDescriptorMap;\n route: NavigationRoute<ParamListBase, string>;\n index: number;\n navigation: NativeStackNavigationHelpers;\n stateKey: string;\n}) => {\n const { options, render: renderScene } = descriptors[route.key];\n const {\n customAnimationOnSwipe,\n fullScreenSwipeEnabled,\n gestureEnabled,\n headerShown,\n nativeBackButtonDismissalEnabled = false,\n replaceAnimation = 'pop',\n screenOrientation,\n stackAnimation,\n statusBarAnimation,\n statusBarColor,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n } = options;\n\n let { stackPresentation = 'push' } = options;\n\n if (index === 0) {\n // first screen should always be treated as `push`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `push`\n stackPresentation = 'push';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : stackPresentation === 'push' && headerShown !== false;\n\n const dimensions = useSafeAreaFrame();\n const topInset = useSafeAreaInsets().top;\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n const Screen = React.useContext(ScreenContext);\n\n return (\n <Screen\n key={route.key}\n enabled\n isNativeStack\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnSwipe}\n fullScreenSwipeEnabled={fullScreenSwipeEnabled}\n gestureEnabled={isAndroid ? false : gestureEnabled}\n nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}\n replaceAnimation={replaceAnimation}\n screenOrientation={screenOrientation}\n stackAnimation={stackAnimation}\n stackPresentation={stackPresentation}\n statusBarAnimation={statusBarAnimation}\n statusBarColor={statusBarColor}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarTranslucent={statusBarTranslucent}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: stateKey,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\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: 'appear',\n target: route.key,\n });\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={(e) => {\n navigation.emit({\n type: 'dismiss',\n target: route.key,\n });\n\n const dismissCount =\n e.nativeEvent.dismissCount > 0 ? e.nativeEvent.dismissCount : 1;\n\n navigation.dispatch({\n ...StackActions.pop(dismissCount),\n source: route.key,\n target: stateKey,\n });\n }}>\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false ? headerHeight : parentHeaderHeight ?? 0\n }>\n <HeaderConfig {...options} route={route} headerShown={isHeaderInPush} />\n <MaybeNestedStack\n options={options}\n route={route}\n stackPresentation={stackPresentation}>\n {renderScene()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({\n state,\n navigation,\n descriptors,\n}: Props): JSX.Element {\n const { key, routes } = state;\n\n return (\n <ScreenStack style={styles.container}>\n {routes.map((route, index) => (\n <RouteView\n key={route.key}\n descriptors={descriptors}\n route={route}\n index={index}\n navigation={navigation}\n stateKey={key}\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.tsx"],"names":["isAndroid","Platform","OS","Container","View","__DEV__","DebugContainer","props","stackPresentation","rest","MaybeNestedStack","options","route","children","colors","headerShown","contentStyle","Screen","React","useContext","ScreenContext","isHeaderInModal","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","topInset","top","dimensions","headerHeight","StyleSheet","absoluteFill","RouteView","descriptors","index","navigation","stateKey","render","renderScene","key","gestureEnabled","homeIndicatorHidden","nativeBackButtonDismissalEnabled","navigationBarColor","navigationBarHidden","replaceAnimation","screenOrientation","statusBarAnimation","statusBarColor","statusBarHidden","statusBarStyle","statusBarTranslucent","swipeDirection","transitionDuration","customAnimationOnSwipe","fullScreenSwipeEnabled","stackAnimation","undefined","isHeaderInPush","parentHeaderHeight","HeaderHeightContext","dispatch","StackActions","pop","source","target","emit","type","data","closing","e","dismissCount","nativeEvent","NativeStackViewInner","state","routes","map","NativeStackView","create","flex"],"mappings":";;;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JT;AAKE,IAAA,UAAU,EAAEC,UALd;AAME,IAAA,QAAQ,EAAEI;AANZ,IADD,CADH,CADF;AAcD;;AAEc,SAASsC,eAAT,CAAyB5E,KAAzB,EAAuC;AACpD,sBACE,oBAAC,+BAAD,qBACE,oBAAC,oBAAD,EAA0BA,KAA1B,CADF,CADF;AAKD;;AAED,MAAMqB,MAAM,GAAGQ,wBAAWgD,MAAX,CAAkB;AAC/BvD,EAAAA,SAAS,EAAE;AACTwD,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, StyleSheet, View, ViewProps } from 'react-native';\n// @ts-ignore Getting private component\nimport AppContainer from 'react-native/Libraries/ReactNative/AppContainer';\nimport warnOnce from 'warn-once';\nimport {\n ScreenStack,\n StackPresentationTypes,\n ScreenContext,\n} from 'react-native-screens';\nimport {\n ParamListBase,\n StackActions,\n StackNavigationState,\n useTheme,\n Route,\n NavigationState,\n PartialState,\n} from '@react-navigation/native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport HeaderConfig from './HeaderConfig';\nimport SafeAreaProviderCompat from '../utils/SafeAreaProviderCompat';\nimport getDefaultHeaderHeight from '../utils/getDefaultHeaderHeight';\nimport HeaderHeightContext from '../utils/HeaderHeightContext';\n\nconst isAndroid = Platform.OS === 'android';\n\nlet Container = View;\n\nif (__DEV__) {\n const DebugContainer = (\n props: ViewProps & { stackPresentation: StackPresentationTypes }\n ) => {\n const { stackPresentation, ...rest } = props;\n if (Platform.OS === 'ios' && stackPresentation !== 'push') {\n return (\n <AppContainer>\n <View {...rest} />\n </AppContainer>\n );\n }\n return <View {...rest} />;\n };\n // @ts-ignore Wrong props\n Container = DebugContainer;\n}\n\nconst MaybeNestedStack = ({\n options,\n route,\n stackPresentation,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { headerShown = true, contentStyle } = options;\n\n const Screen = React.useContext(ScreenContext);\n\n const isHeaderInModal = isAndroid\n ? false\n : stackPresentation !== 'push' && headerShown === true;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n stackPresentation !== 'push' &&\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, stackPresentation, route.name]);\n\n const content = (\n <Container\n style={[\n styles.container,\n stackPresentation !== 'transparentModal' &&\n stackPresentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n // @ts-ignore Wrong props passed to View\n stackPresentation={stackPresentation}>\n {children}\n </Container>\n );\n\n const topInset = useSafeAreaInsets().top;\n const dimensions = useSafeAreaFrame();\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled isNativeStack style={StyleSheet.absoluteFill}>\n <HeaderHeightContext.Provider value={headerHeight}>\n <HeaderConfig {...options} route={route} />\n {content}\n </HeaderHeightContext.Provider>\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype NavigationRoute<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList\n> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {\n state?: NavigationState | PartialState<NavigationState>;\n};\n\nconst RouteView = ({\n descriptors,\n route,\n index,\n navigation,\n stateKey,\n}: {\n descriptors: NativeStackDescriptorMap;\n route: NavigationRoute<ParamListBase, string>;\n index: number;\n navigation: NativeStackNavigationHelpers;\n stateKey: string;\n}) => {\n const { options, render: renderScene } = descriptors[route.key];\n const {\n gestureEnabled,\n headerShown,\n homeIndicatorHidden,\n nativeBackButtonDismissalEnabled = false,\n navigationBarColor,\n navigationBarHidden,\n replaceAnimation = 'pop',\n screenOrientation,\n statusBarAnimation,\n statusBarColor,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n swipeDirection = 'horizontal',\n transitionDuration,\n } = options;\n\n let {\n customAnimationOnSwipe,\n fullScreenSwipeEnabled,\n stackAnimation,\n stackPresentation = 'push',\n } = options;\n\n if (swipeDirection === 'vertical') {\n // for `vertical` direction to work, we need to set `fullScreenSwipeEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `customAnimationOnSwipe` needs to be set to `true` so the `stackAnimation` 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 (fullScreenSwipeEnabled === undefined) {\n fullScreenSwipeEnabled = true;\n }\n if (customAnimationOnSwipe === undefined) {\n customAnimationOnSwipe = true;\n }\n if (stackAnimation === undefined) {\n stackAnimation = 'slide_from_bottom';\n }\n }\n\n if (index === 0) {\n // first screen should always be treated as `push`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `push`\n stackPresentation = 'push';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : stackPresentation === 'push' && headerShown !== false;\n\n const dimensions = useSafeAreaFrame();\n const topInset = useSafeAreaInsets().top;\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n const Screen = React.useContext(ScreenContext);\n\n return (\n <Screen\n key={route.key}\n enabled\n isNativeStack\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnSwipe}\n fullScreenSwipeEnabled={fullScreenSwipeEnabled}\n homeIndicatorHidden={homeIndicatorHidden}\n gestureEnabled={isAndroid ? false : gestureEnabled}\n nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}\n navigationBarColor={navigationBarColor}\n navigationBarHidden={navigationBarHidden}\n replaceAnimation={replaceAnimation}\n screenOrientation={screenOrientation}\n stackAnimation={stackAnimation}\n stackPresentation={stackPresentation}\n statusBarAnimation={statusBarAnimation}\n statusBarColor={statusBarColor}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarTranslucent={statusBarTranslucent}\n swipeDirection={swipeDirection}\n transitionDuration={transitionDuration}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: stateKey,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\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: 'appear',\n target: route.key,\n });\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={(e) => {\n navigation.emit({\n type: 'dismiss',\n target: route.key,\n });\n\n const dismissCount =\n e.nativeEvent.dismissCount > 0 ? e.nativeEvent.dismissCount : 1;\n\n navigation.dispatch({\n ...StackActions.pop(dismissCount),\n source: route.key,\n target: stateKey,\n });\n }}>\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false ? headerHeight : parentHeaderHeight ?? 0\n }>\n <HeaderConfig {...options} route={route} headerShown={isHeaderInPush} />\n <MaybeNestedStack\n options={options}\n route={route}\n stackPresentation={stackPresentation}>\n {renderScene()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({\n state,\n navigation,\n descriptors,\n}: Props): JSX.Element {\n const { key, routes } = state;\n\n return (\n <ScreenStack style={styles.container}>\n {routes.map((route, index) => (\n <RouteView\n key={route.key}\n descriptors={descriptors}\n route={route}\n index={index}\n navigation={navigation}\n stateKey={key}\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"]}
@@ -93,24 +93,48 @@ const RouteView = ({
93
93
  render: renderScene
94
94
  } = descriptors[route.key];
95
95
  const {
96
- customAnimationOnSwipe,
97
- fullScreenSwipeEnabled,
98
96
  gestureEnabled,
99
97
  headerShown,
98
+ homeIndicatorHidden,
100
99
  nativeBackButtonDismissalEnabled = false,
100
+ navigationBarColor,
101
+ navigationBarHidden,
101
102
  replaceAnimation = 'pop',
102
103
  screenOrientation,
103
- stackAnimation,
104
104
  statusBarAnimation,
105
105
  statusBarColor,
106
106
  statusBarHidden,
107
107
  statusBarStyle,
108
- statusBarTranslucent
108
+ statusBarTranslucent,
109
+ swipeDirection = 'horizontal',
110
+ transitionDuration
109
111
  } = options;
110
112
  let {
113
+ customAnimationOnSwipe,
114
+ fullScreenSwipeEnabled,
115
+ stackAnimation,
111
116
  stackPresentation = 'push'
112
117
  } = options;
113
118
 
119
+ if (swipeDirection === 'vertical') {
120
+ // for `vertical` direction to work, we need to set `fullScreenSwipeEnabled` to `true`
121
+ // so the screen can be dismissed from any point on screen.
122
+ // `customAnimationOnSwipe` needs to be set to `true` so the `stackAnimation` set by user can be used,
123
+ // otherwise `simple_push` will be used.
124
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
125
+ if (fullScreenSwipeEnabled === undefined) {
126
+ fullScreenSwipeEnabled = true;
127
+ }
128
+
129
+ if (customAnimationOnSwipe === undefined) {
130
+ customAnimationOnSwipe = true;
131
+ }
132
+
133
+ if (stackAnimation === undefined) {
134
+ stackAnimation = 'slide_from_bottom';
135
+ }
136
+ }
137
+
114
138
  if (index === 0) {
115
139
  // first screen should always be treated as `push`, it resolves problems with no header animation
116
140
  // for navigator with first screen as `modal` and the next as `push`
@@ -130,8 +154,11 @@ const RouteView = ({
130
154
  style: StyleSheet.absoluteFill,
131
155
  customAnimationOnSwipe: customAnimationOnSwipe,
132
156
  fullScreenSwipeEnabled: fullScreenSwipeEnabled,
157
+ homeIndicatorHidden: homeIndicatorHidden,
133
158
  gestureEnabled: isAndroid ? false : gestureEnabled,
134
159
  nativeBackButtonDismissalEnabled: nativeBackButtonDismissalEnabled,
160
+ navigationBarColor: navigationBarColor,
161
+ navigationBarHidden: navigationBarHidden,
135
162
  replaceAnimation: replaceAnimation,
136
163
  screenOrientation: screenOrientation,
137
164
  stackAnimation: stackAnimation,
@@ -141,6 +168,8 @@ const RouteView = ({
141
168
  statusBarHidden: statusBarHidden,
142
169
  statusBarStyle: statusBarStyle,
143
170
  statusBarTranslucent: statusBarTranslucent,
171
+ swipeDirection: swipeDirection,
172
+ transitionDuration: transitionDuration,
144
173
  onHeaderBackButtonClicked: () => {
145
174
  navigation.dispatch({ ...StackActions.pop(),
146
175
  source: route.key,
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStackView.tsx"],"names":["React","Platform","StyleSheet","View","AppContainer","warnOnce","ScreenStack","ScreenContext","StackActions","useTheme","useSafeAreaFrame","useSafeAreaInsets","HeaderConfig","SafeAreaProviderCompat","getDefaultHeaderHeight","HeaderHeightContext","isAndroid","OS","Container","__DEV__","DebugContainer","props","stackPresentation","rest","MaybeNestedStack","options","route","children","colors","headerShown","contentStyle","Screen","useContext","isHeaderInModal","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","topInset","top","dimensions","headerHeight","absoluteFill","RouteView","descriptors","index","navigation","stateKey","render","renderScene","key","customAnimationOnSwipe","fullScreenSwipeEnabled","gestureEnabled","nativeBackButtonDismissalEnabled","replaceAnimation","screenOrientation","stackAnimation","statusBarAnimation","statusBarColor","statusBarHidden","statusBarStyle","statusBarTranslucent","isHeaderInPush","parentHeaderHeight","dispatch","pop","source","target","emit","type","data","closing","e","dismissCount","nativeEvent","NativeStackViewInner","state","routes","map","NativeStackView","create","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAAsD,cAAtD,C,CACA;;AACA,OAAOC,YAAP,MAAyB,iDAAzB;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,SACEC,WADF,EAGEC,aAHF,QAIO,sBAJP;AAKA,SAEEC,YAFF,EAIEC,QAJF,QAQO,0BARP;AASA,SACEC,gBADF,EAEEC,iBAFF,QAGO,gCAHP;AAUA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,OAAOC,mBAAP,MAAgC,8BAAhC;AAEA,MAAMC,SAAS,GAAGf,QAAQ,CAACgB,EAAT,KAAgB,SAAlC;AAEA,IAAIC,SAAS,GAAGf,IAAhB;;AAEA,IAAIgB,OAAJ,EAAa;AACX,QAAMC,cAAc,GAClBC,KADqB,IAElB;AACH,UAAM;AAAEC,MAAAA,iBAAF;AAAqB,SAAGC;AAAxB,QAAiCF,KAAvC;;AACA,QAAIpB,QAAQ,CAACgB,EAAT,KAAgB,KAAhB,IAAyBK,iBAAiB,KAAK,MAAnD,EAA2D;AACzD,0BACE,oBAAC,YAAD,qBACE,oBAAC,IAAD,EAAUC,IAAV,CADF,CADF;AAKD;;AACD,wBAAO,oBAAC,IAAD,EAAUA,IAAV,CAAP;AACD,GAZD,CADW,CAcX;;;AACAL,EAAAA,SAAS,GAAGE,cAAZ;AACD;;AAED,MAAMI,gBAAgB,GAAG,CAAC;AACxBC,EAAAA,OADwB;AAExBC,EAAAA,KAFwB;AAGxBJ,EAAAA,iBAHwB;AAIxBK,EAAAA;AAJwB,CAAD,KAUnB;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAanB,QAAQ,EAA3B;AACA,QAA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,IAAA,QAAQ,EAAEI;AANZ,IADD,CADH,CADF;AAcD;;AAED,eAAe,SAAS8B,eAAT,CAAyBjE,KAAzB,EAAuC;AACpD,sBACE,oBAAC,sBAAD,qBACE,oBAAC,oBAAD,EAA0BA,KAA1B,CADF,CADF;AAKD;AAED,MAAMmB,MAAM,GAAGtC,UAAU,CAACqF,MAAX,CAAkB;AAC/B9C,EAAAA,SAAS,EAAE;AACT+C,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, StyleSheet, View, ViewProps } from 'react-native';\n// @ts-ignore Getting private component\nimport AppContainer from 'react-native/Libraries/ReactNative/AppContainer';\nimport warnOnce from 'warn-once';\nimport {\n ScreenStack,\n StackPresentationTypes,\n ScreenContext,\n} from 'react-native-screens';\nimport {\n ParamListBase,\n StackActions,\n StackNavigationState,\n useTheme,\n Route,\n NavigationState,\n PartialState,\n} from '@react-navigation/native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport HeaderConfig from './HeaderConfig';\nimport SafeAreaProviderCompat from '../utils/SafeAreaProviderCompat';\nimport getDefaultHeaderHeight from '../utils/getDefaultHeaderHeight';\nimport HeaderHeightContext from '../utils/HeaderHeightContext';\n\nconst isAndroid = Platform.OS === 'android';\n\nlet Container = View;\n\nif (__DEV__) {\n const DebugContainer = (\n props: ViewProps & { stackPresentation: StackPresentationTypes }\n ) => {\n const { stackPresentation, ...rest } = props;\n if (Platform.OS === 'ios' && stackPresentation !== 'push') {\n return (\n <AppContainer>\n <View {...rest} />\n </AppContainer>\n );\n }\n return <View {...rest} />;\n };\n // @ts-ignore Wrong props\n Container = DebugContainer;\n}\n\nconst MaybeNestedStack = ({\n options,\n route,\n stackPresentation,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { headerShown = true, contentStyle } = options;\n\n const Screen = React.useContext(ScreenContext);\n\n const isHeaderInModal = isAndroid\n ? false\n : stackPresentation !== 'push' && headerShown === true;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n stackPresentation !== 'push' &&\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, stackPresentation, route.name]);\n\n const content = (\n <Container\n style={[\n styles.container,\n stackPresentation !== 'transparentModal' &&\n stackPresentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n // @ts-ignore Wrong props passed to View\n stackPresentation={stackPresentation}>\n {children}\n </Container>\n );\n\n const topInset = useSafeAreaInsets().top;\n const dimensions = useSafeAreaFrame();\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled isNativeStack style={StyleSheet.absoluteFill}>\n <HeaderHeightContext.Provider value={headerHeight}>\n <HeaderConfig {...options} route={route} />\n {content}\n </HeaderHeightContext.Provider>\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype NavigationRoute<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList\n> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {\n state?: NavigationState | PartialState<NavigationState>;\n};\n\nconst RouteView = ({\n descriptors,\n route,\n index,\n navigation,\n stateKey,\n}: {\n descriptors: NativeStackDescriptorMap;\n route: NavigationRoute<ParamListBase, string>;\n index: number;\n navigation: NativeStackNavigationHelpers;\n stateKey: string;\n}) => {\n const { options, render: renderScene } = descriptors[route.key];\n const {\n customAnimationOnSwipe,\n fullScreenSwipeEnabled,\n gestureEnabled,\n headerShown,\n nativeBackButtonDismissalEnabled = false,\n replaceAnimation = 'pop',\n screenOrientation,\n stackAnimation,\n statusBarAnimation,\n statusBarColor,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n } = options;\n\n let { stackPresentation = 'push' } = options;\n\n if (index === 0) {\n // first screen should always be treated as `push`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `push`\n stackPresentation = 'push';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : stackPresentation === 'push' && headerShown !== false;\n\n const dimensions = useSafeAreaFrame();\n const topInset = useSafeAreaInsets().top;\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n const Screen = React.useContext(ScreenContext);\n\n return (\n <Screen\n key={route.key}\n enabled\n isNativeStack\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnSwipe}\n fullScreenSwipeEnabled={fullScreenSwipeEnabled}\n gestureEnabled={isAndroid ? false : gestureEnabled}\n nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}\n replaceAnimation={replaceAnimation}\n screenOrientation={screenOrientation}\n stackAnimation={stackAnimation}\n stackPresentation={stackPresentation}\n statusBarAnimation={statusBarAnimation}\n statusBarColor={statusBarColor}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarTranslucent={statusBarTranslucent}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: stateKey,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\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: 'appear',\n target: route.key,\n });\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={(e) => {\n navigation.emit({\n type: 'dismiss',\n target: route.key,\n });\n\n const dismissCount =\n e.nativeEvent.dismissCount > 0 ? e.nativeEvent.dismissCount : 1;\n\n navigation.dispatch({\n ...StackActions.pop(dismissCount),\n source: route.key,\n target: stateKey,\n });\n }}>\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false ? headerHeight : parentHeaderHeight ?? 0\n }>\n <HeaderConfig {...options} route={route} headerShown={isHeaderInPush} />\n <MaybeNestedStack\n options={options}\n route={route}\n stackPresentation={stackPresentation}>\n {renderScene()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({\n state,\n navigation,\n descriptors,\n}: Props): JSX.Element {\n const { key, routes } = state;\n\n return (\n <ScreenStack style={styles.container}>\n {routes.map((route, index) => (\n <RouteView\n key={route.key}\n descriptors={descriptors}\n route={route}\n index={index}\n navigation={navigation}\n stateKey={key}\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.tsx"],"names":["React","Platform","StyleSheet","View","AppContainer","warnOnce","ScreenStack","ScreenContext","StackActions","useTheme","useSafeAreaFrame","useSafeAreaInsets","HeaderConfig","SafeAreaProviderCompat","getDefaultHeaderHeight","HeaderHeightContext","isAndroid","OS","Container","__DEV__","DebugContainer","props","stackPresentation","rest","MaybeNestedStack","options","route","children","colors","headerShown","contentStyle","Screen","useContext","isHeaderInModal","headerShownPreviousRef","useRef","useEffect","current","name","content","styles","container","backgroundColor","background","topInset","top","dimensions","headerHeight","absoluteFill","RouteView","descriptors","index","navigation","stateKey","render","renderScene","key","gestureEnabled","homeIndicatorHidden","nativeBackButtonDismissalEnabled","navigationBarColor","navigationBarHidden","replaceAnimation","screenOrientation","statusBarAnimation","statusBarColor","statusBarHidden","statusBarStyle","statusBarTranslucent","swipeDirection","transitionDuration","customAnimationOnSwipe","fullScreenSwipeEnabled","stackAnimation","undefined","isHeaderInPush","parentHeaderHeight","dispatch","pop","source","target","emit","type","data","closing","e","dismissCount","nativeEvent","NativeStackViewInner","state","routes","map","NativeStackView","create","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAAsD,cAAtD,C,CACA;;AACA,OAAOC,YAAP,MAAyB,iDAAzB;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,SACEC,WADF,EAGEC,aAHF,QAIO,sBAJP;AAKA,SAEEC,YAFF,EAIEC,QAJF,QAQO,0BARP;AASA,SACEC,gBADF,EAEEC,iBAFF,QAGO,gCAHP;AAUA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,OAAOC,sBAAP,MAAmC,iCAAnC;AACA,OAAOC,mBAAP,MAAgC,8BAAhC;AAEA,MAAMC,SAAS,GAAGf,QAAQ,CAACgB,EAAT,KAAgB,SAAlC;AAEA,IAAIC,SAAS,GAAGf,IAAhB;;AAEA,IAAIgB,OAAJ,EAAa;AACX,QAAMC,cAAc,GAClBC,KADqB,IAElB;AACH,UAAM;AAAEC,MAAAA,iBAAF;AAAqB,SAAGC;AAAxB,QAAiCF,KAAvC;;AACA,QAAIpB,QAAQ,CAACgB,EAAT,KAAgB,KAAhB,IAAyBK,iBAAiB,KAAK,MAAnD,EAA2D;AACzD,0BACE,oBAAC,YAAD,qBACE,oBAAC,IAAD,EAAUC,IAAV,CADF,CADF;AAKD;;AACD,wBAAO,oBAAC,IAAD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* as React from 'react';\nimport { Platform, StyleSheet, View, ViewProps } from 'react-native';\n// @ts-ignore Getting private component\nimport AppContainer from 'react-native/Libraries/ReactNative/AppContainer';\nimport warnOnce from 'warn-once';\nimport {\n ScreenStack,\n StackPresentationTypes,\n ScreenContext,\n} from 'react-native-screens';\nimport {\n ParamListBase,\n StackActions,\n StackNavigationState,\n useTheme,\n Route,\n NavigationState,\n PartialState,\n} from '@react-navigation/native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n NativeStackNavigationOptions,\n} from '../types';\nimport HeaderConfig from './HeaderConfig';\nimport SafeAreaProviderCompat from '../utils/SafeAreaProviderCompat';\nimport getDefaultHeaderHeight from '../utils/getDefaultHeaderHeight';\nimport HeaderHeightContext from '../utils/HeaderHeightContext';\n\nconst isAndroid = Platform.OS === 'android';\n\nlet Container = View;\n\nif (__DEV__) {\n const DebugContainer = (\n props: ViewProps & { stackPresentation: StackPresentationTypes }\n ) => {\n const { stackPresentation, ...rest } = props;\n if (Platform.OS === 'ios' && stackPresentation !== 'push') {\n return (\n <AppContainer>\n <View {...rest} />\n </AppContainer>\n );\n }\n return <View {...rest} />;\n };\n // @ts-ignore Wrong props\n Container = DebugContainer;\n}\n\nconst MaybeNestedStack = ({\n options,\n route,\n stackPresentation,\n children,\n}: {\n options: NativeStackNavigationOptions;\n route: Route<string>;\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n}) => {\n const { colors } = useTheme();\n const { headerShown = true, contentStyle } = options;\n\n const Screen = React.useContext(ScreenContext);\n\n const isHeaderInModal = isAndroid\n ? false\n : stackPresentation !== 'push' && headerShown === true;\n\n const headerShownPreviousRef = React.useRef(headerShown);\n\n React.useEffect(() => {\n warnOnce(\n !isAndroid &&\n stackPresentation !== 'push' &&\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, stackPresentation, route.name]);\n\n const content = (\n <Container\n style={[\n styles.container,\n stackPresentation !== 'transparentModal' &&\n stackPresentation !== 'containedTransparentModal' && {\n backgroundColor: colors.background,\n },\n contentStyle,\n ]}\n // @ts-ignore Wrong props passed to View\n stackPresentation={stackPresentation}>\n {children}\n </Container>\n );\n\n const topInset = useSafeAreaInsets().top;\n const dimensions = useSafeAreaFrame();\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n\n if (isHeaderInModal) {\n return (\n <ScreenStack style={styles.container}>\n <Screen enabled isNativeStack style={StyleSheet.absoluteFill}>\n <HeaderHeightContext.Provider value={headerHeight}>\n <HeaderConfig {...options} route={route} />\n {content}\n </HeaderHeightContext.Provider>\n </Screen>\n </ScreenStack>\n );\n }\n\n return content;\n};\n\ntype NavigationRoute<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList\n> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {\n state?: NavigationState | PartialState<NavigationState>;\n};\n\nconst RouteView = ({\n descriptors,\n route,\n index,\n navigation,\n stateKey,\n}: {\n descriptors: NativeStackDescriptorMap;\n route: NavigationRoute<ParamListBase, string>;\n index: number;\n navigation: NativeStackNavigationHelpers;\n stateKey: string;\n}) => {\n const { options, render: renderScene } = descriptors[route.key];\n const {\n gestureEnabled,\n headerShown,\n homeIndicatorHidden,\n nativeBackButtonDismissalEnabled = false,\n navigationBarColor,\n navigationBarHidden,\n replaceAnimation = 'pop',\n screenOrientation,\n statusBarAnimation,\n statusBarColor,\n statusBarHidden,\n statusBarStyle,\n statusBarTranslucent,\n swipeDirection = 'horizontal',\n transitionDuration,\n } = options;\n\n let {\n customAnimationOnSwipe,\n fullScreenSwipeEnabled,\n stackAnimation,\n stackPresentation = 'push',\n } = options;\n\n if (swipeDirection === 'vertical') {\n // for `vertical` direction to work, we need to set `fullScreenSwipeEnabled` to `true`\n // so the screen can be dismissed from any point on screen.\n // `customAnimationOnSwipe` needs to be set to `true` so the `stackAnimation` 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 (fullScreenSwipeEnabled === undefined) {\n fullScreenSwipeEnabled = true;\n }\n if (customAnimationOnSwipe === undefined) {\n customAnimationOnSwipe = true;\n }\n if (stackAnimation === undefined) {\n stackAnimation = 'slide_from_bottom';\n }\n }\n\n if (index === 0) {\n // first screen should always be treated as `push`, it resolves problems with no header animation\n // for navigator with first screen as `modal` and the next as `push`\n stackPresentation = 'push';\n }\n\n const isHeaderInPush = isAndroid\n ? headerShown\n : stackPresentation === 'push' && headerShown !== false;\n\n const dimensions = useSafeAreaFrame();\n const topInset = useSafeAreaInsets().top;\n const headerHeight = getDefaultHeaderHeight(\n dimensions,\n topInset,\n stackPresentation\n );\n const parentHeaderHeight = React.useContext(HeaderHeightContext);\n const Screen = React.useContext(ScreenContext);\n\n return (\n <Screen\n key={route.key}\n enabled\n isNativeStack\n style={StyleSheet.absoluteFill}\n customAnimationOnSwipe={customAnimationOnSwipe}\n fullScreenSwipeEnabled={fullScreenSwipeEnabled}\n homeIndicatorHidden={homeIndicatorHidden}\n gestureEnabled={isAndroid ? false : gestureEnabled}\n nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}\n navigationBarColor={navigationBarColor}\n navigationBarHidden={navigationBarHidden}\n replaceAnimation={replaceAnimation}\n screenOrientation={screenOrientation}\n stackAnimation={stackAnimation}\n stackPresentation={stackPresentation}\n statusBarAnimation={statusBarAnimation}\n statusBarColor={statusBarColor}\n statusBarHidden={statusBarHidden}\n statusBarStyle={statusBarStyle}\n statusBarTranslucent={statusBarTranslucent}\n swipeDirection={swipeDirection}\n transitionDuration={transitionDuration}\n onHeaderBackButtonClicked={() => {\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: stateKey,\n });\n }}\n onWillAppear={() => {\n navigation.emit({\n type: 'transitionStart',\n data: { closing: false },\n target: route.key,\n });\n }}\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: 'appear',\n target: route.key,\n });\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={(e) => {\n navigation.emit({\n type: 'dismiss',\n target: route.key,\n });\n\n const dismissCount =\n e.nativeEvent.dismissCount > 0 ? e.nativeEvent.dismissCount : 1;\n\n navigation.dispatch({\n ...StackActions.pop(dismissCount),\n source: route.key,\n target: stateKey,\n });\n }}>\n <HeaderHeightContext.Provider\n value={\n isHeaderInPush !== false ? headerHeight : parentHeaderHeight ?? 0\n }>\n <HeaderConfig {...options} route={route} headerShown={isHeaderInPush} />\n <MaybeNestedStack\n options={options}\n route={route}\n stackPresentation={stackPresentation}>\n {renderScene()}\n </MaybeNestedStack>\n </HeaderHeightContext.Provider>\n </Screen>\n );\n};\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nfunction NativeStackViewInner({\n state,\n navigation,\n descriptors,\n}: Props): JSX.Element {\n const { key, routes } = state;\n\n return (\n <ScreenStack style={styles.container}>\n {routes.map((route, index) => (\n <RouteView\n key={route.key}\n descriptors={descriptors}\n route={route}\n index={index}\n navigation={navigation}\n stateKey={key}\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"]}
@@ -223,6 +223,12 @@ export declare type NativeStackNavigationOptions = {
223
223
  * Boolean indicating whether the navigation bar is translucent.
224
224
  */
225
225
  headerTranslucent?: boolean;
226
+ /**
227
+ * Whether the home indicator should be hidden on this screen. Defaults to `false`.
228
+ *
229
+ * @platform ios
230
+ */
231
+ homeIndicatorHidden?: boolean;
226
232
  /**
227
233
  * Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
228
234
  * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
@@ -231,6 +237,18 @@ export declare type NativeStackNavigationOptions = {
231
237
  * @platform android
232
238
  */
233
239
  nativeBackButtonDismissalEnabled?: boolean;
240
+ /**
241
+ * Sets the navigation bar color. Defaults to initial status bar color.
242
+ *
243
+ * @platform android
244
+ */
245
+ navigationBarColor?: string;
246
+ /**
247
+ * Sets the visibility of the navigation bar. Defaults to `false`.
248
+ *
249
+ * @platform android
250
+ */
251
+ navigationBarHidden?: boolean;
234
252
  /**
235
253
  * How should the screen replacing another screen animate. Defaults to `pop`.
236
254
  * The following values are currently supported:
@@ -305,10 +323,26 @@ export declare type NativeStackNavigationOptions = {
305
323
  * @platform android
306
324
  */
307
325
  statusBarTranslucent?: boolean;
326
+ /**
327
+ * Sets the direction in which you should swipe to dismiss the screen.
328
+ * When using `vertical` option, options `fullScreenSwipeEnabled: true`, `customAnimationOnSwipe: true` and `stackAnimation: 'slide_from_bottom'` are set by default.
329
+ * The following values are supported:
330
+ * - `vertical` – dismiss screen vertically
331
+ * - `horizontal` – dismiss screen horizontally (default)
332
+ * @platform ios
333
+ */
334
+ swipeDirection?: ScreenProps['swipeDirection'];
308
335
  /**
309
336
  * String that can be displayed in the header as a fallback for `headerTitle`.
310
337
  */
311
338
  title?: string;
339
+ /**
340
+ * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.
341
+ * The duration of `default` and `flip` transitions isn't customizable.
342
+ *
343
+ * @platform ios
344
+ */
345
+ transitionDuration?: number;
312
346
  };
313
347
  export declare type NativeStackNavigatorProps = DefaultNavigatorOptions<NativeStackNavigationOptions> & StackRouterOptions & NativeStackNavigationConfig;
314
348
  export declare type NativeStackDescriptor = Descriptor<ParamListBase, string, StackNavigationState<ParamListBase>, NativeStackNavigationOptions>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ScreenProps } from 'react-native-screens';
3
3
  import Animated from 'react-native-reanimated';
4
- declare const ReanimatedNativeStackScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "nativeBackButtonDismissalEnabled" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
4
+ declare const ReanimatedNativeStackScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "homeIndicatorHidden" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
5
5
  export default ReanimatedNativeStackScreen;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ScreenProps } from 'react-native-screens';
3
3
  import Animated from 'react-native-reanimated';
4
- declare const ReanimatedScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "nativeBackButtonDismissalEnabled" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
4
+ declare const ReanimatedScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "homeIndicatorHidden" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
5
5
  export default ReanimatedScreen;
@@ -3,6 +3,7 @@ export declare type StackPresentationTypes = 'push' | 'modal' | 'transparentModa
3
3
  export declare type StackAnimationTypes = 'default' | 'fade' | 'fade_from_bottom' | 'flip' | 'none' | 'simple_push' | 'slide_from_bottom' | 'slide_from_right' | 'slide_from_left';
4
4
  export declare type BlurEffectTypes = 'extraLight' | 'light' | 'dark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
5
5
  export declare type ScreenReplaceTypes = 'push' | 'pop';
6
+ export declare type SwipeDirectionTypes = 'vertical' | 'horizontal';
6
7
  export declare type ScreenOrientationTypes = 'default' | 'all' | 'portrait' | 'portrait_up' | 'portrait_down' | 'landscape' | 'landscape_left' | 'landscape_right';
7
8
  export declare type HeaderSubviewTypes = 'back' | 'right' | 'left' | 'center' | 'searchBar';
8
9
  export declare type TransitionProgressEventType = {
@@ -42,6 +43,12 @@ export interface ScreenProps extends ViewProps {
42
43
  * @platform ios
43
44
  */
44
45
  gestureEnabled?: boolean;
46
+ /**
47
+ * Whether the home indicator should be hidden on this screen. Defaults to `false`.
48
+ *
49
+ * @platform ios
50
+ */
51
+ homeIndicatorHidden?: boolean;
45
52
  /**
46
53
  * Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
47
54
  * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
@@ -50,6 +57,18 @@ export interface ScreenProps extends ViewProps {
50
57
  * @platform android
51
58
  */
52
59
  nativeBackButtonDismissalEnabled?: boolean;
60
+ /**
61
+ * Sets the navigation bar color. Defaults to initial status bar color.
62
+ *
63
+ * @platform android
64
+ */
65
+ navigationBarColor?: string;
66
+ /**
67
+ * Sets the visibility of the navigation bar. Defaults to `false`.
68
+ *
69
+ * @platform android
70
+ */
71
+ navigationBarHidden?: boolean;
53
72
  /**
54
73
  * A callback that gets called when the current screen appears.
55
74
  */
@@ -155,6 +174,23 @@ export interface ScreenProps extends ViewProps {
155
174
  * @platform android
156
175
  */
157
176
  statusBarTranslucent?: boolean;
177
+ /**
178
+ * Sets the direction in which you should swipe to dismiss the screen.
179
+ * When using `vertical` option, options `fullScreenSwipeEnabled: true`, `customAnimationOnSwipe: true` and `stackAnimation: 'slide_from_bottom'` are set by default.
180
+ * The following values are supported:
181
+ * - `vertical` – dismiss screen vertically
182
+ * - `horizontal` – dismiss screen horizontally (default)
183
+ *
184
+ * @platform ios
185
+ */
186
+ swipeDirection?: SwipeDirectionTypes;
187
+ /**
188
+ * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.
189
+ * The duration of `default` and `flip` transitions isn't customizable.
190
+ *
191
+ * @platform ios
192
+ */
193
+ transitionDuration?: number;
158
194
  }
159
195
  export interface ScreenContainerProps extends ViewProps {
160
196
  children?: React.ReactNode;
@@ -375,17 +411,17 @@ export interface SearchBarProps {
375
411
  */
376
412
  onChangeText?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;
377
413
  /**
378
- * A callback that gets called when search bar has received focus
414
+ * A callback that gets called when search bar is closed
415
+ *
416
+ * @platform android
379
417
  */
380
418
  onClose?: () => void;
381
419
  /**
382
- * A callback that gets called when search bar is opened
383
- *
384
- * @platform android
420
+ * A callback that gets called when search bar has received focus
385
421
  */
386
422
  onFocus?: (e: NativeSyntheticEvent<TargetedEvent>) => void;
387
423
  /**
388
- * A callback that gets called when search bar is closed
424
+ * A callback that gets called when search bar is opened
389
425
  *
390
426
  * @platform android
391
427
  */
@@ -402,4 +438,23 @@ export interface SearchBarProps {
402
438
  * The search field text color
403
439
  */
404
440
  textColor?: string;
441
+ /**
442
+ * The search hint text color
443
+ *
444
+ * @plaform android
445
+ */
446
+ hintTextColor?: string;
447
+ /**
448
+ * The search and close icon color shown in the header
449
+ *
450
+ * @plaform android
451
+ */
452
+ headerIconColor?: string;
453
+ /**
454
+ * Show the search hint icon when search bar is focused
455
+ *
456
+ * @plaform android
457
+ * @default true
458
+ */
459
+ shouldShowHintSearchIcon?: boolean;
405
460
  }
@@ -182,6 +182,10 @@ A Boolean to that lets you opt out of insetting the header. You may want to * se
182
182
 
183
183
  Boolean indicating whether the navigation bar is translucent.
184
184
 
185
+ #### `homeIndicatorHidden` (iOS only)
186
+
187
+ Whether the home indicator should be hidden on this screen. Defaults to `false`.
188
+
185
189
  #### `nativeBackButtonDismissalEnabled` (Android only)
186
190
 
187
191
  Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
@@ -189,6 +193,14 @@ Unfortunately the same behavior is not available on iOS since the behavior of na
189
193
 
190
194
  Defaults to `false`.
191
195
 
196
+ #### `navigationBarColor` (Android only)
197
+
198
+ Sets the navigation bar color. Defaults to initial status bar color.
199
+
200
+ #### `navigationBarHidden` (Android only)
201
+
202
+ Sets the visibility of the navigation bar. Defaults to `false`.
203
+
192
204
  #### `replaceAnimation`
193
205
 
194
206
  How should the screen replacing another screen animate.
@@ -230,10 +242,24 @@ Defaults to `push`.
230
242
 
231
243
  Using `containedModal` and `containedTransparentModal` with other types of modals in one native stack navigator is not recommended and can result in a freeze or a crash of the application.
232
244
 
245
+ #### `swipeDirection` (iOS only)
246
+
247
+ Sets the direction in which you should swipe to dismiss the screen. The following values are supported:
248
+ - `vertical` – dismiss screen vertically
249
+ - `horizontal` – dismiss screen horizontally (default)
250
+
251
+ When using `vertical` option, options `fullScreenSwipeEnabled: true`, `customAnimationOnSwipe: true` and `stackAnimation: 'slide_from_bottom'` are set by default.
252
+
233
253
  #### `title`
234
254
 
235
255
  A string that can be used as a fallback for `headerTitle`.
236
256
 
257
+ #### `transitionDuration` (iOS only)
258
+
259
+ Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.
260
+
261
+ The duration of `default` and `flip` transitions isn't customizable.
262
+
237
263
  #### `useTransitionProgress`
238
264
 
239
265
  Hook providing context value of transition progress of the current screen to be used with `react-native` `Animated`. It consists of 2 values:
@@ -353,12 +379,10 @@ Defaults to `auto`.
353
379
 
354
380
  Sets the translucency of the status bar (similar to the `StatusBar` component). Defaults to `false`.
355
381
 
356
- ### Search bar (iOS only)
382
+ ### Search bar
357
383
 
358
384
  The search bar is just a `searchBar` property that can be specified in the navigator's `screenOptions` or an individual screen's `options`. Search bars are rarely static so normally it is controlled by passing an object to `searchBar` navigation option in the component's body.
359
385
 
360
- Search bar is only supported on iOS.
361
-
362
386
  Example:
363
387
 
364
388
  ```js
@@ -485,6 +509,18 @@ Defaults to an empty string.
485
509
 
486
510
  The search field text color.
487
511
 
512
+ #### `hintTextColor`
513
+
514
+ The search hint text color. (Android only)
515
+
516
+ #### `headerIconColor`
517
+
518
+ The search and close icon color shown in the header. (Android only)
519
+
520
+ #### `shouldShowHintSearchIcon`
521
+
522
+ Show the search hint icon when search bar is focused. (Android only)
523
+
488
524
  ### Events
489
525
 
490
526
  The navigator can [emit events](https://reactnavigation.org/docs/navigation-events) on certain actions. Supported events are:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screens",
3
- "version": "3.10.2",
3
+ "version": "3.11.0",
4
4
  "description": "Native navigation primitives for your React Native app.",
5
5
  "scripts": {
6
6
  "check-types": "tsc --noEmit",
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../lib/commonjs/reanimated/index",
3
+ "module": "../lib/module/reanimated/index",
4
+ "react-native": "../src/reanimated/index",
5
+ "types": "../lib/typescript/reanimated/index"
6
+ }