react-native-screens 3.29.0 → 3.30.1
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 +7 -7
- package/RNScreens.podspec +3 -3
- package/android/CMakeLists.txt +27 -0
- package/android/build.gradle +21 -2
- package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +17 -14
- package/android/src/main/cpp/jni-adapter.cpp +110 -0
- package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +13 -8
- package/android/src/main/java/com/swmansion/rnscreens/FragmentBackPressOverrider.kt +8 -8
- package/android/src/main/java/com/swmansion/rnscreens/ModalScreenViewManager.kt +12 -0
- package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +38 -5
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +32 -42
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +76 -48
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt +38 -35
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +43 -37
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +23 -23
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +73 -71
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +3 -3
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubview.kt +5 -5
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubviewManager.kt +3 -3
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackViewManager.kt +3 -3
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +4 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +13 -16
- package/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt +105 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreensShadowNode.kt +2 -2
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +1 -0
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +14 -10
- package/android/src/main/java/com/swmansion/rnscreens/SearchViewFormatter.kt +8 -8
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderBackButtonClickedEvent.kt +4 -8
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderHeightChangeEvent.kt +3 -3
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenTransitionProgressEvent.kt +9 -13
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +3 -7
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +3 -7
- package/android/src/main/jni/rnscreens.h +1 -0
- package/android/src/main/res/v33/anim-v33/rns_default_enter_in.xml +0 -1
- package/android/src/main/res/v33/anim-v33/rns_default_enter_out.xml +2 -2
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +1 -1
- package/android/src/paper/java/com/swmansion/rnscreens/NativeScreensModuleSpec.java +32 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenComponentDescriptor.h +41 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.cpp +15 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h +31 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +6 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h +1 -5
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.cpp +1 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +8 -3
- package/cpp/RNScreensTurboModule.cpp +107 -0
- package/cpp/RNScreensTurboModule.h +43 -0
- package/gesture-handler/package.json +6 -0
- package/ios/RNSConvert.h +2 -0
- package/ios/RNSConvert.mm +5 -2
- package/ios/RNSEnums.h +1 -0
- package/ios/RNSModalScreen.h +8 -0
- package/ios/RNSModalScreen.mm +36 -0
- package/ios/RNSModule.h +19 -0
- package/ios/RNSModule.mm +174 -0
- package/ios/RNSScreen.h +4 -1
- package/ios/RNSScreen.mm +48 -26
- package/ios/RNSScreenStack.h +6 -0
- package/ios/RNSScreenStack.mm +81 -15
- package/ios/RNSScreenStackAnimator.mm +89 -1
- package/ios/RNSScreenStackHeaderConfig.mm +7 -1
- package/ios/RNSScreenWindowTraits.h +1 -1
- package/ios/RNSScreenWindowTraits.mm +24 -50
- package/ios/RNSSearchBar.mm +24 -0
- package/ios/utils/RNSUIBarButtonItem.h +2 -0
- package/lib/commonjs/TransitionProgressContext.js +3 -4
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/components/FullWindowOverlay.js +28 -0
- package/lib/commonjs/components/FullWindowOverlay.js.map +1 -0
- package/lib/commonjs/components/FullWindowOverlay.web.js +9 -0
- package/lib/commonjs/components/FullWindowOverlay.web.js.map +1 -0
- package/lib/commonjs/components/Screen.js +161 -0
- package/lib/commonjs/components/Screen.js.map +1 -0
- package/lib/commonjs/components/Screen.web.js +46 -0
- package/lib/commonjs/components/Screen.web.js.map +1 -0
- package/lib/commonjs/components/ScreenContainer.js +33 -0
- package/lib/commonjs/components/ScreenContainer.js.map +1 -0
- package/lib/commonjs/components/ScreenContainer.web.js +11 -0
- package/lib/commonjs/components/ScreenContainer.web.js.map +1 -0
- package/lib/commonjs/components/ScreenStack.js +45 -0
- package/lib/commonjs/components/ScreenStack.js.map +1 -0
- package/lib/commonjs/components/ScreenStack.web.js +9 -0
- package/lib/commonjs/components/ScreenStack.web.js.map +1 -0
- package/lib/commonjs/components/ScreenStackHeaderConfig.js +53 -0
- package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -0
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js +27 -0
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js.map +1 -0
- package/lib/commonjs/components/SearchBar.js +59 -0
- package/lib/commonjs/components/SearchBar.js.map +1 -0
- package/lib/commonjs/components/SearchBar.web.js +11 -0
- package/lib/commonjs/components/SearchBar.web.js.map +1 -0
- package/lib/commonjs/components/helpers/DelayedFreeze.js +32 -0
- package/lib/commonjs/components/helpers/DelayedFreeze.js.map +1 -0
- package/lib/commonjs/core.js +41 -0
- package/lib/commonjs/core.js.map +1 -0
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +1 -2
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js +13 -0
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/NativeScreensModule.js +10 -0
- package/lib/commonjs/fabric/NativeScreensModule.js.map +1 -0
- package/lib/commonjs/fabric/NativeScreensModule.web.js +8 -0
- package/lib/commonjs/fabric/NativeScreensModule.web.js.map +1 -0
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +1 -2
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +3 -5
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js +19 -0
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js.map +1 -0
- package/lib/commonjs/gesture-handler/RNScreensTurboModule.js +8 -0
- package/lib/commonjs/gesture-handler/RNScreensTurboModule.js.map +1 -0
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js +202 -0
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js.map +1 -0
- package/lib/commonjs/gesture-handler/constraints.js +64 -0
- package/lib/commonjs/gesture-handler/constraints.js.map +1 -0
- package/lib/commonjs/gesture-handler/defaults.js +38 -0
- package/lib/commonjs/gesture-handler/defaults.js.map +1 -0
- package/lib/commonjs/gesture-handler/fabricUtils.js +30 -0
- package/lib/commonjs/gesture-handler/fabricUtils.js.map +1 -0
- package/lib/commonjs/gesture-handler/fabricUtils.web.js +17 -0
- package/lib/commonjs/gesture-handler/fabricUtils.web.js.map +1 -0
- package/lib/commonjs/gesture-handler/index.js +14 -0
- package/lib/commonjs/gesture-handler/index.js.map +1 -0
- package/lib/commonjs/index.js +183 -100
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-stack/contexts/GHContext.js +11 -0
- package/lib/commonjs/native-stack/contexts/GHContext.js.map +1 -0
- package/lib/commonjs/native-stack/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +20 -24
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/types.js.map +1 -1
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js +3 -4
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js +3 -4
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js +2 -2
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getStatusBarHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js +2 -2
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js +2 -4
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js +2 -2
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/FontProcessor.js +1 -2
- package/lib/commonjs/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +11 -7
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +50 -15
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js +3 -4
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +6 -9
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js +1 -2
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +6 -14
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js +3 -4
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js +2 -2
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js +2 -2
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js +2 -2
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/commonjs/utils.js +2 -4
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/TransitionProgressContext.js.map +1 -1
- package/lib/module/components/FullWindowOverlay.js +21 -0
- package/lib/module/components/FullWindowOverlay.js.map +1 -0
- package/lib/module/components/FullWindowOverlay.web.js +3 -0
- package/lib/module/components/FullWindowOverlay.web.js.map +1 -0
- package/lib/module/components/Screen.js +156 -0
- package/lib/module/components/Screen.js.map +1 -0
- package/lib/module/components/Screen.web.js +38 -0
- package/lib/module/components/Screen.web.js.map +1 -0
- package/lib/module/components/ScreenContainer.js +26 -0
- package/lib/module/components/ScreenContainer.js.map +1 -0
- package/lib/module/components/ScreenContainer.web.js +5 -0
- package/lib/module/components/ScreenContainer.web.js.map +1 -0
- package/lib/module/components/ScreenStack.js +40 -0
- package/lib/module/components/ScreenStack.js.map +1 -0
- package/lib/module/components/ScreenStack.web.js +3 -0
- package/lib/module/components/ScreenStack.web.js.map +1 -0
- package/lib/module/components/ScreenStackHeaderConfig.js +43 -0
- package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -0
- package/lib/module/components/ScreenStackHeaderConfig.web.js +14 -0
- package/lib/module/components/ScreenStackHeaderConfig.web.js.map +1 -0
- package/lib/module/components/SearchBar.js +52 -0
- package/lib/module/components/SearchBar.js.map +1 -0
- package/lib/module/components/SearchBar.web.js +5 -0
- package/lib/module/components/SearchBar.web.js.map +1 -0
- package/lib/module/components/helpers/DelayedFreeze.js +25 -0
- package/lib/module/components/helpers/DelayedFreeze.js.map +1 -0
- package/lib/module/core.js +31 -0
- package/lib/module/core.js.map +1 -0
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js +8 -0
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -0
- package/lib/module/fabric/NativeScreensModule.js +5 -0
- package/lib/module/fabric/NativeScreensModule.js.map +1 -0
- package/lib/module/fabric/NativeScreensModule.web.js +2 -0
- package/lib/module/fabric/NativeScreensModule.web.js.map +1 -0
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/gesture-handler/GestureDetectorProvider.js +12 -0
- package/lib/module/gesture-handler/GestureDetectorProvider.js.map +1 -0
- package/lib/module/gesture-handler/RNScreensTurboModule.js +2 -0
- package/lib/module/gesture-handler/RNScreensTurboModule.js.map +1 -0
- package/lib/module/gesture-handler/ScreenGestureDetector.js +194 -0
- package/lib/module/gesture-handler/ScreenGestureDetector.js.map +1 -0
- package/lib/module/gesture-handler/constraints.js +56 -0
- package/lib/module/gesture-handler/constraints.js.map +1 -0
- package/lib/module/gesture-handler/defaults.js +32 -0
- package/lib/module/gesture-handler/defaults.js.map +1 -0
- package/lib/module/gesture-handler/fabricUtils.js +23 -0
- package/lib/module/gesture-handler/fabricUtils.js.map +1 -0
- package/lib/module/gesture-handler/fabricUtils.web.js +10 -0
- package/lib/module/gesture-handler/fabricUtils.web.js.map +1 -0
- package/lib/module/gesture-handler/index.js +5 -0
- package/lib/module/gesture-handler/index.js.map +1 -0
- package/lib/module/index.js +31 -64
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-stack/contexts/GHContext.js +4 -0
- package/lib/module/native-stack/contexts/GHContext.js.map +1 -0
- package/lib/module/native-stack/index.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +17 -20
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/types.js.map +1 -1
- package/lib/module/native-stack/utils/AnimatedHeaderHeightContext.js.map +1 -1
- package/lib/module/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/utils/getStatusBarHeight.js.map +1 -1
- package/lib/module/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js +2 -4
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/views/FontProcessor.js +1 -2
- package/lib/module/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +8 -5
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +49 -14
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedHeaderHeightContext.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +2 -4
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js +6 -14
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/useReanimatedHeaderHeight.js.map +1 -1
- package/lib/module/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useTransitionProgress.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts +1 -0
- package/lib/typescript/TransitionProgressContext.d.ts.map +1 -0
- package/lib/typescript/components/FullWindowOverlay.d.ts +6 -0
- package/lib/typescript/components/FullWindowOverlay.d.ts.map +1 -0
- package/lib/typescript/components/FullWindowOverlay.web.d.ts +6 -0
- package/lib/typescript/components/FullWindowOverlay.web.d.ts.map +1 -0
- package/lib/typescript/components/Screen.d.ts +20 -0
- package/lib/typescript/components/Screen.d.ts.map +1 -0
- package/lib/typescript/components/Screen.web.d.ts +11 -0
- package/lib/typescript/components/Screen.web.d.ts.map +1 -0
- package/lib/typescript/components/ScreenContainer.d.ts +7 -0
- package/lib/typescript/components/ScreenContainer.d.ts.map +1 -0
- package/lib/typescript/components/ScreenContainer.web.d.ts +5 -0
- package/lib/typescript/components/ScreenContainer.web.d.ts.map +1 -0
- package/lib/typescript/components/ScreenStack.d.ts +5 -0
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -0
- package/lib/typescript/components/ScreenStack.web.d.ts +3 -0
- package/lib/typescript/components/ScreenStack.web.d.ts.map +1 -0
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts +13 -0
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -0
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts +13 -0
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts.map +1 -0
- package/lib/typescript/components/SearchBar.d.ts +26 -0
- package/lib/typescript/components/SearchBar.d.ts.map +1 -0
- package/lib/typescript/components/SearchBar.web.d.ts +5 -0
- package/lib/typescript/components/SearchBar.web.d.ts.map +1 -0
- package/lib/typescript/components/helpers/DelayedFreeze.d.ts +8 -0
- package/lib/typescript/components/helpers/DelayedFreeze.d.ts.map +1 -0
- package/lib/typescript/core.d.ts +7 -0
- package/lib/typescript/core.d.ts.map +1 -0
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +68 -0
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/NativeScreensModule.d.ts +6 -0
- package/lib/typescript/fabric/NativeScreensModule.d.ts.map +1 -0
- package/lib/typescript/fabric/NativeScreensModule.web.d.ts +3 -0
- package/lib/typescript/fabric/NativeScreensModule.web.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +2 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts.map +1 -0
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +3 -1
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/GestureDetectorProvider.d.ts +5 -0
- package/lib/typescript/gesture-handler/GestureDetectorProvider.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/RNScreensTurboModule.d.ts +13 -0
- package/lib/typescript/gesture-handler/RNScreensTurboModule.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/ScreenGestureDetector.d.ts +5 -0
- package/lib/typescript/gesture-handler/ScreenGestureDetector.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/constraints.d.ts +6 -0
- package/lib/typescript/gesture-handler/constraints.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/defaults.d.ts +20 -0
- package/lib/typescript/gesture-handler/defaults.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/fabricUtils.d.ts +8 -0
- package/lib/typescript/gesture-handler/fabricUtils.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/fabricUtils.web.d.ts +6 -0
- package/lib/typescript/gesture-handler/fabricUtils.web.d.ts.map +1 -0
- package/lib/typescript/gesture-handler/index.d.ts +2 -0
- package/lib/typescript/gesture-handler/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +11 -31
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/native-stack/contexts/GHContext.d.ts +4 -0
- package/lib/typescript/native-stack/contexts/GHContext.d.ts.map +1 -0
- package/lib/typescript/native-stack/index.d.ts +1 -0
- package/lib/typescript/native-stack/index.d.ts.map +1 -0
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +1 -0
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -0
- package/lib/typescript/native-stack/types.d.ts +39 -2
- package/lib/typescript/native-stack/types.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/AnimatedHeaderHeightContext.d.ts +1 -0
- package/lib/typescript/native-stack/utils/AnimatedHeaderHeightContext.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/HeaderHeightContext.d.ts +1 -0
- package/lib/typescript/native-stack/utils/HeaderHeightContext.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts +1 -0
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -0
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/getStatusBarHeight.d.ts +1 -0
- package/lib/typescript/native-stack/utils/getStatusBarHeight.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/useAnimatedHeaderHeight.d.ts +1 -0
- package/lib/typescript/native-stack/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/useBackPressSubscription.d.ts +1 -0
- package/lib/typescript/native-stack/utils/useBackPressSubscription.d.ts.map +1 -0
- package/lib/typescript/native-stack/utils/useHeaderHeight.d.ts +1 -0
- package/lib/typescript/native-stack/utils/useHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/native-stack/views/FontProcessor.d.ts +1 -0
- package/lib/typescript/native-stack/views/FontProcessor.d.ts.map +1 -0
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +1 -0
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts.map +1 -0
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -0
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -0
- package/lib/typescript/reanimated/ReanimatedHeaderHeightContext.d.ts +1 -0
- package/lib/typescript/reanimated/ReanimatedHeaderHeightContext.d.ts.map +1 -0
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +2 -2
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts.map +1 -0
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +2 -2
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts.map +1 -0
- package/lib/typescript/reanimated/ReanimatedScreenProvider.d.ts +1 -0
- package/lib/typescript/reanimated/ReanimatedScreenProvider.d.ts.map +1 -0
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts +1 -0
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts.map +1 -0
- package/lib/typescript/reanimated/index.d.ts +1 -0
- package/lib/typescript/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/reanimated/useReanimatedHeaderHeight.d.ts +2 -3
- package/lib/typescript/reanimated/useReanimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/reanimated/useReanimatedTransitionProgress.d.ts +4 -9
- package/lib/typescript/reanimated/useReanimatedTransitionProgress.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +11 -2
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/useTransitionProgress.d.ts +1 -0
- package/lib/typescript/useTransitionProgress.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/native-stack/README.md +2 -1
- package/native-stack/package.json +1 -1
- package/package.json +17 -11
- package/react-native.config.js +2 -1
- package/reanimated/package.json +1 -1
- package/src/components/FullWindowOverlay.tsx +25 -0
- package/src/components/FullWindowOverlay.web.tsx +6 -0
- package/src/components/Screen.tsx +218 -0
- package/src/components/Screen.web.tsx +43 -0
- package/src/components/ScreenContainer.tsx +33 -0
- package/src/components/ScreenContainer.web.tsx +6 -0
- package/src/components/ScreenStack.tsx +41 -0
- package/src/components/ScreenStack.web.tsx +3 -0
- package/src/components/ScreenStackHeaderConfig.tsx +76 -0
- package/src/components/ScreenStackHeaderConfig.web.tsx +39 -0
- package/src/components/SearchBar.tsx +91 -0
- package/src/components/SearchBar.web.tsx +6 -0
- package/src/components/helpers/DelayedFreeze.tsx +27 -0
- package/src/core.ts +43 -0
- package/src/fabric/ModalScreenNativeComponent.ts +104 -0
- package/src/fabric/NativeScreensModule.ts +7 -0
- package/src/fabric/NativeScreensModule.web.ts +1 -0
- package/src/fabric/ScreenNativeComponent.ts +1 -1
- package/src/fabric/SearchBarNativeComponent.ts +2 -0
- package/src/gesture-handler/GestureDetectorProvider.tsx +16 -0
- package/src/gesture-handler/RNScreensTurboModule.ts +13 -0
- package/src/gesture-handler/ScreenGestureDetector.tsx +241 -0
- package/src/gesture-handler/constraints.ts +87 -0
- package/src/gesture-handler/defaults.ts +38 -0
- package/src/gesture-handler/fabricUtils.ts +39 -0
- package/src/gesture-handler/fabricUtils.web.ts +10 -0
- package/src/gesture-handler/index.tsx +4 -0
- package/src/index.tsx +65 -112
- package/src/native-stack/contexts/GHContext.tsx +7 -0
- package/src/native-stack/types.tsx +62 -1
- package/src/native-stack/views/HeaderConfig.tsx +11 -0
- package/src/native-stack/views/NativeStackView.tsx +65 -13
- package/src/types.tsx +13 -1
- package/lib/commonjs/index.native.js +0 -418
- package/lib/commonjs/index.native.js.map +0 -1
- package/lib/module/index.native.js +0 -415
- package/lib/module/index.native.js.map +0 -1
- package/lib/typescript/index.native.d.ts +0 -2
- package/src/index.native.tsx +0 -619
package/src/index.native.tsx
DELETED
|
@@ -1,619 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
import React, { useEffect, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Animated,
|
|
5
|
-
Image,
|
|
6
|
-
ImageProps,
|
|
7
|
-
Platform,
|
|
8
|
-
StyleProp,
|
|
9
|
-
StyleSheet,
|
|
10
|
-
UIManager,
|
|
11
|
-
View,
|
|
12
|
-
ViewProps,
|
|
13
|
-
ViewStyle,
|
|
14
|
-
} from 'react-native';
|
|
15
|
-
import { Freeze } from 'react-freeze';
|
|
16
|
-
import { version } from 'react-native/package.json';
|
|
17
|
-
|
|
18
|
-
import TransitionProgressContext from './TransitionProgressContext';
|
|
19
|
-
import useTransitionProgress from './useTransitionProgress';
|
|
20
|
-
import {
|
|
21
|
-
StackPresentationTypes,
|
|
22
|
-
StackAnimationTypes,
|
|
23
|
-
BlurEffectTypes,
|
|
24
|
-
ScreenReplaceTypes,
|
|
25
|
-
ScreenOrientationTypes,
|
|
26
|
-
HeaderSubviewTypes,
|
|
27
|
-
ScreenProps,
|
|
28
|
-
ScreenContainerProps,
|
|
29
|
-
ScreenStackProps,
|
|
30
|
-
ScreenStackHeaderConfigProps,
|
|
31
|
-
SearchBarProps,
|
|
32
|
-
SearchBarCommands,
|
|
33
|
-
} from './types';
|
|
34
|
-
import {
|
|
35
|
-
isSearchBarAvailableForCurrentPlatform,
|
|
36
|
-
isNewBackTitleImplementation,
|
|
37
|
-
executeNativeBackPress,
|
|
38
|
-
} from './utils';
|
|
39
|
-
|
|
40
|
-
// web implementation is taken from `index.tsx`
|
|
41
|
-
const isPlatformSupported =
|
|
42
|
-
Platform.OS === 'ios' ||
|
|
43
|
-
Platform.OS === 'android' ||
|
|
44
|
-
Platform.OS === 'windows';
|
|
45
|
-
|
|
46
|
-
let ENABLE_SCREENS = isPlatformSupported;
|
|
47
|
-
|
|
48
|
-
function enableScreens(shouldEnableScreens = true): void {
|
|
49
|
-
ENABLE_SCREENS = isPlatformSupported && shouldEnableScreens;
|
|
50
|
-
if (ENABLE_SCREENS && !UIManager.getViewManagerConfig('RNSScreen')) {
|
|
51
|
-
console.error(
|
|
52
|
-
`Screen native module hasn't been linked. Please check the react-native-screens README for more details`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let ENABLE_FREEZE = false;
|
|
58
|
-
|
|
59
|
-
function enableFreeze(shouldEnableReactFreeze = true): void {
|
|
60
|
-
const minor = parseInt(version.split('.')[1]); // eg. takes 66 from '0.66.0'
|
|
61
|
-
|
|
62
|
-
// react-freeze requires react-native >=0.64, react-native from main is 0.0.0
|
|
63
|
-
if (!(minor === 0 || minor >= 64) && shouldEnableReactFreeze) {
|
|
64
|
-
console.warn(
|
|
65
|
-
'react-freeze library requires at least react-native 0.64. Please upgrade your react-native version in order to use this feature.'
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
ENABLE_FREEZE = shouldEnableReactFreeze;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// const that tells if the library should use new implementation, will be undefined for older versions
|
|
73
|
-
const shouldUseActivityState = true;
|
|
74
|
-
|
|
75
|
-
function screensEnabled(): boolean {
|
|
76
|
-
return ENABLE_SCREENS;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
type SearchBarCommandsType = {
|
|
80
|
-
blur: (
|
|
81
|
-
viewRef: React.ElementRef<typeof ScreensNativeModules.NativeSearchBar>
|
|
82
|
-
) => void;
|
|
83
|
-
focus: (
|
|
84
|
-
viewRef: React.ElementRef<typeof ScreensNativeModules.NativeSearchBar>
|
|
85
|
-
) => void;
|
|
86
|
-
clearText: (
|
|
87
|
-
viewRef: React.ElementRef<typeof ScreensNativeModules.NativeSearchBar>
|
|
88
|
-
) => void;
|
|
89
|
-
toggleCancelButton: (
|
|
90
|
-
viewRef: React.ElementRef<typeof ScreensNativeModules.NativeSearchBar>,
|
|
91
|
-
flag: boolean
|
|
92
|
-
) => void;
|
|
93
|
-
setText: (
|
|
94
|
-
viewRef: React.ElementRef<typeof ScreensNativeModules.NativeSearchBar>,
|
|
95
|
-
text: string
|
|
96
|
-
) => void;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// We initialize these lazily so that importing the module doesn't throw error when not linked
|
|
100
|
-
// This is necessary coz libraries such as React Navigation import the library where it may not be enabled
|
|
101
|
-
let NativeScreenValue: React.ComponentType<ScreenProps>;
|
|
102
|
-
let NativeScreenContainerValue: React.ComponentType<ScreenContainerProps>;
|
|
103
|
-
let NativeScreenNavigationContainerValue: React.ComponentType<ScreenContainerProps>;
|
|
104
|
-
let NativeScreenStack: React.ComponentType<ScreenStackProps>;
|
|
105
|
-
let NativeScreenStackHeaderConfig: React.ComponentType<ScreenStackHeaderConfigProps>;
|
|
106
|
-
let NativeScreenStackHeaderSubview: React.ComponentType<
|
|
107
|
-
React.PropsWithChildren<ViewProps & { type?: HeaderSubviewTypes }>
|
|
108
|
-
>;
|
|
109
|
-
let AnimatedNativeScreen: React.ComponentType<ScreenProps>;
|
|
110
|
-
|
|
111
|
-
let NativeSearchBar: React.ComponentType<SearchBarProps> &
|
|
112
|
-
typeof NativeSearchBarCommands;
|
|
113
|
-
let NativeSearchBarCommands: SearchBarCommandsType;
|
|
114
|
-
|
|
115
|
-
let NativeFullWindowOverlay: React.ComponentType<
|
|
116
|
-
PropsWithChildren<{
|
|
117
|
-
style: StyleProp<ViewStyle>;
|
|
118
|
-
}>
|
|
119
|
-
>;
|
|
120
|
-
|
|
121
|
-
const ScreensNativeModules = {
|
|
122
|
-
get NativeScreen() {
|
|
123
|
-
NativeScreenValue =
|
|
124
|
-
NativeScreenValue || require('./fabric/ScreenNativeComponent').default;
|
|
125
|
-
return NativeScreenValue;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
get NativeScreenContainer() {
|
|
129
|
-
NativeScreenContainerValue =
|
|
130
|
-
NativeScreenContainerValue ||
|
|
131
|
-
require('./fabric/ScreenContainerNativeComponent').default;
|
|
132
|
-
return NativeScreenContainerValue;
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
get NativeScreenNavigationContainer() {
|
|
136
|
-
NativeScreenNavigationContainerValue =
|
|
137
|
-
NativeScreenNavigationContainerValue ||
|
|
138
|
-
(Platform.OS === 'ios'
|
|
139
|
-
? require('./fabric/ScreenNavigationContainerNativeComponent').default
|
|
140
|
-
: this.NativeScreenContainer);
|
|
141
|
-
return NativeScreenNavigationContainerValue;
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
get NativeScreenStack() {
|
|
145
|
-
NativeScreenStack =
|
|
146
|
-
NativeScreenStack ||
|
|
147
|
-
require('./fabric/ScreenStackNativeComponent').default;
|
|
148
|
-
return NativeScreenStack;
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
get NativeScreenStackHeaderConfig() {
|
|
152
|
-
NativeScreenStackHeaderConfig =
|
|
153
|
-
NativeScreenStackHeaderConfig ||
|
|
154
|
-
require('./fabric/ScreenStackHeaderConfigNativeComponent').default;
|
|
155
|
-
return NativeScreenStackHeaderConfig;
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
get NativeScreenStackHeaderSubview() {
|
|
159
|
-
NativeScreenStackHeaderSubview =
|
|
160
|
-
NativeScreenStackHeaderSubview ||
|
|
161
|
-
require('./fabric/ScreenStackHeaderSubviewNativeComponent').default;
|
|
162
|
-
return NativeScreenStackHeaderSubview;
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
get NativeSearchBar() {
|
|
166
|
-
NativeSearchBar =
|
|
167
|
-
NativeSearchBar || require('./fabric/SearchBarNativeComponent').default;
|
|
168
|
-
return NativeSearchBar;
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
get NativeSearchBarCommands() {
|
|
172
|
-
NativeSearchBarCommands =
|
|
173
|
-
NativeSearchBarCommands ||
|
|
174
|
-
require('./fabric/SearchBarNativeComponent').Commands;
|
|
175
|
-
return NativeSearchBarCommands;
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
get NativeFullWindowOverlay() {
|
|
179
|
-
NativeFullWindowOverlay =
|
|
180
|
-
NativeFullWindowOverlay ||
|
|
181
|
-
require('./fabric/FullWindowOverlayNativeComponent').default;
|
|
182
|
-
return NativeFullWindowOverlay;
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
interface FreezeWrapperProps {
|
|
187
|
-
freeze: boolean;
|
|
188
|
-
children: React.ReactNode;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// This component allows one more render before freezing the screen.
|
|
192
|
-
// Allows activityState to reach the native side and useIsFocused to work correctly.
|
|
193
|
-
function DelayedFreeze({ freeze, children }: FreezeWrapperProps) {
|
|
194
|
-
// flag used for determining whether freeze should be enabled
|
|
195
|
-
const [freezeState, setFreezeState] = React.useState(false);
|
|
196
|
-
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
const id = setImmediate(() => {
|
|
199
|
-
setFreezeState(freeze);
|
|
200
|
-
});
|
|
201
|
-
return () => {
|
|
202
|
-
clearImmediate(id);
|
|
203
|
-
}
|
|
204
|
-
}, [freeze])
|
|
205
|
-
|
|
206
|
-
return <Freeze freeze={freeze ? freezeState : false}>{children}</Freeze>;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function ScreenStack(props: ScreenStackProps) {
|
|
210
|
-
const { children, ...rest } = props;
|
|
211
|
-
const size = React.Children.count(children);
|
|
212
|
-
// freezes all screens except the top one
|
|
213
|
-
const childrenWithFreeze = React.Children.map(children, (child, index) => {
|
|
214
|
-
// @ts-expect-error it's either SceneView in v6 or RouteView in v5
|
|
215
|
-
const { props, key } = child;
|
|
216
|
-
const descriptor = props?.descriptor ?? props?.descriptors?.[key];
|
|
217
|
-
const freezeEnabled = descriptor?.options?.freezeOnBlur ?? ENABLE_FREEZE;
|
|
218
|
-
|
|
219
|
-
return (
|
|
220
|
-
<DelayedFreeze freeze={freezeEnabled && size - index > 1}>
|
|
221
|
-
{child}
|
|
222
|
-
</DelayedFreeze>
|
|
223
|
-
);
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<ScreensNativeModules.NativeScreenStack {...rest}>
|
|
228
|
-
{childrenWithFreeze}
|
|
229
|
-
</ScreensNativeModules.NativeScreenStack>
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Incomplete type, all accessible properties available at:
|
|
234
|
-
// react-native/Libraries/Components/View/ReactNativeViewViewConfig.js
|
|
235
|
-
interface ViewConfig extends View {
|
|
236
|
-
viewConfig: {
|
|
237
|
-
validAttributes: {
|
|
238
|
-
style: {
|
|
239
|
-
display: boolean;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
class InnerScreen extends React.Component<ScreenProps> {
|
|
246
|
-
private ref: React.ElementRef<typeof View> | null = null;
|
|
247
|
-
private closing = new Animated.Value(0);
|
|
248
|
-
private progress = new Animated.Value(0);
|
|
249
|
-
private goingForward = new Animated.Value(0);
|
|
250
|
-
|
|
251
|
-
setNativeProps(props: ScreenProps): void {
|
|
252
|
-
this.ref?.setNativeProps(props);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
setRef = (ref: React.ElementRef<typeof View> | null): void => {
|
|
256
|
-
this.ref = ref;
|
|
257
|
-
this.props.onComponentRef?.(ref);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
render() {
|
|
261
|
-
const {
|
|
262
|
-
enabled = ENABLE_SCREENS,
|
|
263
|
-
freezeOnBlur = ENABLE_FREEZE,
|
|
264
|
-
...rest
|
|
265
|
-
} = this.props;
|
|
266
|
-
|
|
267
|
-
// To maintain default behaviour of formSheet stack presentation style & and to have resonable
|
|
268
|
-
// defaults for new medium-detent iOS API we need to set defaults here
|
|
269
|
-
const {
|
|
270
|
-
sheetAllowedDetents = 'large',
|
|
271
|
-
sheetLargestUndimmedDetent = 'all',
|
|
272
|
-
sheetGrabberVisible = false,
|
|
273
|
-
sheetCornerRadius = -1.0,
|
|
274
|
-
sheetExpandsWhenScrolledToEdge = true,
|
|
275
|
-
} = rest;
|
|
276
|
-
|
|
277
|
-
if (enabled && isPlatformSupported) {
|
|
278
|
-
AnimatedNativeScreen =
|
|
279
|
-
AnimatedNativeScreen ||
|
|
280
|
-
Animated.createAnimatedComponent(ScreensNativeModules.NativeScreen);
|
|
281
|
-
|
|
282
|
-
let {
|
|
283
|
-
// Filter out active prop in this case because it is unused and
|
|
284
|
-
// can cause problems depending on react-native version:
|
|
285
|
-
// https://github.com/react-navigation/react-navigation/issues/4886
|
|
286
|
-
active,
|
|
287
|
-
activityState,
|
|
288
|
-
children,
|
|
289
|
-
isNativeStack,
|
|
290
|
-
gestureResponseDistance,
|
|
291
|
-
onGestureCancel,
|
|
292
|
-
...props
|
|
293
|
-
} = rest;
|
|
294
|
-
|
|
295
|
-
if (active !== undefined && activityState === undefined) {
|
|
296
|
-
console.warn(
|
|
297
|
-
'It appears that you are using old version of react-navigation library. Please update @react-navigation/bottom-tabs, @react-navigation/stack and @react-navigation/drawer to version 5.10.0 or above to take full advantage of new functionality added to react-native-screens'
|
|
298
|
-
);
|
|
299
|
-
activityState = active !== 0 ? 2 : 0; // in the new version, we need one of the screens to have value of 2 after the transition
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const handleRef = (ref: ViewConfig) => {
|
|
303
|
-
if (ref?.viewConfig?.validAttributes?.style) {
|
|
304
|
-
ref.viewConfig.validAttributes.style = {
|
|
305
|
-
...ref.viewConfig.validAttributes.style,
|
|
306
|
-
display: false,
|
|
307
|
-
};
|
|
308
|
-
this.setRef(ref);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
return (
|
|
313
|
-
<DelayedFreeze freeze={freezeOnBlur && activityState === 0}>
|
|
314
|
-
<AnimatedNativeScreen
|
|
315
|
-
{...props}
|
|
316
|
-
activityState={activityState}
|
|
317
|
-
sheetAllowedDetents={sheetAllowedDetents}
|
|
318
|
-
sheetLargestUndimmedDetent={sheetLargestUndimmedDetent}
|
|
319
|
-
sheetGrabberVisible={sheetGrabberVisible}
|
|
320
|
-
sheetCornerRadius={sheetCornerRadius}
|
|
321
|
-
sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
|
|
322
|
-
gestureResponseDistance={{
|
|
323
|
-
start: gestureResponseDistance?.start ?? -1,
|
|
324
|
-
end: gestureResponseDistance?.end ?? -1,
|
|
325
|
-
top: gestureResponseDistance?.top ?? -1,
|
|
326
|
-
bottom: gestureResponseDistance?.bottom ?? -1,
|
|
327
|
-
}}
|
|
328
|
-
// This prevents showing blank screen when navigating between multiple screens with freezing
|
|
329
|
-
// https://github.com/software-mansion/react-native-screens/pull/1208
|
|
330
|
-
ref={handleRef}
|
|
331
|
-
onTransitionProgress={
|
|
332
|
-
!isNativeStack
|
|
333
|
-
? undefined
|
|
334
|
-
: Animated.event(
|
|
335
|
-
[
|
|
336
|
-
{
|
|
337
|
-
nativeEvent: {
|
|
338
|
-
progress: this.progress,
|
|
339
|
-
closing: this.closing,
|
|
340
|
-
goingForward: this.goingForward,
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
],
|
|
344
|
-
{ useNativeDriver: true }
|
|
345
|
-
)
|
|
346
|
-
}
|
|
347
|
-
onGestureCancel={
|
|
348
|
-
onGestureCancel ??
|
|
349
|
-
(() => {
|
|
350
|
-
// for internal use
|
|
351
|
-
})
|
|
352
|
-
}>
|
|
353
|
-
{!isNativeStack ? ( // see comment of this prop in types.tsx for information why it is needed
|
|
354
|
-
children
|
|
355
|
-
) : (
|
|
356
|
-
<TransitionProgressContext.Provider
|
|
357
|
-
value={{
|
|
358
|
-
progress: this.progress,
|
|
359
|
-
closing: this.closing,
|
|
360
|
-
goingForward: this.goingForward,
|
|
361
|
-
}}>
|
|
362
|
-
{children}
|
|
363
|
-
</TransitionProgressContext.Provider>
|
|
364
|
-
)}
|
|
365
|
-
</AnimatedNativeScreen>
|
|
366
|
-
</DelayedFreeze>
|
|
367
|
-
);
|
|
368
|
-
} else {
|
|
369
|
-
// same reason as above
|
|
370
|
-
let {
|
|
371
|
-
active,
|
|
372
|
-
activityState,
|
|
373
|
-
style,
|
|
374
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
375
|
-
onComponentRef,
|
|
376
|
-
...props
|
|
377
|
-
} = rest;
|
|
378
|
-
|
|
379
|
-
if (active !== undefined && activityState === undefined) {
|
|
380
|
-
activityState = active !== 0 ? 2 : 0;
|
|
381
|
-
}
|
|
382
|
-
return (
|
|
383
|
-
<Animated.View
|
|
384
|
-
style={[style, { display: activityState !== 0 ? 'flex' : 'none' }]}
|
|
385
|
-
ref={this.setRef}
|
|
386
|
-
{...props}
|
|
387
|
-
/>
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function ScreenContainer(props: ScreenContainerProps) {
|
|
394
|
-
const { enabled = ENABLE_SCREENS, hasTwoStates, ...rest } = props;
|
|
395
|
-
|
|
396
|
-
if (enabled && isPlatformSupported) {
|
|
397
|
-
if (hasTwoStates) {
|
|
398
|
-
return <ScreensNativeModules.NativeScreenNavigationContainer {...rest} />;
|
|
399
|
-
}
|
|
400
|
-
return <ScreensNativeModules.NativeScreenContainer {...rest} />;
|
|
401
|
-
}
|
|
402
|
-
return <View {...rest} />;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function FullWindowOverlay(props: { children: ReactNode }) {
|
|
406
|
-
if (Platform.OS !== 'ios') {
|
|
407
|
-
console.warn('Importing FullWindowOverlay is only valid on iOS devices.');
|
|
408
|
-
return <View {...props} />;
|
|
409
|
-
}
|
|
410
|
-
return (
|
|
411
|
-
<ScreensNativeModules.NativeFullWindowOverlay
|
|
412
|
-
style={{ position: 'absolute', width: '100%', height: '100%' }}>
|
|
413
|
-
{props.children}
|
|
414
|
-
</ScreensNativeModules.NativeFullWindowOverlay>
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
const styles = StyleSheet.create({
|
|
419
|
-
headerSubview: {
|
|
420
|
-
position: 'absolute',
|
|
421
|
-
top: 0,
|
|
422
|
-
right: 0,
|
|
423
|
-
flexDirection: 'row',
|
|
424
|
-
alignItems: 'center',
|
|
425
|
-
justifyContent: 'center',
|
|
426
|
-
},
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
const ScreenStackHeaderBackButtonImage = (props: ImageProps): JSX.Element => (
|
|
430
|
-
<ScreensNativeModules.NativeScreenStackHeaderSubview
|
|
431
|
-
type="back"
|
|
432
|
-
style={styles.headerSubview}>
|
|
433
|
-
<Image resizeMode="center" fadeDuration={0} {...props} />
|
|
434
|
-
</ScreensNativeModules.NativeScreenStackHeaderSubview>
|
|
435
|
-
);
|
|
436
|
-
|
|
437
|
-
class SearchBar extends React.Component<SearchBarProps> {
|
|
438
|
-
nativeSearchBarRef: React.RefObject<SearchBarCommands>;
|
|
439
|
-
|
|
440
|
-
constructor(props: SearchBarProps) {
|
|
441
|
-
super(props);
|
|
442
|
-
this.nativeSearchBarRef = React.createRef();
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
_callMethodWithRef(method: (ref: SearchBarCommands) => void) {
|
|
446
|
-
const ref = this.nativeSearchBarRef.current;
|
|
447
|
-
if (ref) {
|
|
448
|
-
method(ref);
|
|
449
|
-
} else {
|
|
450
|
-
console.warn(
|
|
451
|
-
'Reference to native search bar component has not been updated yet'
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
blur() {
|
|
457
|
-
this._callMethodWithRef(ref =>
|
|
458
|
-
ScreensNativeModules.NativeSearchBarCommands.blur(ref)
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
focus() {
|
|
463
|
-
this._callMethodWithRef(ref =>
|
|
464
|
-
ScreensNativeModules.NativeSearchBarCommands.focus(ref)
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
toggleCancelButton(flag: boolean) {
|
|
469
|
-
this._callMethodWithRef(ref =>
|
|
470
|
-
ScreensNativeModules.NativeSearchBarCommands.toggleCancelButton(ref, flag)
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
clearText() {
|
|
475
|
-
this._callMethodWithRef(ref =>
|
|
476
|
-
ScreensNativeModules.NativeSearchBarCommands.clearText(ref)
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
setText(text: string) {
|
|
481
|
-
this._callMethodWithRef(ref =>
|
|
482
|
-
ScreensNativeModules.NativeSearchBarCommands.setText(ref, text)
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
render() {
|
|
487
|
-
if (!isSearchBarAvailableForCurrentPlatform) {
|
|
488
|
-
console.warn(
|
|
489
|
-
'Importing SearchBar is only valid on iOS and Android devices.'
|
|
490
|
-
);
|
|
491
|
-
return View as any as ReactNode;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
return (
|
|
495
|
-
<ScreensNativeModules.NativeSearchBar
|
|
496
|
-
{...this.props}
|
|
497
|
-
ref={this.nativeSearchBarRef}
|
|
498
|
-
/>
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const ScreenStackHeaderRightView = (
|
|
504
|
-
props: React.PropsWithChildren<ViewProps>
|
|
505
|
-
): JSX.Element => (
|
|
506
|
-
<ScreensNativeModules.NativeScreenStackHeaderSubview
|
|
507
|
-
{...props}
|
|
508
|
-
type="right"
|
|
509
|
-
style={styles.headerSubview}
|
|
510
|
-
/>
|
|
511
|
-
);
|
|
512
|
-
|
|
513
|
-
const ScreenStackHeaderLeftView = (
|
|
514
|
-
props: React.PropsWithChildren<ViewProps>
|
|
515
|
-
): JSX.Element => (
|
|
516
|
-
<ScreensNativeModules.NativeScreenStackHeaderSubview
|
|
517
|
-
{...props}
|
|
518
|
-
type="left"
|
|
519
|
-
style={styles.headerSubview}
|
|
520
|
-
/>
|
|
521
|
-
);
|
|
522
|
-
|
|
523
|
-
const ScreenStackHeaderCenterView = (
|
|
524
|
-
props: React.PropsWithChildren<ViewProps>
|
|
525
|
-
): JSX.Element => (
|
|
526
|
-
<ScreensNativeModules.NativeScreenStackHeaderSubview
|
|
527
|
-
{...props}
|
|
528
|
-
type="center"
|
|
529
|
-
style={styles.headerSubview}
|
|
530
|
-
/>
|
|
531
|
-
);
|
|
532
|
-
|
|
533
|
-
const ScreenStackHeaderSearchBarView = (
|
|
534
|
-
props: React.PropsWithChildren<SearchBarProps>
|
|
535
|
-
): JSX.Element => (
|
|
536
|
-
<ScreensNativeModules.NativeScreenStackHeaderSubview
|
|
537
|
-
{...props}
|
|
538
|
-
type="searchBar"
|
|
539
|
-
style={styles.headerSubview}
|
|
540
|
-
/>
|
|
541
|
-
);
|
|
542
|
-
|
|
543
|
-
export type {
|
|
544
|
-
StackPresentationTypes,
|
|
545
|
-
StackAnimationTypes,
|
|
546
|
-
BlurEffectTypes,
|
|
547
|
-
ScreenReplaceTypes,
|
|
548
|
-
ScreenOrientationTypes,
|
|
549
|
-
HeaderSubviewTypes,
|
|
550
|
-
ScreenProps,
|
|
551
|
-
ScreenContainerProps,
|
|
552
|
-
ScreenStackProps,
|
|
553
|
-
ScreenStackHeaderConfigProps,
|
|
554
|
-
SearchBarProps,
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
// context to be used when the user wants to use enhanced implementation
|
|
558
|
-
// e.g. to use `useReanimatedTransitionProgress` (see `reanimated` folder in repo)
|
|
559
|
-
const ScreenContext = React.createContext(InnerScreen);
|
|
560
|
-
|
|
561
|
-
class Screen extends React.Component<ScreenProps> {
|
|
562
|
-
static contextType = ScreenContext;
|
|
563
|
-
|
|
564
|
-
render() {
|
|
565
|
-
const ScreenWrapper = (this.context || InnerScreen) as React.ElementType;
|
|
566
|
-
return <ScreenWrapper {...this.props} />;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
module.exports = {
|
|
571
|
-
// these are classes so they are not evaluated until used
|
|
572
|
-
// so no need to use getters for them
|
|
573
|
-
Screen,
|
|
574
|
-
ScreenContainer,
|
|
575
|
-
ScreenContext,
|
|
576
|
-
ScreenStack,
|
|
577
|
-
InnerScreen,
|
|
578
|
-
SearchBar,
|
|
579
|
-
FullWindowOverlay,
|
|
580
|
-
|
|
581
|
-
get NativeScreen() {
|
|
582
|
-
return ScreensNativeModules.NativeScreen;
|
|
583
|
-
},
|
|
584
|
-
|
|
585
|
-
get NativeScreenContainer() {
|
|
586
|
-
return ScreensNativeModules.NativeScreenContainer;
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
get NativeScreenNavigationContainer() {
|
|
590
|
-
return ScreensNativeModules.NativeScreenNavigationContainer;
|
|
591
|
-
},
|
|
592
|
-
|
|
593
|
-
get ScreenStackHeaderConfig() {
|
|
594
|
-
return ScreensNativeModules.NativeScreenStackHeaderConfig;
|
|
595
|
-
},
|
|
596
|
-
get ScreenStackHeaderSubview() {
|
|
597
|
-
return ScreensNativeModules.NativeScreenStackHeaderSubview;
|
|
598
|
-
},
|
|
599
|
-
get SearchBarCommands() {
|
|
600
|
-
return ScreensNativeModules.NativeSearchBarCommands;
|
|
601
|
-
},
|
|
602
|
-
// these are functions and will not be evaluated until used
|
|
603
|
-
// so no need to use getters for them
|
|
604
|
-
ScreenStackHeaderBackButtonImage,
|
|
605
|
-
ScreenStackHeaderRightView,
|
|
606
|
-
ScreenStackHeaderLeftView,
|
|
607
|
-
ScreenStackHeaderCenterView,
|
|
608
|
-
ScreenStackHeaderSearchBarView,
|
|
609
|
-
|
|
610
|
-
enableScreens,
|
|
611
|
-
enableFreeze,
|
|
612
|
-
screensEnabled,
|
|
613
|
-
shouldUseActivityState,
|
|
614
|
-
useTransitionProgress,
|
|
615
|
-
|
|
616
|
-
isSearchBarAvailableForCurrentPlatform,
|
|
617
|
-
isNewBackTitleImplementation,
|
|
618
|
-
executeNativeBackPress,
|
|
619
|
-
};
|