react-native-screens 3.18.1 → 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/react-native.config.js +12 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import {\n DefaultNavigatorOptions,\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n StackNavigationState,\n StackRouterOptions,\n StackActionHelpers,\n RouteProp,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';\nimport {\n ScreenProps,\n ScreenStackHeaderConfigProps,\n SearchBarProps,\n} from 'react-native-screens';\n\nexport type NativeStackNavigationEventMap = {\n /**\n * Event which fires when the screen appears.\n *\n * @deprecated Use `transitionEnd` event with `data.closing: false` instead.\n */\n appear: { data: undefined };\n /**\n * Event which fires when the current screen is dismissed by hardware back (on Android) or dismiss gesture (swipe back or down).\n */\n dismiss: { data: undefined };\n /**\n * Event which fires when a transition animation starts.\n */\n transitionStart: { data: { closing: boolean } };\n /**\n * Event which fires when a transition animation ends.\n */\n transitionEnd: { data: { closing: boolean } };\n};\n\nexport type NativeStackNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = string\n> = NavigationProp<\n ParamList,\n RouteName,\n StackNavigationState<ParamList>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n> &\n StackActionHelpers<ParamList>;\n\nexport type NativeStackScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = string\n> = {\n navigation: NativeStackNavigationProp<ParamList, RouteName>;\n route: RouteProp<ParamList, RouteName>;\n};\n\nexport type NativeStackNavigationHelpers = NavigationHelpers<\n ParamListBase,\n NativeStackNavigationEventMap\n>;\n\n// We want it to be an empty object beacuse navigator does not have any additional config\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NativeStackNavigationConfig = {};\n\nexport type NativeStackNavigationOptions = {\n /**\n * Image to display in the header as the back button.\n * Defaults to back icon image for the platform (a chevron on iOS and an arrow on Android).\n */\n backButtonImage?: ImageSourcePropType;\n /**\n * Whether to show the back button with custom left side of the header.\n */\n backButtonInCustomView?: boolean;\n /**\n * Style object for the scene content.\n */\n contentStyle?: StyleProp<ViewStyle>;\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 * 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 * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * Defaults to `true` when `enableFreeze()` is run at the top of the application.\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 * Only supported on iOS.\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?: ScreenProps['gestureResponseDistance'];\n /**\n * Title to display in the back button.\n * Only supported on iOS.\n *\n * @platform ios\n */\n headerBackTitle?: string;\n /**\n * Style object for header back title. Supported properties:\n * - fontFamily\n * - fontSize\n *\n * Only supported on iOS.\n *\n * @platform ios\n */\n headerBackTitleStyle?: {\n fontFamily?: string;\n fontSize?: number;\n };\n /**\n * Whether the back button title should be visible or not. Defaults to `true`.\n * Only supported on iOS.\n *\n * @platform ios\n */\n headerBackTitleVisible?: boolean;\n /**\n * Function which returns a React Element to display in the center of the header.\n */\n headerCenter?: (props: { tintColor?: string }) => React.ReactNode;\n /**\n * Boolean indicating whether to hide the back button in header.\n */\n headerHideBackButton?: boolean;\n /**\n * Boolean indicating whether to hide the elevation shadow or the bottom border on the header.\n */\n headerHideShadow?: boolean;\n /**\n * Controls the style of the navigation header when the edge of any scrollable content reaches the matching edge of the navigation bar. Supported properties:\n * - backgroundColor\n *\n * @platform ios\n */\n headerLargeStyle?: {\n backgroundColor?: string;\n };\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 headerLargeTitle?: boolean;\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 headerLargeTitleHideShadow?: boolean;\n /**\n * Style object for header large title. Supported properties:\n * - fontFamily\n * - fontSize\n * - color\n *\n * Only supported on iOS.\n *\n * @platform ios\n */\n headerLargeTitleStyle?: {\n fontFamily?: string;\n fontSize?: number;\n fontWeight?: string;\n color?: string;\n };\n /**\n * Function which returns a React Element to display on the left side of the header.\n */\n headerLeft?: (props: { tintColor?: string }) => React.ReactNode;\n /**\n * Function which returns a React Element to display on the right side of the header.\n */\n headerRight?: (props: { tintColor?: string }) => React.ReactNode;\n /**\n * Whether to show the header.\n */\n headerShown?: boolean;\n /**\n * Style object for header title. Supported properties:\n * - backgroundColor\n * - blurEffect\n */\n headerStyle?: {\n backgroundColor?: string;\n blurEffect?: ScreenStackHeaderConfigProps['blurEffect'];\n };\n /**\n * Tint color for the header. Changes the color of back button and title.\n */\n headerTintColor?: string;\n /**\n * String to display in the header as title. Defaults to scene `title`.\n */\n headerTitle?: string;\n /**\n * Style object for header title. Supported properties:\n * - fontFamily\n * - fontSize\n * - fontWeight\n * - color\n */\n headerTitleStyle?: {\n fontFamily?: string;\n fontSize?: number;\n fontWeight?: string;\n color?: string;\n };\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 headerTopInsetEnabled?: boolean;\n /**\n * Boolean indicating whether the navigation bar is translucent.\n */\n headerTranslucent?: boolean;\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 * 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?: ScreenProps['replaceAnimation'];\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?: ScreenProps['screenOrientation'];\n /**\n * Object in which you should pass props in order to render native iOS searchBar.\n */\n searchBar?: SearchBarProps;\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?: ScreenProps['stackAnimation'];\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?: ScreenProps['stackPresentation'];\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?: ScreenProps['statusBarAnimation'];\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?: ScreenProps['statusBarStyle'];\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 * @platform ios\n */\n swipeDirection?: ScreenProps['swipeDirection'];\n /**\n * String that can be displayed in the header as a fallback for `headerTitle`.\n */\n title?: string;\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 type NativeStackNavigatorProps =\n DefaultNavigatorOptions<NativeStackNavigationOptions> &\n StackRouterOptions &\n NativeStackNavigationConfig;\n\nexport type NativeStackDescriptor = Descriptor<\n ParamListBase,\n string,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationOptions\n>;\n\nexport type NativeStackDescriptorMap = {\n [key: string]: NativeStackDescriptor;\n};\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","HeaderHeightContext","createContext","undefined"],"sources":["HeaderHeightContext.tsx"],"sourcesContent":["import * as React from 'react';\n\nconst HeaderHeightContext = React.createContext<number | undefined>(undefined);\n\nexport default HeaderHeightContext;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,MAAMC,mBAAmB,gBAAGD,KAAK,CAACE,aAAa,CAAqBC,SAAS,CAAC;AAE9E,eAAeF,mBAAmB"}
|
|
@@ -6,10 +6,11 @@ import { initialWindowMetrics, SafeAreaInsetsContext, SafeAreaProvider } from 'r
|
|
|
6
6
|
const {
|
|
7
7
|
width = 0,
|
|
8
8
|
height = 0
|
|
9
|
-
} = Dimensions.get('window');
|
|
9
|
+
} = Dimensions.get('window');
|
|
10
|
+
|
|
11
|
+
// To support SSR on web, we need to have empty insets for initial values
|
|
10
12
|
// Otherwise there can be mismatch between SSR and client output
|
|
11
13
|
// We also need to specify empty values to support tests environments
|
|
12
|
-
|
|
13
14
|
const initialMetrics = Platform.OS === 'web' || initialWindowMetrics == null ? {
|
|
14
15
|
frame: {
|
|
15
16
|
x: 0,
|
|
@@ -24,10 +25,11 @@ const initialMetrics = Platform.OS === 'web' || initialWindowMetrics == null ? {
|
|
|
24
25
|
bottom: 0
|
|
25
26
|
}
|
|
26
27
|
} : initialWindowMetrics;
|
|
27
|
-
export default function SafeAreaProviderCompat({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
export default function SafeAreaProviderCompat(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
children,
|
|
31
|
+
style
|
|
32
|
+
} = _ref;
|
|
31
33
|
return /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, insets => {
|
|
32
34
|
if (insets) {
|
|
33
35
|
// If we already have insets, don't wrap the stack in another safe area provider
|
|
@@ -37,7 +39,6 @@ export default function SafeAreaProviderCompat({
|
|
|
37
39
|
style: [styles.container, style]
|
|
38
40
|
}, children);
|
|
39
41
|
}
|
|
40
|
-
|
|
41
42
|
return /*#__PURE__*/React.createElement(SafeAreaProvider, {
|
|
42
43
|
initialMetrics: initialMetrics,
|
|
43
44
|
style: style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Dimensions","Platform","StyleSheet","View","initialWindowMetrics","SafeAreaInsetsContext","SafeAreaProvider","width","height","get","initialMetrics","OS","frame","x","y","insets","top","left","right","bottom","SafeAreaProviderCompat","children","style","styles","container","create","flex"],"sources":["SafeAreaProviderCompat.tsx"],"sourcesContent":["// code taken from\n// https://github.com/react-navigation/react-navigation/blob/ec0d113eb25c39ef9defb6c7215640f44e3569ae/packages/elements/src/SafeAreaProviderCompat.tsx\nimport * as React from 'react';\nimport {\n Dimensions,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport {\n initialWindowMetrics,\n SafeAreaInsetsContext,\n SafeAreaProvider,\n} from 'react-native-safe-area-context';\n\ntype Props = {\n children: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n};\n\nconst { width = 0, height = 0 } = Dimensions.get('window');\n\n// To support SSR on web, we need to have empty insets for initial values\n// Otherwise there can be mismatch between SSR and client output\n// We also need to specify empty values to support tests environments\nconst initialMetrics =\n Platform.OS === 'web' || initialWindowMetrics == null\n ? {\n frame: { x: 0, y: 0, width, height },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : initialWindowMetrics;\n\nexport default function SafeAreaProviderCompat({ children, style }: Props) {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) => {\n if (insets) {\n // If we already have insets, don't wrap the stack in another safe area provider\n // This avoids an issue with updates at the cost of potentially incorrect values\n // https://github.com/react-navigation/react-navigation/issues/174\n return <View style={[styles.container, style]}>{children}</View>;\n }\n\n return (\n <SafeAreaProvider initialMetrics={initialMetrics} style={style}>\n {children}\n </SafeAreaProvider>\n );\n }}\n </SafeAreaInsetsContext.Consumer>\n );\n}\n\nSafeAreaProviderCompat.initialMetrics = initialMetrics;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":"AAAA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,UAAU,EACVC,QAAQ,EAERC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,gBAAgB,QACX,gCAAgC;AAOvC,MAAM;EAAEC,KAAK,GAAG,CAAC;EAAEC,MAAM,GAAG;AAAE,CAAC,GAAGR,UAAU,CAACS,GAAG,CAAC,QAAQ,CAAC;;AAE1D;AACA;AACA;AACA,MAAMC,cAAc,GAClBT,QAAQ,CAACU,EAAE,KAAK,KAAK,IAAIP,oBAAoB,IAAI,IAAI,GACjD;EACEQ,KAAK,EAAE;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEP,KAAK;IAAEC;EAAO,CAAC;EACpCO,MAAM,EAAE;IAAEC,GAAG,EAAE,CAAC;IAAEC,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE;AACjD,CAAC,GACDf,oBAAoB;AAE1B,eAAe,SAASgB,sBAAsB,OAA6B;EAAA,IAA5B;IAAEC,QAAQ;IAAEC;EAAa,CAAC;EACvE,oBACE,oBAAC,qBAAqB,CAAC,QAAQ,QAC3BP,MAAM,IAAK;IACX,IAAIA,MAAM,EAAE;MACV;MACA;MACA;MACA,oBAAO,oBAAC,IAAI;QAAC,KAAK,EAAE,CAACQ,MAAM,CAACC,SAAS,EAAEF,KAAK;MAAE,GAAED,QAAQ,CAAQ;IAClE;IAEA,oBACE,oBAAC,gBAAgB;MAAC,cAAc,EAAEX,cAAe;MAAC,KAAK,EAAEY;IAAM,GAC5DD,QAAQ,CACQ;EAEvB,CAAC,CAC8B;AAErC;AAEAD,sBAAsB,CAACV,cAAc,GAAGA,cAAc;AAEtD,MAAMa,MAAM,GAAGrB,UAAU,CAACuB,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,IAAI,EAAE;EACR;AACF,CAAC,CAAC"}
|
|
@@ -4,16 +4,13 @@ export default function getDefaultHeaderHeight(layout, topInset, stackPresentati
|
|
|
4
4
|
// default header heights
|
|
5
5
|
let headerHeight = Platform.OS === 'android' ? 56 : 64;
|
|
6
6
|
let statusBarHeight = topInset;
|
|
7
|
-
|
|
8
7
|
if (Platform.OS === 'ios') {
|
|
9
8
|
const isLandscape = layout.width > layout.height;
|
|
10
9
|
const isFromSheetModal = stackPresentation === 'modal' || stackPresentation === 'formSheet';
|
|
11
|
-
|
|
12
10
|
if (isFromSheetModal && !isLandscape) {
|
|
13
11
|
// `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.
|
|
14
12
|
statusBarHeight = 0;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
if (Platform.isPad || Platform.isTV) {
|
|
18
15
|
headerHeight = isFromSheetModal ? formSheetModalHeight : 50;
|
|
19
16
|
} else {
|
|
@@ -24,7 +21,6 @@ export default function getDefaultHeaderHeight(layout, topInset, stackPresentati
|
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return headerHeight + statusBarHeight;
|
|
29
25
|
}
|
|
30
26
|
//# sourceMappingURL=getDefaultHeaderHeight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Platform","formSheetModalHeight","getDefaultHeaderHeight","layout","topInset","stackPresentation","headerHeight","OS","statusBarHeight","isLandscape","width","height","isFromSheetModal","isPad","isTV"],"sources":["getDefaultHeaderHeight.tsx"],"sourcesContent":["import { Platform } from 'react-native';\nimport { StackPresentationTypes } from 'react-native-screens';\ntype Layout = { width: number; height: number };\n\nconst formSheetModalHeight = 56;\n\nexport default function getDefaultHeaderHeight(\n layout: Layout,\n topInset: number,\n stackPresentation: StackPresentationTypes\n): number {\n // default header heights\n let headerHeight = Platform.OS === 'android' ? 56 : 64;\n let statusBarHeight = topInset;\n\n if (Platform.OS === 'ios') {\n const isLandscape = layout.width > layout.height;\n const isFromSheetModal =\n stackPresentation === 'modal' || stackPresentation === 'formSheet';\n if (isFromSheetModal && !isLandscape) {\n // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.\n statusBarHeight = 0;\n }\n\n if (Platform.isPad || Platform.isTV) {\n headerHeight = isFromSheetModal ? formSheetModalHeight : 50;\n } else {\n if (isLandscape) {\n headerHeight = 32;\n } else {\n headerHeight = isFromSheetModal ? formSheetModalHeight : 44;\n }\n }\n }\n\n return headerHeight + statusBarHeight;\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAIvC,MAAMC,oBAAoB,GAAG,EAAE;AAE/B,eAAe,SAASC,sBAAsB,CAC5CC,MAAc,EACdC,QAAgB,EAChBC,iBAAyC,EACjC;EACR;EACA,IAAIC,YAAY,GAAGN,QAAQ,CAACO,EAAE,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE;EACtD,IAAIC,eAAe,GAAGJ,QAAQ;EAE9B,IAAIJ,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;IACzB,MAAME,WAAW,GAAGN,MAAM,CAACO,KAAK,GAAGP,MAAM,CAACQ,MAAM;IAChD,MAAMC,gBAAgB,GACpBP,iBAAiB,KAAK,OAAO,IAAIA,iBAAiB,KAAK,WAAW;IACpE,IAAIO,gBAAgB,IAAI,CAACH,WAAW,EAAE;MACpC;MACAD,eAAe,GAAG,CAAC;IACrB;IAEA,IAAIR,QAAQ,CAACa,KAAK,IAAIb,QAAQ,CAACc,IAAI,EAAE;MACnCR,YAAY,GAAGM,gBAAgB,GAAGX,oBAAoB,GAAG,EAAE;IAC7D,CAAC,MAAM;MACL,IAAIQ,WAAW,EAAE;QACfH,YAAY,GAAG,EAAE;MACnB,CAAC,MAAM;QACLA,YAAY,GAAGM,gBAAgB,GAAGX,oBAAoB,GAAG,EAAE;MAC7D;IACF;EACF;EAEA,OAAOK,YAAY,GAAGE,eAAe;AACvC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BackHandler } from 'react-native';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* This hook is an abstraction for keeping back press subscription
|
|
6
5
|
* logic in one place.
|
|
7
6
|
*/
|
|
8
|
-
export function useBackPressSubscription({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export function useBackPressSubscription(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
onBackPress,
|
|
10
|
+
isDisabled
|
|
11
|
+
} = _ref;
|
|
12
12
|
const [isActive, setIsActive] = React.useState(false);
|
|
13
13
|
const subscription = React.useRef();
|
|
14
|
-
const clearSubscription = React.useCallback((
|
|
14
|
+
const clearSubscription = React.useCallback(function () {
|
|
15
15
|
var _subscription$current;
|
|
16
|
-
|
|
16
|
+
let shouldSetActive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
17
17
|
(_subscription$current = subscription.current) === null || _subscription$current === void 0 ? void 0 : _subscription$current.remove();
|
|
18
18
|
subscription.current = undefined;
|
|
19
19
|
if (shouldSetActive) setIsActive(false);
|
|
@@ -21,7 +21,6 @@ export function useBackPressSubscription({
|
|
|
21
21
|
const createSubscription = React.useCallback(() => {
|
|
22
22
|
if (!isDisabled) {
|
|
23
23
|
var _subscription$current2;
|
|
24
|
-
|
|
25
24
|
(_subscription$current2 = subscription.current) === null || _subscription$current2 === void 0 ? void 0 : _subscription$current2.remove();
|
|
26
25
|
subscription.current = BackHandler.addEventListener('hardwareBackPress', onBackPress);
|
|
27
26
|
setIsActive(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","BackHandler","useBackPressSubscription","onBackPress","isDisabled","isActive","setIsActive","useState","subscription","useRef","clearSubscription","useCallback","shouldSetActive","current","remove","undefined","createSubscription","addEventListener","handleAttached","handleDetached","useEffect"],"sources":["useBackPressSubscription.tsx"],"sourcesContent":["import React from 'react';\nimport { BackHandler, NativeEventSubscription } from 'react-native';\n\ninterface Args {\n onBackPress: () => boolean;\n isDisabled: boolean;\n}\n\ninterface UseBackPressSubscription {\n handleAttached: () => void;\n handleDetached: () => void;\n createSubscription: () => void;\n clearSubscription: () => void;\n}\n\n/**\n * This hook is an abstraction for keeping back press subscription\n * logic in one place.\n */\nexport function useBackPressSubscription({\n onBackPress,\n isDisabled,\n}: Args): UseBackPressSubscription {\n const [isActive, setIsActive] = React.useState(false);\n const subscription = React.useRef<NativeEventSubscription | undefined>();\n\n const clearSubscription = React.useCallback((shouldSetActive = true) => {\n subscription.current?.remove();\n subscription.current = undefined;\n if (shouldSetActive) setIsActive(false);\n }, []);\n\n const createSubscription = React.useCallback(() => {\n if (!isDisabled) {\n subscription.current?.remove();\n subscription.current = BackHandler.addEventListener(\n 'hardwareBackPress',\n onBackPress\n );\n setIsActive(true);\n }\n }, [isDisabled, onBackPress]);\n\n const handleAttached = React.useCallback(() => {\n if (isActive) {\n createSubscription();\n }\n }, [createSubscription, isActive]);\n\n const handleDetached = React.useCallback(() => {\n clearSubscription(false);\n }, [clearSubscription]);\n\n React.useEffect(() => {\n if (isDisabled) {\n clearSubscription();\n }\n }, [isDisabled, clearSubscription]);\n\n return {\n handleAttached,\n handleDetached,\n createSubscription,\n clearSubscription,\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAiC,cAAc;AAcnE;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwB,OAGL;EAAA,IAHM;IACvCC,WAAW;IACXC;EACI,CAAC;EACL,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAMC,YAAY,GAAGR,KAAK,CAACS,MAAM,EAAuC;EAExE,MAAMC,iBAAiB,GAAGV,KAAK,CAACW,WAAW,CAAC,YAA4B;IAAA;IAAA,IAA3BC,eAAe,uEAAG,IAAI;IACjE,yBAAAJ,YAAY,CAACK,OAAO,0DAApB,sBAAsBC,MAAM,EAAE;IAC9BN,YAAY,CAACK,OAAO,GAAGE,SAAS;IAChC,IAAIH,eAAe,EAAEN,WAAW,CAAC,KAAK,CAAC;EACzC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMU,kBAAkB,GAAGhB,KAAK,CAACW,WAAW,CAAC,MAAM;IACjD,IAAI,CAACP,UAAU,EAAE;MAAA;MACf,0BAAAI,YAAY,CAACK,OAAO,2DAApB,uBAAsBC,MAAM,EAAE;MAC9BN,YAAY,CAACK,OAAO,GAAGZ,WAAW,CAACgB,gBAAgB,CACjD,mBAAmB,EACnBd,WAAW,CACZ;MACDG,WAAW,CAAC,IAAI,CAAC;IACnB;EACF,CAAC,EAAE,CAACF,UAAU,EAAED,WAAW,CAAC,CAAC;EAE7B,MAAMe,cAAc,GAAGlB,KAAK,CAACW,WAAW,CAAC,MAAM;IAC7C,IAAIN,QAAQ,EAAE;MACZW,kBAAkB,EAAE;IACtB;EACF,CAAC,EAAE,CAACA,kBAAkB,EAAEX,QAAQ,CAAC,CAAC;EAElC,MAAMc,cAAc,GAAGnB,KAAK,CAACW,WAAW,CAAC,MAAM;IAC7CD,iBAAiB,CAAC,KAAK,CAAC;EAC1B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvBV,KAAK,CAACoB,SAAS,CAAC,MAAM;IACpB,IAAIhB,UAAU,EAAE;MACdM,iBAAiB,EAAE;IACrB;EACF,CAAC,EAAE,CAACN,UAAU,EAAEM,iBAAiB,CAAC,CAAC;EAEnC,OAAO;IACLQ,cAAc;IACdC,cAAc;IACdH,kBAAkB;IAClBN;EACF,CAAC;AACH"}
|
|
@@ -2,11 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import HeaderHeightContext from './HeaderHeightContext';
|
|
3
3
|
export default function useHeaderHeight() {
|
|
4
4
|
const height = React.useContext(HeaderHeightContext);
|
|
5
|
-
|
|
6
5
|
if (height === undefined) {
|
|
7
6
|
throw new Error("Couldn't find the header height. Are you inside a screen in a navigator with a header?");
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
return height;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=useHeaderHeight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","HeaderHeightContext","useHeaderHeight","height","useContext","undefined","Error"],"sources":["useHeaderHeight.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport HeaderHeightContext from './HeaderHeightContext';\n\nexport default function useHeaderHeight() {\n const height = React.useContext(HeaderHeightContext);\n\n if (height === undefined) {\n throw new Error(\n \"Couldn't find the header height. Are you inside a screen in a navigator with a header?\"\n );\n }\n\n return height;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,mBAAmB,MAAM,uBAAuB;AAEvD,eAAe,SAASC,eAAe,GAAG;EACxC,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAU,CAACH,mBAAmB,CAAC;EAEpD,IAAIE,MAAM,KAAKE,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CACb,wFAAwF,CACzF;EACH;EAEA,OAAOH,MAAM;AACf"}
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
3
3
|
export function processFonts(fontFamilies) {
|
|
4
4
|
var _ReactNativeStyleAttr;
|
|
5
|
-
|
|
6
5
|
// @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
|
|
7
6
|
const fontFamilyProcessor = (_ReactNativeStyleAttr = ReactNativeStyleAttributes.fontFamily) === null || _ReactNativeStyleAttr === void 0 ? void 0 : _ReactNativeStyleAttr.process;
|
|
8
|
-
|
|
9
7
|
if (typeof fontFamilyProcessor === 'function') {
|
|
10
8
|
return fontFamilies.map(fontFamilyProcessor);
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
return fontFamilies;
|
|
14
11
|
}
|
|
15
12
|
//# sourceMappingURL=FontProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["ReactNativeStyleAttributes","processFonts","fontFamilies","fontFamilyProcessor","fontFamily","process","map"],"sources":["FontProcessor.tsx"],"sourcesContent":["// @ts-ignore: No declaration available\nimport ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';\n\nexport function processFonts(\n fontFamilies: (string | undefined)[]\n): (string | undefined)[] {\n // @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value\n const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;\n if (typeof fontFamilyProcessor === 'function') {\n return fontFamilies.map(fontFamilyProcessor);\n }\n return fontFamilies;\n}\n"],"mappings":"AAAA;AACA,OAAOA,0BAA0B,MAAM,mEAAmE;AAE1G,OAAO,SAASC,YAAY,CAC1BC,YAAoC,EACZ;EAAA;EACxB;EACA,MAAMC,mBAAmB,4BAAGH,0BAA0B,CAACI,UAAU,0DAArC,sBAAuCC,OAAO;EAC1E,IAAI,OAAOF,mBAAmB,KAAK,UAAU,EAAE;IAC7C,OAAOD,YAAY,CAACI,GAAG,CAACH,mBAAmB,CAAC;EAC9C;EACA,OAAOD,YAAY;AACrB"}
|
|
@@ -4,41 +4,43 @@ import { Platform } from 'react-native';
|
|
|
4
4
|
import { ScreenStackHeaderBackButtonImage, ScreenStackHeaderCenterView, ScreenStackHeaderConfig, ScreenStackHeaderLeftView, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView, SearchBar, isSearchBarAvailableForCurrentPlatform, executeNativeBackPress } from 'react-native-screens';
|
|
5
5
|
import { useBackPressSubscription } from '../utils/useBackPressSubscription';
|
|
6
6
|
import { processFonts } from './FontProcessor';
|
|
7
|
-
export default function HeaderConfig({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
export default function HeaderConfig(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
backButtonImage,
|
|
10
|
+
backButtonInCustomView,
|
|
11
|
+
direction,
|
|
12
|
+
disableBackButtonMenu,
|
|
13
|
+
headerBackTitle,
|
|
14
|
+
headerBackTitleStyle = {},
|
|
15
|
+
headerBackTitleVisible = true,
|
|
16
|
+
headerCenter,
|
|
17
|
+
headerHideBackButton,
|
|
18
|
+
headerHideShadow,
|
|
19
|
+
headerLargeStyle = {},
|
|
20
|
+
headerLargeTitle,
|
|
21
|
+
headerLargeTitleHideShadow,
|
|
22
|
+
headerLargeTitleStyle = {},
|
|
23
|
+
headerLeft,
|
|
24
|
+
headerRight,
|
|
25
|
+
headerShown,
|
|
26
|
+
headerStyle = {},
|
|
27
|
+
headerTintColor,
|
|
28
|
+
headerTitle,
|
|
29
|
+
headerTitleStyle = {},
|
|
30
|
+
headerTopInsetEnabled = true,
|
|
31
|
+
headerTranslucent,
|
|
32
|
+
route,
|
|
33
|
+
searchBar,
|
|
34
|
+
title
|
|
35
|
+
} = _ref;
|
|
35
36
|
const {
|
|
36
37
|
colors
|
|
37
38
|
} = useTheme();
|
|
38
|
-
const tintColor = headerTintColor !== null && headerTintColor !== void 0 ? headerTintColor : colors.primary;
|
|
39
|
+
const tintColor = headerTintColor !== null && headerTintColor !== void 0 ? headerTintColor : colors.primary;
|
|
40
|
+
|
|
41
|
+
// We need to use back press subscription here to override back button behavior on JS side.
|
|
39
42
|
// Because screens are usually used with react-navigation and this library overrides back button
|
|
40
43
|
// we need to handle it first in case when search bar is open
|
|
41
|
-
|
|
42
44
|
const {
|
|
43
45
|
handleAttached,
|
|
44
46
|
handleDetached,
|
|
@@ -48,31 +50,34 @@ export default function HeaderConfig({
|
|
|
48
50
|
onBackPress: executeNativeBackPress,
|
|
49
51
|
isDisabled: !searchBar || !!searchBar.disableBackButtonOverride
|
|
50
52
|
});
|
|
51
|
-
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = processFonts([headerBackTitleStyle.fontFamily, headerLargeTitleStyle.fontFamily, headerTitleStyle.fontFamily]);
|
|
53
|
+
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = processFonts([headerBackTitleStyle.fontFamily, headerLargeTitleStyle.fontFamily, headerTitleStyle.fontFamily]);
|
|
52
54
|
|
|
55
|
+
// We want to clear clearSubscription only when components unmounts or search bar changes
|
|
53
56
|
React.useEffect(() => clearSubscription, [searchBar]);
|
|
54
57
|
const processedSearchBarOptions = React.useMemo(() => {
|
|
55
58
|
if (Platform.OS === 'android' && searchBar && !searchBar.disableBackButtonOverride) {
|
|
56
|
-
const onFocus = (
|
|
59
|
+
const onFocus = function () {
|
|
57
60
|
var _searchBar$onFocus;
|
|
58
|
-
|
|
59
61
|
createSubscription();
|
|
62
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
|
+
args[_key] = arguments[_key];
|
|
64
|
+
}
|
|
60
65
|
(_searchBar$onFocus = searchBar.onFocus) === null || _searchBar$onFocus === void 0 ? void 0 : _searchBar$onFocus.call(searchBar, ...args);
|
|
61
66
|
};
|
|
62
|
-
|
|
63
|
-
const onClose = (...args) => {
|
|
67
|
+
const onClose = function () {
|
|
64
68
|
var _searchBar$onClose;
|
|
65
|
-
|
|
66
69
|
clearSubscription();
|
|
70
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
71
|
+
args[_key2] = arguments[_key2];
|
|
72
|
+
}
|
|
67
73
|
(_searchBar$onClose = searchBar.onClose) === null || _searchBar$onClose === void 0 ? void 0 : _searchBar$onClose.call(searchBar, ...args);
|
|
68
74
|
};
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
return {
|
|
76
|
+
...searchBar,
|
|
71
77
|
onFocus,
|
|
72
78
|
onClose
|
|
73
79
|
};
|
|
74
80
|
}
|
|
75
|
-
|
|
76
81
|
return searchBar;
|
|
77
82
|
}, [searchBar, createSubscription, clearSubscription]);
|
|
78
83
|
return /*#__PURE__*/React.createElement(ScreenStackHeaderConfig, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["HeaderConfig.tsx"],"names":["useTheme","React","Platform","ScreenStackHeaderBackButtonImage","ScreenStackHeaderCenterView","ScreenStackHeaderConfig","ScreenStackHeaderLeftView","ScreenStackHeaderRightView","ScreenStackHeaderSearchBarView","SearchBar","isSearchBarAvailableForCurrentPlatform","executeNativeBackPress","useBackPressSubscription","processFonts","HeaderConfig","backButtonImage","backButtonInCustomView","direction","disableBackButtonMenu","headerBackTitle","headerBackTitleStyle","headerBackTitleVisible","headerCenter","headerHideBackButton","headerHideShadow","headerLargeStyle","headerLargeTitle","headerLargeTitleHideShadow","headerLargeTitleStyle","headerLeft","headerRight","headerShown","headerStyle","headerTintColor","headerTitle","headerTitleStyle","headerTopInsetEnabled","headerTranslucent","route","searchBar","title","colors","tintColor","primary","handleAttached","handleDetached","clearSubscription","createSubscription","onBackPress","isDisabled","disableBackButtonOverride","backTitleFontFamily","largeTitleFontFamily","titleFontFamily","fontFamily","useEffect","processedSearchBarOptions","useMemo","OS","onFocus","args","onClose","backgroundColor","card","fontSize","blurEffect","color","fontWeight","undefined","name","text"],"mappings":"AAAA,SAAgBA,QAAhB,QAAgC,0BAAhC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SACEC,gCADF,EAEEC,2BAFF,EAGEC,uBAHF,EAIEC,yBAJF,EAKEC,0BALF,EAMEC,8BANF,EAOEC,SAPF,EASEC,sCATF,EAUEC,sBAVF,QAWO,sBAXP;AAaA,SAASC,wBAAT,QAAyC,mCAAzC;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAMA,eAAe,SAASC,YAAT,CAAsB;AACnCC,EAAAA,eADmC;AAEnCC,EAAAA,sBAFmC;AAGnCC,EAAAA,SAHmC;AAInCC,EAAAA,qBAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,oBAAoB,GAAG,EANY;AAOnCC,EAAAA,sBAAsB,GAAG,IAPU;AAQnCC,EAAAA,YARmC;AASnCC,EAAAA,oBATmC;AAUnCC,EAAAA,gBAVmC;AAWnCC,EAAAA,gBAAgB,GAAG,EAXgB;AAYnCC,EAAAA,gBAZmC;AA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AC;AAAEoB,IAAAA;AAAF,GAAD,CADf,CADD,GAIG,IA/DN,EAgEGhC,sCAAsC,IACvC8C,yBAAyB,KAAKY,SAD7B,gBAEC,oBAAC,8BAAD,qBACE,oBAAC,SAAD,EAAeZ,yBAAf,CADF,CAFD,GAKG,IArEN,CADF;AAyED","sourcesContent":["import { Route, useTheme } from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform } from 'react-native';\nimport {\n ScreenStackHeaderBackButtonImage,\n ScreenStackHeaderCenterView,\n ScreenStackHeaderConfig,\n ScreenStackHeaderLeftView,\n ScreenStackHeaderRightView,\n ScreenStackHeaderSearchBarView,\n SearchBar,\n SearchBarProps,\n isSearchBarAvailableForCurrentPlatform,\n executeNativeBackPress,\n} from 'react-native-screens';\nimport { NativeStackNavigationOptions } from '../types';\nimport { useBackPressSubscription } from '../utils/useBackPressSubscription';\nimport { processFonts } from './FontProcessor';\n\ntype Props = NativeStackNavigationOptions & {\n route: Route<string>;\n};\n\nexport default function HeaderConfig({\n backButtonImage,\n backButtonInCustomView,\n direction,\n disableBackButtonMenu,\n headerBackTitle,\n headerBackTitleStyle = {},\n headerBackTitleVisible = true,\n headerCenter,\n headerHideBackButton,\n headerHideShadow,\n headerLargeStyle = {},\n headerLargeTitle,\n headerLargeTitleHideShadow,\n headerLargeTitleStyle = {},\n headerLeft,\n headerRight,\n headerShown,\n headerStyle = {},\n headerTintColor,\n headerTitle,\n headerTitleStyle = {},\n headerTopInsetEnabled = true,\n headerTranslucent,\n route,\n searchBar,\n title,\n}: Props): JSX.Element {\n const { colors } = useTheme();\n const tintColor = headerTintColor ?? colors.primary;\n\n // We need to use back press subscription here to override back button behavior on JS side.\n // Because screens are usually used with react-navigation and this library overrides back button\n // we need to handle it first in case when search bar is open\n const {\n handleAttached,\n handleDetached,\n clearSubscription,\n createSubscription,\n } = useBackPressSubscription({\n onBackPress: executeNativeBackPress,\n isDisabled: !searchBar || !!searchBar.disableBackButtonOverride,\n });\n\n const [\n backTitleFontFamily,\n largeTitleFontFamily,\n titleFontFamily,\n ] = processFonts([\n headerBackTitleStyle.fontFamily,\n headerLargeTitleStyle.fontFamily,\n headerTitleStyle.fontFamily,\n ]);\n\n // We want to clear clearSubscription only when components unmounts or search bar changes\n React.useEffect(() => clearSubscription, [searchBar]);\n\n const processedSearchBarOptions = React.useMemo(() => {\n if (\n Platform.OS === 'android' &&\n searchBar &&\n !searchBar.disableBackButtonOverride\n ) {\n const onFocus: SearchBarProps['onFocus'] = (...args) => {\n createSubscription();\n searchBar.onFocus?.(...args);\n };\n const onClose: SearchBarProps['onClose'] = (...args) => {\n clearSubscription();\n searchBar.onClose?.(...args);\n };\n\n return { ...searchBar, onFocus, onClose };\n }\n return searchBar;\n }, [searchBar, createSubscription, clearSubscription]);\n\n return (\n <ScreenStackHeaderConfig\n backButtonInCustomView={backButtonInCustomView}\n backgroundColor={\n headerStyle.backgroundColor ? headerStyle.backgroundColor : colors.card\n }\n backTitle={headerBackTitleVisible ? headerBackTitle : ' '}\n backTitleFontFamily={backTitleFontFamily}\n backTitleFontSize={headerBackTitleStyle.fontSize}\n blurEffect={headerStyle.blurEffect}\n color={tintColor}\n direction={direction}\n disableBackButtonMenu={disableBackButtonMenu}\n hidden={headerShown === false}\n hideBackButton={headerHideBackButton}\n hideShadow={headerHideShadow}\n largeTitle={headerLargeTitle}\n largeTitleBackgroundColor={headerLargeStyle.backgroundColor}\n largeTitleColor={headerLargeTitleStyle.color}\n largeTitleFontFamily={largeTitleFontFamily}\n largeTitleFontSize={headerLargeTitleStyle.fontSize}\n largeTitleFontWeight={headerLargeTitleStyle.fontWeight}\n largeTitleHideShadow={headerLargeTitleHideShadow}\n title={\n headerTitle !== undefined\n ? headerTitle\n : title !== undefined\n ? title\n : route.name\n }\n titleColor={\n headerTitleStyle.color !== undefined\n ? headerTitleStyle.color\n : headerTintColor !== undefined\n ? headerTintColor\n : colors.text\n }\n titleFontFamily={titleFontFamily}\n titleFontSize={headerTitleStyle.fontSize}\n titleFontWeight={headerTitleStyle.fontWeight}\n topInsetEnabled={headerTopInsetEnabled}\n translucent={headerTranslucent === true}\n onAttached={handleAttached}\n onDetached={handleDetached}>\n {headerRight !== undefined ? (\n <ScreenStackHeaderRightView>\n {headerRight({ tintColor })}\n </ScreenStackHeaderRightView>\n ) : null}\n {backButtonImage !== undefined ? (\n <ScreenStackHeaderBackButtonImage\n key=\"backImage\"\n source={backButtonImage}\n />\n ) : null}\n {headerLeft !== undefined ? (\n <ScreenStackHeaderLeftView>\n {headerLeft({ tintColor })}\n </ScreenStackHeaderLeftView>\n ) : null}\n {headerCenter !== undefined ? (\n <ScreenStackHeaderCenterView>\n {headerCenter({ tintColor })}\n </ScreenStackHeaderCenterView>\n ) : null}\n {isSearchBarAvailableForCurrentPlatform &&\n processedSearchBarOptions !== undefined ? (\n <ScreenStackHeaderSearchBarView>\n <SearchBar {...processedSearchBarOptions} />\n </ScreenStackHeaderSearchBarView>\n ) : null}\n </ScreenStackHeaderConfig>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"names":["useTheme","React","Platform","ScreenStackHeaderBackButtonImage","ScreenStackHeaderCenterView","ScreenStackHeaderConfig","ScreenStackHeaderLeftView","ScreenStackHeaderRightView","ScreenStackHeaderSearchBarView","SearchBar","isSearchBarAvailableForCurrentPlatform","executeNativeBackPress","useBackPressSubscription","processFonts","HeaderConfig","backButtonImage","backButtonInCustomView","direction","disableBackButtonMenu","headerBackTitle","headerBackTitleStyle","headerBackTitleVisible","headerCenter","headerHideBackButton","headerHideShadow","headerLargeStyle","headerLargeTitle","headerLargeTitleHideShadow","headerLargeTitleStyle","headerLeft","headerRight","headerShown","headerStyle","headerTintColor","headerTitle","headerTitleStyle","headerTopInsetEnabled","headerTranslucent","route","searchBar","title","colors","tintColor","primary","handleAttached","handleDetached","clearSubscription","createSubscription","onBackPress","isDisabled","disableBackButtonOverride","backTitleFontFamily","largeTitleFontFamily","titleFontFamily","fontFamily","useEffect","processedSearchBarOptions","useMemo","OS","onFocus","args","onClose","backgroundColor","card","fontSize","blurEffect","color","fontWeight","undefined","name","text"],"sources":["HeaderConfig.tsx"],"sourcesContent":["import { Route, useTheme } from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform } from 'react-native';\nimport {\n ScreenStackHeaderBackButtonImage,\n ScreenStackHeaderCenterView,\n ScreenStackHeaderConfig,\n ScreenStackHeaderLeftView,\n ScreenStackHeaderRightView,\n ScreenStackHeaderSearchBarView,\n SearchBar,\n SearchBarProps,\n isSearchBarAvailableForCurrentPlatform,\n executeNativeBackPress,\n} from 'react-native-screens';\nimport { NativeStackNavigationOptions } from '../types';\nimport { useBackPressSubscription } from '../utils/useBackPressSubscription';\nimport { processFonts } from './FontProcessor';\n\ntype Props = NativeStackNavigationOptions & {\n route: Route<string>;\n};\n\nexport default function HeaderConfig({\n backButtonImage,\n backButtonInCustomView,\n direction,\n disableBackButtonMenu,\n headerBackTitle,\n headerBackTitleStyle = {},\n headerBackTitleVisible = true,\n headerCenter,\n headerHideBackButton,\n headerHideShadow,\n headerLargeStyle = {},\n headerLargeTitle,\n headerLargeTitleHideShadow,\n headerLargeTitleStyle = {},\n headerLeft,\n headerRight,\n headerShown,\n headerStyle = {},\n headerTintColor,\n headerTitle,\n headerTitleStyle = {},\n headerTopInsetEnabled = true,\n headerTranslucent,\n route,\n searchBar,\n title,\n}: Props): JSX.Element {\n const { colors } = useTheme();\n const tintColor = headerTintColor ?? colors.primary;\n\n // We need to use back press subscription here to override back button behavior on JS side.\n // Because screens are usually used with react-navigation and this library overrides back button\n // we need to handle it first in case when search bar is open\n const {\n handleAttached,\n handleDetached,\n clearSubscription,\n createSubscription,\n } = useBackPressSubscription({\n onBackPress: executeNativeBackPress,\n isDisabled: !searchBar || !!searchBar.disableBackButtonOverride,\n });\n\n const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] =\n processFonts([\n headerBackTitleStyle.fontFamily,\n headerLargeTitleStyle.fontFamily,\n headerTitleStyle.fontFamily,\n ]);\n\n // We want to clear clearSubscription only when components unmounts or search bar changes\n React.useEffect(() => clearSubscription, [searchBar]);\n\n const processedSearchBarOptions = React.useMemo(() => {\n if (\n Platform.OS === 'android' &&\n searchBar &&\n !searchBar.disableBackButtonOverride\n ) {\n const onFocus: SearchBarProps['onFocus'] = (...args) => {\n createSubscription();\n searchBar.onFocus?.(...args);\n };\n const onClose: SearchBarProps['onClose'] = (...args) => {\n clearSubscription();\n searchBar.onClose?.(...args);\n };\n\n return { ...searchBar, onFocus, onClose };\n }\n return searchBar;\n }, [searchBar, createSubscription, clearSubscription]);\n\n return (\n <ScreenStackHeaderConfig\n backButtonInCustomView={backButtonInCustomView}\n backgroundColor={\n headerStyle.backgroundColor ? headerStyle.backgroundColor : colors.card\n }\n backTitle={headerBackTitleVisible ? headerBackTitle : ' '}\n backTitleFontFamily={backTitleFontFamily}\n backTitleFontSize={headerBackTitleStyle.fontSize}\n blurEffect={headerStyle.blurEffect}\n color={tintColor}\n direction={direction}\n disableBackButtonMenu={disableBackButtonMenu}\n hidden={headerShown === false}\n hideBackButton={headerHideBackButton}\n hideShadow={headerHideShadow}\n largeTitle={headerLargeTitle}\n largeTitleBackgroundColor={headerLargeStyle.backgroundColor}\n largeTitleColor={headerLargeTitleStyle.color}\n largeTitleFontFamily={largeTitleFontFamily}\n largeTitleFontSize={headerLargeTitleStyle.fontSize}\n largeTitleFontWeight={headerLargeTitleStyle.fontWeight}\n largeTitleHideShadow={headerLargeTitleHideShadow}\n title={\n headerTitle !== undefined\n ? headerTitle\n : title !== undefined\n ? title\n : route.name\n }\n titleColor={\n headerTitleStyle.color !== undefined\n ? headerTitleStyle.color\n : headerTintColor !== undefined\n ? headerTintColor\n : colors.text\n }\n titleFontFamily={titleFontFamily}\n titleFontSize={headerTitleStyle.fontSize}\n titleFontWeight={headerTitleStyle.fontWeight}\n topInsetEnabled={headerTopInsetEnabled}\n translucent={headerTranslucent === true}\n onAttached={handleAttached}\n onDetached={handleDetached}\n >\n {headerRight !== undefined ? (\n <ScreenStackHeaderRightView>\n {headerRight({ tintColor })}\n </ScreenStackHeaderRightView>\n ) : null}\n {backButtonImage !== undefined ? (\n <ScreenStackHeaderBackButtonImage\n key=\"backImage\"\n source={backButtonImage}\n />\n ) : null}\n {headerLeft !== undefined ? (\n <ScreenStackHeaderLeftView>\n {headerLeft({ tintColor })}\n </ScreenStackHeaderLeftView>\n ) : null}\n {headerCenter !== undefined ? (\n <ScreenStackHeaderCenterView>\n {headerCenter({ tintColor })}\n </ScreenStackHeaderCenterView>\n ) : null}\n {isSearchBarAvailableForCurrentPlatform &&\n processedSearchBarOptions !== undefined ? (\n <ScreenStackHeaderSearchBarView>\n <SearchBar {...processedSearchBarOptions} />\n </ScreenStackHeaderSearchBarView>\n ) : null}\n </ScreenStackHeaderConfig>\n );\n}\n"],"mappings":"AAAA,SAAgBA,QAAQ,QAAQ,0BAA0B;AAC1D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AACvC,SACEC,gCAAgC,EAChCC,2BAA2B,EAC3BC,uBAAuB,EACvBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,SAAS,EAETC,sCAAsC,EACtCC,sBAAsB,QACjB,sBAAsB;AAE7B,SAASC,wBAAwB,QAAQ,mCAAmC;AAC5E,SAASC,YAAY,QAAQ,iBAAiB;AAM9C,eAAe,SAASC,YAAY,OA2Bb;EAAA,IA3Bc;IACnCC,eAAe;IACfC,sBAAsB;IACtBC,SAAS;IACTC,qBAAqB;IACrBC,eAAe;IACfC,oBAAoB,GAAG,CAAC,CAAC;IACzBC,sBAAsB,GAAG,IAAI;IAC7BC,YAAY;IACZC,oBAAoB;IACpBC,gBAAgB;IAChBC,gBAAgB,GAAG,CAAC,CAAC;IACrBC,gBAAgB;IAChBC,0BAA0B;IAC1BC,qBAAqB,GAAG,CAAC,CAAC;IAC1BC,UAAU;IACVC,WAAW;IACXC,WAAW;IACXC,WAAW,GAAG,CAAC,CAAC;IA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AK,GACtBjC,eAAe,KAAKmC,SAAS,GAC7BnC,eAAe,GACfQ,MAAM,CAAC6B,IACZ;IACD,eAAe,EAAEjB,eAAgB;IACjC,aAAa,EAAElB,gBAAgB,CAAC6B,QAAS;IACzC,eAAe,EAAE7B,gBAAgB,CAACgC,UAAW;IAC7C,eAAe,EAAE/B,qBAAsB;IACvC,WAAW,EAAEC,iBAAiB,KAAK,IAAK;IACxC,UAAU,EAAEO,cAAe;IAC3B,UAAU,EAAEC;EAAe,GAE1Bf,WAAW,KAAKsC,SAAS,gBACxB,oBAAC,0BAA0B,QACxBtC,WAAW,CAAC;IAAEY;EAAU,CAAC,CAAC,CACA,GAC3B,IAAI,EACP3B,eAAe,KAAKqD,SAAS,gBAC5B,oBAAC,gCAAgC;IAC/B,GAAG,EAAC,WAAW;IACf,MAAM,EAAErD;EAAgB,EACxB,GACA,IAAI,EACPc,UAAU,KAAKuC,SAAS,gBACvB,oBAAC,yBAAyB,QACvBvC,UAAU,CAAC;IAAEa;EAAU,CAAC,CAAC,CACA,GAC1B,IAAI,EACPpB,YAAY,KAAK8C,SAAS,gBACzB,oBAAC,2BAA2B,QACzB9C,YAAY,CAAC;IAAEoB;EAAU,CAAC,CAAC,CACA,GAC5B,IAAI,EACPhC,sCAAsC,IACvC8C,yBAAyB,KAAKY,SAAS,gBACrC,oBAAC,8BAA8B,qBAC7B,oBAAC,SAAS,EAAKZ,yBAAyB,CAAI,CACb,GAC/B,IAAI,CACgB;AAE9B"}
|
|
@@ -1,8 +1,7 @@
|
|
|
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 * as React from 'react';
|
|
4
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
5
|
-
|
|
3
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
4
|
+
// @ts-ignore Getting private component
|
|
6
5
|
import AppContainer from 'react-native/Libraries/ReactNative/AppContainer';
|
|
7
6
|
import warnOnce from 'warn-once';
|
|
8
7
|
import { ScreenStack, ScreenContext } from 'react-native-screens';
|
|
@@ -14,31 +13,27 @@ import getDefaultHeaderHeight from '../utils/getDefaultHeaderHeight';
|
|
|
14
13
|
import HeaderHeightContext from '../utils/HeaderHeightContext';
|
|
15
14
|
const isAndroid = Platform.OS === 'android';
|
|
16
15
|
let Container = View;
|
|
17
|
-
|
|
18
16
|
if (__DEV__) {
|
|
19
17
|
const DebugContainer = props => {
|
|
20
18
|
const {
|
|
21
19
|
stackPresentation,
|
|
22
20
|
...rest
|
|
23
21
|
} = props;
|
|
24
|
-
|
|
25
22
|
if (Platform.OS === 'ios' && stackPresentation !== 'push') {
|
|
26
23
|
return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(View, rest));
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
return /*#__PURE__*/React.createElement(View, rest);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
};
|
|
27
|
+
// @ts-ignore Wrong props
|
|
33
28
|
Container = DebugContainer;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
30
|
+
const MaybeNestedStack = _ref => {
|
|
31
|
+
let {
|
|
32
|
+
options,
|
|
33
|
+
route,
|
|
34
|
+
stackPresentation,
|
|
35
|
+
children
|
|
36
|
+
} = _ref;
|
|
42
37
|
const {
|
|
43
38
|
colors
|
|
44
39
|
} = useTheme();
|
|
@@ -56,14 +51,14 @@ const MaybeNestedStack = ({
|
|
|
56
51
|
const content = /*#__PURE__*/React.createElement(Container, {
|
|
57
52
|
style: [styles.container, stackPresentation !== 'transparentModal' && stackPresentation !== 'containedTransparentModal' && {
|
|
58
53
|
backgroundColor: colors.background
|
|
59
|
-
}, contentStyle]
|
|
54
|
+
}, contentStyle]
|
|
55
|
+
// @ts-ignore Wrong props passed to View
|
|
60
56
|
,
|
|
61
57
|
stackPresentation: stackPresentation
|
|
62
58
|
}, children);
|
|
63
59
|
const topInset = useSafeAreaInsets().top;
|
|
64
60
|
const dimensions = useSafeAreaFrame();
|
|
65
61
|
const headerHeight = getDefaultHeaderHeight(dimensions, topInset, stackPresentation);
|
|
66
|
-
|
|
67
62
|
if (isHeaderInModal) {
|
|
68
63
|
return /*#__PURE__*/React.createElement(ScreenStack, {
|
|
69
64
|
style: styles.container
|
|
@@ -77,17 +72,16 @@ const MaybeNestedStack = ({
|
|
|
77
72
|
route: route
|
|
78
73
|
})), content)));
|
|
79
74
|
}
|
|
80
|
-
|
|
81
75
|
return content;
|
|
82
76
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
77
|
+
const RouteView = _ref2 => {
|
|
78
|
+
let {
|
|
79
|
+
descriptors,
|
|
80
|
+
route,
|
|
81
|
+
index,
|
|
82
|
+
navigation,
|
|
83
|
+
stateKey
|
|
84
|
+
} = _ref2;
|
|
91
85
|
const {
|
|
92
86
|
options,
|
|
93
87
|
render: renderScene
|
|
@@ -118,7 +112,6 @@ const RouteView = ({
|
|
|
118
112
|
stackAnimation,
|
|
119
113
|
stackPresentation = 'push'
|
|
120
114
|
} = options;
|
|
121
|
-
|
|
122
115
|
if (swipeDirection === 'vertical') {
|
|
123
116
|
// for `vertical` direction to work, we need to set `fullScreenSwipeEnabled` to `true`
|
|
124
117
|
// so the screen can be dismissed from any point on screen.
|
|
@@ -128,22 +121,18 @@ const RouteView = ({
|
|
|
128
121
|
if (fullScreenSwipeEnabled === undefined) {
|
|
129
122
|
fullScreenSwipeEnabled = true;
|
|
130
123
|
}
|
|
131
|
-
|
|
132
124
|
if (customAnimationOnSwipe === undefined) {
|
|
133
125
|
customAnimationOnSwipe = true;
|
|
134
126
|
}
|
|
135
|
-
|
|
136
127
|
if (stackAnimation === undefined) {
|
|
137
128
|
stackAnimation = 'slide_from_bottom';
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
|
-
|
|
141
131
|
if (index === 0) {
|
|
142
132
|
// first screen should always be treated as `push`, it resolves problems with no header animation
|
|
143
133
|
// for navigator with first screen as `modal` and the next as `push`
|
|
144
134
|
stackPresentation = 'push';
|
|
145
135
|
}
|
|
146
|
-
|
|
147
136
|
const isHeaderInPush = isAndroid ? headerShown : stackPresentation === 'push' && headerShown !== false;
|
|
148
137
|
const dimensions = useSafeAreaFrame();
|
|
149
138
|
const topInset = useSafeAreaInsets().top;
|
|
@@ -177,7 +166,8 @@ const RouteView = ({
|
|
|
177
166
|
swipeDirection: swipeDirection,
|
|
178
167
|
transitionDuration: transitionDuration,
|
|
179
168
|
onHeaderBackButtonClicked: () => {
|
|
180
|
-
navigation.dispatch({
|
|
169
|
+
navigation.dispatch({
|
|
170
|
+
...StackActions.pop(),
|
|
181
171
|
source: route.key,
|
|
182
172
|
target: stateKey
|
|
183
173
|
});
|
|
@@ -228,7 +218,8 @@ const RouteView = ({
|
|
|
228
218
|
target: route.key
|
|
229
219
|
});
|
|
230
220
|
const dismissCount = e.nativeEvent.dismissCount > 0 ? e.nativeEvent.dismissCount : 1;
|
|
231
|
-
navigation.dispatch({
|
|
221
|
+
navigation.dispatch({
|
|
222
|
+
...StackActions.pop(dismissCount),
|
|
232
223
|
source: route.key,
|
|
233
224
|
target: stateKey
|
|
234
225
|
});
|
|
@@ -244,12 +235,12 @@ const RouteView = ({
|
|
|
244
235
|
stackPresentation: stackPresentation
|
|
245
236
|
}, renderScene())));
|
|
246
237
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
238
|
+
function NativeStackViewInner(_ref3) {
|
|
239
|
+
let {
|
|
240
|
+
state,
|
|
241
|
+
navigation,
|
|
242
|
+
descriptors
|
|
243
|
+
} = _ref3;
|
|
253
244
|
const {
|
|
254
245
|
key,
|
|
255
246
|
routes
|
|
@@ -265,7 +256,6 @@ function NativeStackViewInner({
|
|
|
265
256
|
stateKey: key
|
|
266
257
|
})));
|
|
267
258
|
}
|
|
268
|
-
|
|
269
259
|
export default function NativeStackView(props) {
|
|
270
260
|
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(NativeStackViewInner, props));
|
|
271
261
|
}
|