react-native-screens 3.18.2 → 3.19.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.
- package/README.md +30 -38
- package/android/build.gradle +1 -5
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +10 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +15 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +5 -0
- package/ios/RNSConvert.h +6 -0
- package/ios/RNSConvert.mm +26 -0
- package/ios/RNSEnums.h +6 -0
- package/ios/RNSFullWindowOverlay.mm +32 -0
- package/ios/RNSScreen.h +10 -2
- package/ios/RNSScreen.mm +133 -2
- package/ios/RNSScreenStackHeaderConfig.mm +17 -1
- package/lib/commonjs/TransitionProgressContext.js +2 -7
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/createNativeStackNavigator.js +29 -76
- package/lib/commonjs/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -5
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +2 -10
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +2 -10
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +0 -7
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +21 -45
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +43 -103
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-stack/index.js +6 -11
- package/lib/commonjs/native-stack/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +18 -25
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/types.js +4 -0
- package/lib/commonjs/native-stack/types.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js +2 -6
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js +11 -19
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js +0 -7
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js +7 -18
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js +2 -10
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/FontProcessor.js +1 -6
- package/lib/commonjs/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +46 -50
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +32 -58
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +11 -21
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js +3 -10
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +3 -19
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js +2 -7
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/index.js +0 -3
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js +2 -10
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/types.js +4 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js +2 -10
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/commonjs/utils.js +0 -4
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/TransitionProgressContext.js.map +1 -1
- package/lib/module/createNativeStackNavigator.js +29 -67
- package/lib/module/createNativeStackNavigator.js.map +1 -1
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -1
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js +0 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js +0 -1
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/index.js +13 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +45 -93
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-stack/index.js +3 -2
- package/lib/module/native-stack/index.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +16 -16
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/types.js +1 -1
- package/lib/module/native-stack/types.js.map +1 -1
- package/lib/module/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js +8 -7
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js +0 -4
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js +7 -8
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/utils/useHeaderHeight.js +0 -2
- package/lib/module/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/views/FontProcessor.js +0 -3
- package/lib/module/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +44 -39
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +32 -42
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +12 -9
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js +5 -4
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js +3 -14
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/reanimated/ReanimatedTransitionProgressContext.js +2 -1
- package/lib/module/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/useReanimatedTransitionProgress.js +0 -2
- package/lib/module/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useTransitionProgress.js +0 -2
- package/lib/module/useTransitionProgress.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +1 -0
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +1 -0
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -0
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/types.d.ts +1 -0
- package/package.json +9 -1
- package/src/createNativeStackNavigator.tsx +4 -2
- package/src/fabric/ScreenNativeComponent.js +7 -0
- package/src/index.native.tsx +32 -16
- package/src/index.tsx +13 -8
- package/src/native-stack/types.tsx +4 -5
- package/src/native-stack/views/HeaderConfig.tsx +8 -10
- package/src/native-stack/views/NativeStackView.tsx +8 -4
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +5 -3
- package/src/reanimated/ReanimatedScreen.tsx +1 -1
|
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useReanimatedTransitionProgress;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _ReanimatedTransitionProgressContext = _interopRequireDefault(require("./ReanimatedTransitionProgressContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
12
|
function useReanimatedTransitionProgress() {
|
|
19
13
|
const progress = React.useContext(_ReanimatedTransitionProgressContext.default);
|
|
20
|
-
|
|
21
14
|
if (progress === undefined) {
|
|
22
15
|
throw new Error("Couldn't find values for reanimated transition progress. Are you inside a screen in Native Stack?");
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
return progress;
|
|
26
18
|
}
|
|
27
19
|
//# sourceMappingURL=useReanimatedTransitionProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useReanimatedTransitionProgress","progress","React","useContext","ReanimatedTransitionProgressContext","undefined","Error"],"sources":["useReanimatedTransitionProgress.tsx"],"sourcesContent":["import * as React from 'react';\nimport ReanimatedTransitionProgressContext from './ReanimatedTransitionProgressContext';\n\nexport default function useReanimatedTransitionProgress() {\n const progress = React.useContext(ReanimatedTransitionProgressContext);\n\n if (progress === undefined) {\n throw new Error(\n \"Couldn't find values for reanimated transition progress. Are you inside a screen in Native Stack?\"\n );\n }\n\n return progress;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAAwF;AAAA;AAAA;AAEzE,SAASA,+BAA+B,GAAG;EACxD,MAAMC,QAAQ,GAAGC,KAAK,CAACC,UAAU,CAACC,4CAAmC,CAAC;EAEtE,IAAIH,QAAQ,KAAKI,SAAS,EAAE;IAC1B,MAAM,IAAIC,KAAK,CACb,mGAAmG,CACpG;EACH;EAEA,OAAOL,QAAQ;AACjB"}
|
package/lib/commonjs/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import {\n Animated,\n NativeSyntheticEvent,\n ViewProps,\n View,\n TargetedEvent,\n TextInputFocusEventData,\n} from 'react-native';\n\nexport type StackPresentationTypes =\n | 'push'\n | 'modal'\n | 'transparentModal'\n | 'containedModal'\n | 'containedTransparentModal'\n | 'fullScreenModal'\n | 'formSheet';\nexport type StackAnimationTypes =\n | 'default'\n | 'fade'\n | 'fade_from_bottom'\n | 'flip'\n | 'none'\n | 'simple_push'\n | 'slide_from_bottom'\n | 'slide_from_right'\n | 'slide_from_left';\nexport type BlurEffectTypes =\n | 'extraLight'\n | 'light'\n | 'dark'\n | 'regular'\n | 'prominent'\n | 'systemUltraThinMaterial'\n | 'systemThinMaterial'\n | 'systemMaterial'\n | 'systemThickMaterial'\n | 'systemChromeMaterial'\n | 'systemUltraThinMaterialLight'\n | 'systemThinMaterialLight'\n | 'systemMaterialLight'\n | 'systemThickMaterialLight'\n | 'systemChromeMaterialLight'\n | 'systemUltraThinMaterialDark'\n | 'systemThinMaterialDark'\n | 'systemMaterialDark'\n | 'systemThickMaterialDark'\n | 'systemChromeMaterialDark';\nexport type ScreenReplaceTypes = 'push' | 'pop';\nexport type SwipeDirectionTypes = 'vertical' | 'horizontal';\nexport type ScreenOrientationTypes =\n | 'default'\n | 'all'\n | 'portrait'\n | 'portrait_up'\n | 'portrait_down'\n | 'landscape'\n | 'landscape_left'\n | 'landscape_right';\nexport type HeaderSubviewTypes =\n | 'back'\n | 'right'\n | 'left'\n | 'center'\n | 'searchBar';\n\nexport type TransitionProgressEventType = {\n progress: number;\n closing: number;\n goingForward: number;\n};\n\nexport type GestureResponseDistanceType = {\n start?: number;\n end?: number;\n top?: number;\n bottom?: number;\n};\n\nexport interface ScreenProps extends ViewProps {\n active?: 0 | 1 | Animated.AnimatedInterpolation;\n activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation;\n children?: React.ReactNode;\n /**\n * Boolean indicating that swipe dismissal should trigger animation provided by `stackAnimation`. Defaults to `false`.\n *\n * @platform ios\n */\n customAnimationOnSwipe?: boolean;\n /**\n * All children screens should have the same value of their \"enabled\" prop as their container.\n */\n enabled?: boolean;\n /**\n * Internal boolean used to not attach events used only by native-stack. It prevents non native-stack navigators from sending transition progress from their Screen components.\n */\n isNativeStack?: boolean;\n /**\n * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * When `enableFreeze()` is run at the top of the application defaults to `true`.\n */\n freezeOnBlur?: boolean;\n /**\n * Boolean indicating whether the swipe gesture should work on whole screen. Swiping with this option results in the same transition animation as `simple_push` by default.\n * It can be changed to other custom animations with `customAnimationOnSwipe` prop, but default iOS swipe animation is not achievable due to usage of custom recognizer.\n * Defaults to `false`.\n *\n * @platform ios\n */\n fullScreenSwipeEnabled?: boolean;\n /**\n * Whether you can use gestures to dismiss this screen. Defaults to `true`.\n *\n * @platform ios\n */\n gestureEnabled?: boolean;\n /**\n * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`.\n *\n * @platform ios\n */\n gestureResponseDistance?: GestureResponseDistanceType;\n /**\n * Whether the home indicator should be hidden on this screen. Defaults to `false`.\n *\n * @platform ios\n */\n homeIndicatorHidden?: boolean;\n /**\n * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.\n *\n * @platform ios\n */\n hideKeyboardOnSwipe?: boolean;\n /**\n * 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.\n * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.\n * Defaults to `false`.\n *\n * @platform android\n */\n nativeBackButtonDismissalEnabled?: boolean;\n /**\n * Sets the navigation bar color. Defaults to initial status bar color.\n *\n * @platform android\n */\n navigationBarColor?: string;\n /**\n * Sets the visibility of the navigation bar. Defaults to `false`.\n *\n * @platform android\n */\n navigationBarHidden?: boolean;\n /**\n * A callback that gets called when the current screen appears.\n */\n onAppear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n onComponentRef?: (view: unknown) => void;\n /**\n * A callback that gets called when the current screen disappears.\n */\n onDisappear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n /**\n * A callback that gets called when the current screen is dismissed by hardware back (on Android) or dismiss gesture (swipe back or down).\n * The callback takes the number of dismissed screens as an argument since iOS 14 native header back button can pop more than 1 screen at a time.\n */\n onDismissed?: (e: NativeSyntheticEvent<{ dismissCount: number }>) => void;\n /**\n * An internal callback that gets called when the native header back button is clicked on Android and `enableNativeBackButtonDismissal` is set to `false`. It dismises the screen using `navigation.pop()`.\n *\n * @platform android\n */\n onHeaderBackButtonClicked?: () => void;\n /**\n * An internal callback called when screen is dismissed by gesture or by native header back button and `preventNativeDismiss` is set to `true`.\n *\n * @platform ios\n */\n onNativeDismissCancelled?: (\n e: NativeSyntheticEvent<{ dismissCount: number }>\n ) => void;\n /**\n * An internal callback called every frame during the transition of screens of `native-stack`, used to feed transition context.\n */\n onTransitionProgress?: (\n e: NativeSyntheticEvent<TransitionProgressEventType>\n ) => void;\n /**\n * A callback that gets called when the current screen will appear. This is called as soon as the transition begins.\n */\n onWillAppear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n /**\n * A callback that gets called when the current screen will disappear. This is called as soon as the transition begins.\n */\n onWillDisappear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n /**\n * Boolean indicating whether to prevent current screen from being dismissed.\n * Defaults to `false`.\n *\n * @platform ios\n */\n preventNativeDismiss?: boolean;\n ref?: React.Ref<View>;\n /**\n * How should the screen replacing another screen animate. Defaults to `pop`.\n * The following values are currently supported:\n * - \"push\" – the new screen will perform push animation.\n * - \"pop\" – the new screen will perform pop animation.\n */\n replaceAnimation?: ScreenReplaceTypes;\n /**\n * In which orientation should the screen appear.\n * The following values are currently supported:\n * - \"default\" - resolves to \"all\" without \"portrait_down\" on iOS. On Android, this lets the system decide the best orientation.\n * - \"all\" – all orientations are permitted\n * - \"portrait\" – portrait orientations are permitted\n * - \"portrait_up\" – right-side portrait orientation is permitted\n * - \"portrait_down\" – upside-down portrait orientation is permitted\n * - \"landscape\" – landscape orientations are permitted\n * - \"landscape_left\" – landscape-left orientation is permitted\n * - \"landscape_right\" – landscape-right orientation is permitted\n */\n screenOrientation?: ScreenOrientationTypes;\n /**\n * How the screen should appear/disappear when pushed or popped at the top of the stack.\n * The following values are currently supported:\n * - \"default\" – uses a platform default animation\n * - \"fade\" – fades screen in or out\n * - \"fade_from_bottom\" – performs a fade from bottom animation\n * - \"flip\" – flips the screen, requires stackPresentation: \"modal\" (iOS only)\n * - \"simple_push\" – performs a default animation, but without shadow and native header transition (iOS only)\n * - `slide_from_bottom` – performs a slide from bottom animation\n * - \"slide_from_right\" - slide in the new screen from right to left (Android only, resolves to default transition on iOS)\n * - \"slide_from_left\" - slide in the new screen from left to right (Android only, resolves to default transition on iOS)\n * - \"none\" – the screen appears/dissapears without an animation\n */\n stackAnimation?: StackAnimationTypes;\n /**\n * How should the screen be presented.\n * The following values are currently supported:\n * - \"push\" – the new screen will be pushed onto a stack which on iOS means that the default animation will be slide from the side, the animation on Android may vary depending on the OS version and theme.\n * - \"modal\" – the new screen will be presented modally. In addition this allow for a nested stack to be rendered inside such screens.\n * - \"transparentModal\" – the new screen will be presented modally but in addition the second to last screen will remain attached to the stack container such that if the top screen is non opaque the content below can still be seen. If \"modal\" is used instead the below screen will get unmounted as soon as the transition ends.\n * - \"containedModal\" – will use \"UIModalPresentationCurrentContext\" modal style on iOS and will fallback to \"modal\" on Android.\n * - \"containedTransparentModal\" – will use \"UIModalPresentationOverCurrentContext\" modal style on iOS and will fallback to \"transparentModal\" on Android.\n * - \"fullScreenModal\" – will use \"UIModalPresentationFullScreen\" modal style on iOS and will fallback to \"modal\" on Android.\n * - \"formSheet\" – will use \"UIModalPresentationFormSheet\" modal style on iOS and will fallback to \"modal\" on Android.\n */\n stackPresentation?: StackPresentationTypes;\n /**\n * Sets the status bar animation (similar to the `StatusBar` component). Requires enabling (or deleting) `View controller-based status bar appearance` in your Info.plist file on iOS.\n */\n statusBarAnimation?: 'none' | 'fade' | 'slide';\n /**\n * Sets the status bar color (similar to the `StatusBar` component). Defaults to initial status bar color.\n *\n * @platform android\n */\n statusBarColor?: string;\n /**\n * Whether the status bar should be hidden on this screen. Requires enabling (or deleting) `View controller-based status bar appearance` in your Info.plist file on iOS. Defaults to `false`.\n */\n statusBarHidden?: boolean;\n /**\n * Sets the status bar color (similar to the `StatusBar` component). Requires enabling (or deleting) `View controller-based status bar appearance` in your Info.plist file on iOS. Defaults to `auto`.\n */\n statusBarStyle?: 'inverted' | 'auto' | 'light' | 'dark';\n /**\n * Sets the translucency of the status bar. Defaults to `false`.\n *\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Sets the direction in which you should swipe to dismiss the screen.\n * When using `vertical` option, options `fullScreenSwipeEnabled: true`, `customAnimationOnSwipe: true` and `stackAnimation: 'slide_from_bottom'` are set by default.\n * The following values are supported:\n * - `vertical` – dismiss screen vertically\n * - `horizontal` – dismiss screen horizontally (default)\n *\n * @platform ios\n */\n swipeDirection?: SwipeDirectionTypes;\n /**\n * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `350`.\n * The duration of `default` and `flip` transitions isn't customizable.\n *\n * @platform ios\n */\n transitionDuration?: number;\n}\n\nexport interface ScreenContainerProps extends ViewProps {\n children?: React.ReactNode;\n /**\n * A prop that gives users an option to switch between using Screens for the navigator (container). All children screens should have the same value of their \"enabled\" prop as their container.\n */\n enabled?: boolean;\n /**\n * A prop to be used in navigators always showing only one screen (providing only `0` or `2` `activityState` values) for better implementation of `ScreenContainer` on iOS.\n */\n hasTwoStates?: boolean;\n}\n\nexport interface ScreenStackProps extends ViewProps {\n children?: React.ReactNode;\n /**\n * A callback that gets called when the current screen finishes its transition.\n */\n onFinishTransitioning?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n}\n\nexport interface ScreenStackHeaderConfigProps extends ViewProps {\n /**\n * Whether to show the back button with custom left side of the header.\n */\n backButtonInCustomView?: boolean;\n /**\n * Controls the color of the navigation header.\n */\n backgroundColor?: string;\n /**\n * Title to display in the back button.\n * @platform ios.\n */\n backTitle?: string;\n /**\n * Allows for customizing font family to be used for back button title on iOS.\n * @platform ios\n */\n backTitleFontFamily?: string;\n /**\n * Allows for customizing font size to be used for back button title on iOS.\n * @platform ios\n */\n backTitleFontSize?: number;\n /**\n * Blur effect to be applied to the header. Works with backgroundColor's alpha < 1.\n * @platform ios\n */\n blurEffect?: BlurEffectTypes;\n /**\n * Pass HeaderLeft, HeaderRight and HeaderTitle\n */\n children?: React.ReactNode;\n /**\n * Controls the color of items rendered on the header. This includes back icon, back text (iOS only) and title text. If you want the title to have different color use titleColor property.\n */\n color?: string;\n /**\n * Whether the stack should be in rtl or ltr form.\n */\n direction?: 'rtl' | 'ltr';\n /**\n * Boolean indicating whether to show the menu on longPress of iOS >= 14 back button.\n * @platform ios\n */\n disableBackButtonMenu?: boolean;\n /**\n * When set to true the header will be hidden while the parent Screen is on the top of the stack. The default value is false.\n */\n hidden?: boolean;\n /**\n * Boolean indicating whether to hide the back button in header.\n */\n hideBackButton?: boolean;\n /**\n * Boolean indicating whether to hide the elevation shadow or the bottom border on the header.\n */\n hideShadow?: boolean;\n /**\n * Boolean to set native property to prefer large title header (like in iOS setting).\n * For large title to collapse on scroll, the content of the screen should be wrapped in a scrollable view such as `ScrollView` or `FlatList`.\n * If the scrollable area doesn't fill the screen, the large title won't collapse on scroll.\n * Only supported on iOS.\n *\n * @platform ios\n */\n largeTitle?: boolean;\n /**\n * Controls the color of the navigation header when the edge of any scrollable content reaches the matching edge of the navigation bar.\n */\n largeTitleBackgroundColor?: string;\n /**\n * Customize the color to be used for the large title. By default uses the titleColor property.\n * @platform ios\n */\n largeTitleColor?: string;\n /**\n * Customize font family to be used for the large title.\n * @platform ios\n */\n largeTitleFontFamily?: string;\n /**\n * Customize the size of the font to be used for the large title.\n * @platform ios\n */\n largeTitleFontSize?: number;\n /**\n * Customize the weight of the font to be used for the large title.\n * @platform ios\n */\n largeTitleFontWeight?: string;\n /**\n * Boolean that allows for disabling drop shadow under navigation header when the edge of any scrollable content reaches the matching edge of the navigation bar.\n */\n largeTitleHideShadow?: boolean;\n /**\n * Callback which is executed when screen header is attached\n */\n onAttached?: () => void;\n /**\n * Callback which is executed when screen header is detached\n */\n onDetached?: () => void;\n /**\n * String that can be displayed in the header as a fallback for `headerTitle`.\n */\n title?: string;\n /**\n * Allows for setting text color of the title.\n */\n titleColor?: string;\n /**\n * Customize font family to be used for the title.\n */\n titleFontFamily?: string;\n /**\n * Customize the size of the font to be used for the title.\n */\n titleFontSize?: number;\n /**\n * Customize the weight of the font to be used for the title.\n */\n titleFontWeight?: string;\n /**\n * A flag to that lets you opt out of insetting the header. You may want to\n * set this to `false` if you use an opaque status bar. Defaults to `true`.\n * Only supported on Android. Insets are always applied on iOS because the\n * header cannot be opaque.\n *\n * @platform android\n */\n topInsetEnabled?: boolean;\n /**\n * Boolean indicating whether the navigation bar is translucent.\n */\n translucent?: boolean;\n}\n\nexport interface SearchBarProps {\n /**\n * The auto-capitalization behavior\n */\n autoCapitalize?: 'none' | 'words' | 'sentences' | 'characters';\n /**\n * Automatically focuses search bar on mount\n *\n * @platform android\n */\n autoFocus?: boolean;\n /**\n * The search field background color\n */\n barTintColor?: string;\n /**\n * The color for the cursor caret and cancel button text.\n *\n * @platform ios\n */\n tintColor?: string;\n /**\n * The text to be used instead of default `Cancel` button text\n *\n * @platform ios\n */\n cancelButtonText?: string;\n /**\n * Specifies whether the back button should close search bar's text input or not.\n *\n * @platform android\n */\n disableBackButtonOverride?: boolean;\n /**\n * Indicates whether to hide the navigation bar\n *\n * @platform ios\n */\n hideNavigationBar?: boolean;\n /**\n * Indicates whether to hide the search bar when scrolling\n *\n * @platform ios\n */\n hideWhenScrolling?: boolean;\n\n /**\n * Sets type of the input. Defaults to `text`.\n *\n * @platform android\n */\n inputType?: 'text' | 'phone' | 'number' | 'email';\n /**\n * Indicates whether to to obscure the underlying content\n */\n obscureBackground?: boolean;\n /**\n * A callback that gets called when search bar has lost focus\n */\n onBlur?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n /**\n * A callback that gets called when the cancel button is pressed\n *\n * @platform ios\n */\n onCancelButtonPress?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n\n /**\n * A callback that gets called when the text changes. It receives the current text value of the search bar.\n */\n onChangeText?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;\n\n /**\n * A callback that gets called when search bar is closed\n *\n * @platform android\n */\n onClose?: () => void;\n /**\n * A callback that gets called when search bar has received focus\n */\n onFocus?: (e: NativeSyntheticEvent<TargetedEvent>) => void;\n /**\n * A callback that gets called when search bar is opened\n *\n * @platform android\n */\n onOpen?: () => void;\n /**\n * A callback that gets called when the search button is pressed. It receives the current text value of the search bar.\n */\n onSearchButtonPress?: (\n e: NativeSyntheticEvent<TextInputFocusEventData>\n ) => void;\n /**\n * Text displayed when search field is empty\n */\n placeholder?: string;\n /**\n * The search field text color\n */\n textColor?: string;\n /**\n * The search hint text color\n *\n * @plaform android\n */\n hintTextColor?: string;\n /**\n * The search and close icon color shown in the header\n *\n * @plaform android\n */\n headerIconColor?: string;\n /**\n * Show the search hint icon when search bar is focused\n *\n * @plaform android\n * @default true\n */\n shouldShowHintSearchIcon?: boolean;\n}\n"],"mappings":""}
|
|
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useTransitionProgress;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _TransitionProgressContext = _interopRequireDefault(require("./TransitionProgressContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
12
|
function useTransitionProgress() {
|
|
19
13
|
const progress = React.useContext(_TransitionProgressContext.default);
|
|
20
|
-
|
|
21
14
|
if (progress === undefined) {
|
|
22
15
|
throw new Error("Couldn't find values for transition progress. Are you inside a screen in Native Stack?");
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
return progress;
|
|
26
18
|
}
|
|
27
19
|
//# sourceMappingURL=useTransitionProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useTransitionProgress","progress","React","useContext","TransitionProgressContext","undefined","Error"],"sources":["useTransitionProgress.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport TransitionProgressContext from './TransitionProgressContext';\n\nexport default function useTransitionProgress() {\n const progress = React.useContext(TransitionProgressContext);\n\n if (progress === undefined) {\n throw new Error(\n \"Couldn't find values for transition progress. Are you inside a screen in Native Stack?\"\n );\n }\n\n return progress;\n}\n"],"mappings":";;;;;;AAAA;AAEA;AAAoE;AAAA;AAAA;AAErD,SAASA,qBAAqB,GAAG;EAC9C,MAAMC,QAAQ,GAAGC,KAAK,CAACC,UAAU,CAACC,kCAAyB,CAAC;EAE5D,IAAIH,QAAQ,KAAKI,SAAS,EAAE;IAC1B,MAAM,IAAIC,KAAK,CACb,wFAAwF,CACzF;EACH;EAEA,OAAOL,QAAQ;AACjB"}
|
package/lib/commonjs/utils.js
CHANGED
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.executeNativeBackPress = executeNativeBackPress;
|
|
7
7
|
exports.isSearchBarAvailableForCurrentPlatform = void 0;
|
|
8
|
-
|
|
9
8
|
var _reactNative = require("react-native");
|
|
10
|
-
|
|
11
9
|
const isSearchBarAvailableForCurrentPlatform = ['ios', 'android'].includes(_reactNative.Platform.OS);
|
|
12
10
|
exports.isSearchBarAvailableForCurrentPlatform = isSearchBarAvailableForCurrentPlatform;
|
|
13
|
-
|
|
14
11
|
function executeNativeBackPress() {
|
|
15
12
|
// This function invokes the native back press event
|
|
16
13
|
_reactNative.BackHandler.exitApp();
|
|
17
|
-
|
|
18
14
|
return true;
|
|
19
15
|
}
|
|
20
16
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["isSearchBarAvailableForCurrentPlatform","includes","Platform","OS","executeNativeBackPress","BackHandler","exitApp"],"sources":["utils.ts"],"sourcesContent":["import { BackHandler, Platform } from 'react-native';\n\nexport const isSearchBarAvailableForCurrentPlatform = [\n 'ios',\n 'android',\n].includes(Platform.OS);\n\nexport function executeNativeBackPress() {\n // This function invokes the native back press event\n BackHandler.exitApp();\n return true;\n}\n"],"mappings":";;;;;;;AAAA;AAEO,MAAMA,sCAAsC,GAAG,CACpD,KAAK,EACL,SAAS,CACV,CAACC,QAAQ,CAACC,qBAAQ,CAACC,EAAE,CAAC;AAAC;AAEjB,SAASC,sBAAsB,GAAG;EACvC;EACAC,wBAAW,CAACC,OAAO,EAAE;EACrB,OAAO,IAAI;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","createContext","undefined"],"sources":["TransitionProgressContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Animated } from 'react-native';\n\ntype TransitionProgressContextBody = {\n progress: Animated.Value;\n closing: Animated.Value;\n goingForward: Animated.Value;\n};\n\nexport default React.createContext<TransitionProgressContextBody | undefined>(\n undefined\n);\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAS9B,4BAAeA,KAAK,CAACC,aAAa,CAChCC,SAAS,CACV"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Platform, StyleSheet } from 'react-native';
|
|
5
4
|
import { ScreenContext, ScreenStack, ScreenStackHeaderBackButtonImage, ScreenStackHeaderCenterView, ScreenStackHeaderConfig, ScreenStackHeaderLeftView, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView, SearchBar } from 'react-native-screens';
|
|
@@ -8,15 +7,12 @@ import { HeaderBackButton } from 'react-navigation-stack';
|
|
|
8
7
|
const REMOVE_ACTION = 'NativeStackNavigator/REMOVE';
|
|
9
8
|
const isAndroid = Platform.OS === 'android';
|
|
10
9
|
let didWarn = isAndroid;
|
|
11
|
-
|
|
12
10
|
function renderComponentOrThunk(componentOrThunk, props) {
|
|
13
11
|
if (typeof componentOrThunk === 'function') {
|
|
14
12
|
return componentOrThunk(props);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return componentOrThunk;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
function removeScene(route, dismissCount, navigation) {
|
|
21
17
|
navigation.dispatch({
|
|
22
18
|
// @ts-ignore special navigation action for native stack
|
|
@@ -26,23 +22,19 @@ function removeScene(route, dismissCount, navigation) {
|
|
|
26
22
|
dismissCount
|
|
27
23
|
});
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
function onAppear(route, descriptor, navigation) {
|
|
31
26
|
var _descriptor$options, _descriptor$options$o;
|
|
32
|
-
|
|
33
27
|
(_descriptor$options = descriptor.options) === null || _descriptor$options === void 0 ? void 0 : (_descriptor$options$o = _descriptor$options.onAppear) === null || _descriptor$options$o === void 0 ? void 0 : _descriptor$options$o.call(_descriptor$options);
|
|
34
28
|
navigation.dispatch(StackActions.completeTransition({
|
|
35
29
|
toChildKey: route.key,
|
|
36
30
|
key: navigation.state.key
|
|
37
31
|
}));
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
function onFinishTransitioning(navigation) {
|
|
41
34
|
const {
|
|
42
35
|
routes
|
|
43
36
|
} = navigation.state;
|
|
44
37
|
const lastRoute = (routes === null || routes === void 0 ? void 0 : routes.length) && routes[routes.length - 1];
|
|
45
|
-
|
|
46
38
|
if (lastRoute) {
|
|
47
39
|
navigation.dispatch(StackActions.completeTransition({
|
|
48
40
|
toChildKey: lastRoute.key,
|
|
@@ -50,7 +42,6 @@ function onFinishTransitioning(navigation) {
|
|
|
50
42
|
}));
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
|
-
|
|
54
45
|
function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
55
46
|
const {
|
|
56
47
|
options
|
|
@@ -116,31 +107,25 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
116
107
|
translucent: headerTranslucent || translucent || false
|
|
117
108
|
};
|
|
118
109
|
const hasHeader = headerShown !== false && headerMode !== 'none' && options.header !== null;
|
|
119
|
-
|
|
120
110
|
if (!hasHeader) {
|
|
121
111
|
return /*#__PURE__*/React.createElement(ScreenStackHeaderConfig, _extends({}, headerOptions, {
|
|
122
112
|
hidden: true
|
|
123
113
|
}));
|
|
124
114
|
}
|
|
125
|
-
|
|
126
115
|
if (headerStyle !== undefined) {
|
|
127
116
|
headerOptions.backgroundColor = headerStyle.backgroundColor;
|
|
128
117
|
headerOptions.blurEffect = headerStyle.blurEffect;
|
|
129
118
|
}
|
|
130
|
-
|
|
131
119
|
const children = [];
|
|
132
|
-
|
|
133
120
|
if (options.backButtonImage) {
|
|
134
121
|
children.push( /*#__PURE__*/React.createElement(ScreenStackHeaderBackButtonImage, {
|
|
135
122
|
key: "backImage",
|
|
136
123
|
source: options.backButtonImage
|
|
137
124
|
}));
|
|
138
125
|
}
|
|
139
|
-
|
|
140
126
|
if (Platform.OS === 'ios' && options.searchBar) {
|
|
141
127
|
children.push( /*#__PURE__*/React.createElement(ScreenStackHeaderSearchBarView, null, /*#__PURE__*/React.createElement(SearchBar, options.searchBar)));
|
|
142
128
|
}
|
|
143
|
-
|
|
144
129
|
if (options.headerLeft !== undefined) {
|
|
145
130
|
children.push( /*#__PURE__*/React.createElement(ScreenStackHeaderLeftView, {
|
|
146
131
|
key: "left"
|
|
@@ -154,7 +139,6 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
154
139
|
descriptor.navigation.goBack(descriptor.key);
|
|
155
140
|
});
|
|
156
141
|
};
|
|
157
|
-
|
|
158
142
|
children.push( /*#__PURE__*/React.createElement(ScreenStackHeaderLeftView, {
|
|
159
143
|
key: "left"
|
|
160
144
|
}, /*#__PURE__*/React.createElement(HeaderBackButton, {
|
|
@@ -166,7 +150,8 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
166
150
|
truncatedLabel: options.truncatedBackButtonTitle,
|
|
167
151
|
labelVisible: options.backTitleVisible,
|
|
168
152
|
labelStyle: options.headerBackTitleStyle,
|
|
169
|
-
titleLayout: options.layoutPreset
|
|
153
|
+
titleLayout: options.layoutPreset
|
|
154
|
+
// @ts-ignore old props kept for very old version of `react-navigation-stack`
|
|
170
155
|
,
|
|
171
156
|
title: options.backButtonTitle,
|
|
172
157
|
truncatedTitle: options.truncatedBackButtonTitle,
|
|
@@ -176,7 +161,6 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
176
161
|
scene: scene
|
|
177
162
|
})));
|
|
178
163
|
}
|
|
179
|
-
|
|
180
164
|
if (options.headerTitle) {
|
|
181
165
|
if (title === undefined && typeof options.headerTitle === 'string') {
|
|
182
166
|
headerOptions.title = options.headerTitle;
|
|
@@ -188,7 +172,6 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
188
172
|
})));
|
|
189
173
|
}
|
|
190
174
|
}
|
|
191
|
-
|
|
192
175
|
if (options.headerRight) {
|
|
193
176
|
children.push( /*#__PURE__*/React.createElement(ScreenStackHeaderRightView, {
|
|
194
177
|
key: "right"
|
|
@@ -196,26 +179,23 @@ function renderHeaderConfig(index, route, descriptor, navigationConfig) {
|
|
|
196
179
|
scene
|
|
197
180
|
})));
|
|
198
181
|
}
|
|
199
|
-
|
|
200
182
|
if (children.length > 0) {
|
|
201
183
|
headerOptions.children = children;
|
|
202
184
|
}
|
|
203
|
-
|
|
204
185
|
return /*#__PURE__*/React.createElement(ScreenStackHeaderConfig, headerOptions);
|
|
205
186
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
187
|
+
const MaybeNestedStack = _ref => {
|
|
188
|
+
let {
|
|
189
|
+
isHeaderInModal,
|
|
190
|
+
screenProps,
|
|
191
|
+
route,
|
|
192
|
+
navigation,
|
|
193
|
+
SceneComponent,
|
|
194
|
+
index,
|
|
195
|
+
descriptor,
|
|
196
|
+
navigationConfig
|
|
197
|
+
} = _ref;
|
|
217
198
|
const Screen = React.useContext(ScreenContext);
|
|
218
|
-
|
|
219
199
|
if (isHeaderInModal) {
|
|
220
200
|
return /*#__PURE__*/React.createElement(ScreenStack, {
|
|
221
201
|
style: styles.scenes
|
|
@@ -229,20 +209,19 @@ const MaybeNestedStack = ({
|
|
|
229
209
|
component: SceneComponent
|
|
230
210
|
})));
|
|
231
211
|
}
|
|
232
|
-
|
|
233
212
|
return /*#__PURE__*/React.createElement(SceneView, {
|
|
234
213
|
screenProps: screenProps,
|
|
235
214
|
navigation: navigation,
|
|
236
215
|
component: SceneComponent
|
|
237
216
|
});
|
|
238
217
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
218
|
+
function StackView(_ref2) {
|
|
219
|
+
let {
|
|
220
|
+
navigation,
|
|
221
|
+
descriptors,
|
|
222
|
+
navigationConfig,
|
|
223
|
+
screenProps
|
|
224
|
+
} = _ref2;
|
|
246
225
|
const {
|
|
247
226
|
routes
|
|
248
227
|
} = navigation.state;
|
|
@@ -263,33 +242,26 @@ function StackView({
|
|
|
263
242
|
} = navigationConfig;
|
|
264
243
|
const SceneComponent = getComponent();
|
|
265
244
|
let stackPresentation = 'push';
|
|
266
|
-
|
|
267
245
|
if (options.stackPresentation) {
|
|
268
246
|
stackPresentation = options.stackPresentation;
|
|
269
247
|
} else {
|
|
270
248
|
// this shouldn't be used because we have a prop for that
|
|
271
249
|
if (mode === 'modal' || mode === 'containedModal') {
|
|
272
250
|
stackPresentation = mode;
|
|
273
|
-
|
|
274
251
|
if (transparentCard || options.cardTransparent) {
|
|
275
252
|
stackPresentation = mode === 'containedModal' ? 'containedTransparentModal' : 'transparentModal';
|
|
276
253
|
}
|
|
277
254
|
}
|
|
278
255
|
}
|
|
279
|
-
|
|
280
256
|
let stackAnimation = options.stackAnimation;
|
|
281
|
-
|
|
282
257
|
if (options.animationEnabled === false) {
|
|
283
258
|
stackAnimation = 'none';
|
|
284
259
|
}
|
|
285
|
-
|
|
286
260
|
const hasHeader = options.headerShown !== false && (navigationConfig === null || navigationConfig === void 0 ? void 0 : navigationConfig.headerMode) !== 'none' && options.header !== null;
|
|
287
|
-
|
|
288
261
|
if (!didWarn && stackPresentation !== 'push' && options.headerShown !== undefined) {
|
|
289
262
|
didWarn = true;
|
|
290
263
|
console.warn('Be aware that changing the visibility of header in modal on iOS will result in resetting the state of the screen.');
|
|
291
264
|
}
|
|
292
|
-
|
|
293
265
|
const isHeaderInModal = isAndroid ? false : stackPresentation !== 'push' && hasHeader && options.headerShown === true;
|
|
294
266
|
const isHeaderInPush = isAndroid ? hasHeader : stackPresentation === 'push' && hasHeader;
|
|
295
267
|
return /*#__PURE__*/React.createElement(Screen, {
|
|
@@ -314,17 +286,14 @@ function StackView({
|
|
|
314
286
|
onAppear: () => onAppear(route, descriptor, routeNavigationProp),
|
|
315
287
|
onWillAppear: () => {
|
|
316
288
|
var _options$onWillAppear;
|
|
317
|
-
|
|
318
289
|
return options === null || options === void 0 ? void 0 : (_options$onWillAppear = options.onWillAppear) === null || _options$onWillAppear === void 0 ? void 0 : _options$onWillAppear.call(options);
|
|
319
290
|
},
|
|
320
291
|
onWillDisappear: () => {
|
|
321
292
|
var _options$onWillDisapp;
|
|
322
|
-
|
|
323
293
|
return options === null || options === void 0 ? void 0 : (_options$onWillDisapp = options.onWillDisappear) === null || _options$onWillDisapp === void 0 ? void 0 : _options$onWillDisapp.call(options);
|
|
324
294
|
},
|
|
325
295
|
onDisappear: () => {
|
|
326
296
|
var _options$onDisappear;
|
|
327
|
-
|
|
328
297
|
return options === null || options === void 0 ? void 0 : (_options$onDisappear = options.onDisappear) === null || _options$onDisappear === void 0 ? void 0 : _options$onDisappear.call(options);
|
|
329
298
|
},
|
|
330
299
|
onHeaderBackButtonClicked: () => removeScene(route, 1, routeNavigationProp),
|
|
@@ -341,24 +310,23 @@ function StackView({
|
|
|
341
310
|
}));
|
|
342
311
|
}));
|
|
343
312
|
}
|
|
344
|
-
|
|
345
313
|
const styles = StyleSheet.create({
|
|
346
314
|
scenes: {
|
|
347
315
|
flex: 1
|
|
348
316
|
}
|
|
349
317
|
});
|
|
318
|
+
function createStackNavigator(routeConfigMap) {
|
|
319
|
+
let stackConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
320
|
+
const router = StackRouter(routeConfigMap, stackConfig);
|
|
350
321
|
|
|
351
|
-
|
|
352
|
-
const router = StackRouter(routeConfigMap, stackConfig); // below we override getStateForAction method in order to add handling for
|
|
322
|
+
// below we override getStateForAction method in order to add handling for
|
|
353
323
|
// a custom native stack navigation action. The action REMOVE that we want to
|
|
354
324
|
// add works in a similar way to POP, but it does not remove all the routes
|
|
355
325
|
// that sit on top of the removed route. For example if we have three routes
|
|
356
326
|
// [a,b,c] and call POP on b, then both b and c will go away. In case we
|
|
357
327
|
// call REMOVE on b, only b will be removed from the stack and the resulting
|
|
358
328
|
// state will be [a, c]
|
|
359
|
-
|
|
360
329
|
const superGetStateForAction = router.getStateForAction;
|
|
361
|
-
|
|
362
330
|
router.getStateForAction = (action, state) => {
|
|
363
331
|
if (action.type === REMOVE_ACTION) {
|
|
364
332
|
const {
|
|
@@ -367,15 +335,12 @@ function createStackNavigator(routeConfigMap, stackConfig = {}) {
|
|
|
367
335
|
dismissCount
|
|
368
336
|
} = action;
|
|
369
337
|
let backRouteIndex = state.index;
|
|
370
|
-
|
|
371
338
|
if (key) {
|
|
372
339
|
const backRoute = state.routes.find(route => route.key === key);
|
|
373
340
|
backRouteIndex = state.routes.indexOf(backRoute);
|
|
374
341
|
}
|
|
375
|
-
|
|
376
342
|
if (backRouteIndex > 0) {
|
|
377
343
|
const newRoutes = [...state.routes];
|
|
378
|
-
|
|
379
344
|
if (dismissCount > 1) {
|
|
380
345
|
// when dismissing with iOS 14 native header back button, we can pop more than 1 screen at a time
|
|
381
346
|
// and the `backRouteIndex` is the index of the previous screen. Since we are starting already
|
|
@@ -384,21 +349,18 @@ function createStackNavigator(routeConfigMap, stackConfig = {}) {
|
|
|
384
349
|
} else {
|
|
385
350
|
newRoutes.splice(backRouteIndex, 1);
|
|
386
351
|
}
|
|
387
|
-
|
|
388
|
-
|
|
352
|
+
return {
|
|
353
|
+
...state,
|
|
389
354
|
routes: newRoutes,
|
|
390
355
|
index: newRoutes.length - 1,
|
|
391
356
|
isTransitioning: immediate !== true
|
|
392
357
|
};
|
|
393
358
|
}
|
|
394
359
|
}
|
|
395
|
-
|
|
396
360
|
return superGetStateForAction(action, state);
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
|
|
361
|
+
};
|
|
362
|
+
// Create a navigator with StackView as the view
|
|
400
363
|
return createNavigator(StackView, router, stackConfig);
|
|
401
364
|
}
|
|
402
|
-
|
|
403
365
|
export default createStackNavigator;
|
|
404
366
|
//# sourceMappingURL=createNativeStackNavigator.js.map
|