react-native-screens 3.28.0 → 3.30.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 +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 +150 -23
- 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 +18 -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
|
@@ -19,7 +19,7 @@ import com.facebook.react.uimanager.UIManagerModule
|
|
|
19
19
|
import com.swmansion.rnscreens.events.HeaderHeightChangeEvent
|
|
20
20
|
|
|
21
21
|
@SuppressLint("ViewConstructor")
|
|
22
|
-
class Screen
|
|
22
|
+
class Screen(context: ReactContext?) : FabricEnabledViewGroup(context) {
|
|
23
23
|
val fragment: Fragment?
|
|
24
24
|
get() = fragmentWrapper?.fragment
|
|
25
25
|
|
|
@@ -27,21 +27,14 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
27
27
|
var container: ScreenContainer? = null
|
|
28
28
|
var activityState: ActivityState? = null
|
|
29
29
|
private set
|
|
30
|
-
private var
|
|
30
|
+
private var isTransitioning = false
|
|
31
31
|
var stackPresentation = StackPresentation.PUSH
|
|
32
32
|
var replaceAnimation = ReplaceAnimation.POP
|
|
33
33
|
var stackAnimation = StackAnimation.DEFAULT
|
|
34
34
|
var isGestureEnabled = true
|
|
35
35
|
var screenOrientation: Int? = null
|
|
36
36
|
private set
|
|
37
|
-
private var mStatusBarStyle: String? = null
|
|
38
|
-
private var mStatusBarHidden: Boolean? = null
|
|
39
|
-
private var mStatusBarTranslucent: Boolean? = null
|
|
40
|
-
private var mStatusBarColor: Int? = null
|
|
41
|
-
private var mNavigationBarColor: Int? = null
|
|
42
|
-
private var mNavigationBarHidden: Boolean? = null
|
|
43
37
|
var isStatusBarAnimated: Boolean? = null
|
|
44
|
-
private var mNativeBackButtonDismissalEnabled = true
|
|
45
38
|
|
|
46
39
|
init {
|
|
47
40
|
// we set layout params as WindowManager.LayoutParams to workaround the issue with TextInputs
|
|
@@ -68,16 +61,19 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
68
61
|
}
|
|
69
62
|
|
|
70
63
|
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
|
71
|
-
if (changed) {
|
|
64
|
+
if (container is ScreenStack && changed) {
|
|
72
65
|
val width = r - l
|
|
73
66
|
val height = b - t
|
|
74
67
|
|
|
75
|
-
calculateHeaderHeight()
|
|
68
|
+
val headerHeight = calculateHeaderHeight()
|
|
69
|
+
val totalHeight = headerHeight.first + headerHeight.second // action bar height + status bar height
|
|
76
70
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
77
|
-
updateScreenSizeFabric(width, height)
|
|
71
|
+
updateScreenSizeFabric(width, height, totalHeight)
|
|
78
72
|
} else {
|
|
79
73
|
updateScreenSizePaper(width, height)
|
|
80
74
|
}
|
|
75
|
+
|
|
76
|
+
notifyHeaderHeightChange(totalHeight)
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
|
|
@@ -102,10 +98,10 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
102
98
|
* container when transitioning is detected and turned off immediately after
|
|
103
99
|
*/
|
|
104
100
|
fun setTransitioning(transitioning: Boolean) {
|
|
105
|
-
if (
|
|
101
|
+
if (isTransitioning == transitioning) {
|
|
106
102
|
return
|
|
107
103
|
}
|
|
108
|
-
|
|
104
|
+
isTransitioning = transitioning
|
|
109
105
|
val isWebViewInScreen = hasWebView(this)
|
|
110
106
|
if (isWebViewInScreen && layerType != LAYER_TYPE_HARDWARE) {
|
|
111
107
|
return
|
|
@@ -169,33 +165,30 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
169
165
|
this.headerConfig?.toolbar?.importantForAccessibility = mode
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
var statusBarStyle: String?
|
|
173
|
-
get() = mStatusBarStyle
|
|
168
|
+
var statusBarStyle: String? = null
|
|
174
169
|
set(statusBarStyle) {
|
|
175
170
|
if (statusBarStyle != null) {
|
|
176
171
|
ScreenWindowTraits.applyDidSetStatusBarAppearance()
|
|
177
172
|
}
|
|
178
|
-
|
|
173
|
+
field = statusBarStyle
|
|
179
174
|
fragmentWrapper?.let { ScreenWindowTraits.setStyle(this, it.tryGetActivity(), it.tryGetContext()) }
|
|
180
175
|
}
|
|
181
176
|
|
|
182
|
-
var isStatusBarHidden: Boolean?
|
|
183
|
-
get() = mStatusBarHidden
|
|
177
|
+
var isStatusBarHidden: Boolean? = null
|
|
184
178
|
set(statusBarHidden) {
|
|
185
179
|
if (statusBarHidden != null) {
|
|
186
180
|
ScreenWindowTraits.applyDidSetStatusBarAppearance()
|
|
187
181
|
}
|
|
188
|
-
|
|
182
|
+
field = statusBarHidden
|
|
189
183
|
fragmentWrapper?.let { ScreenWindowTraits.setHidden(this, it.tryGetActivity()) }
|
|
190
184
|
}
|
|
191
185
|
|
|
192
|
-
var isStatusBarTranslucent: Boolean?
|
|
193
|
-
get() = mStatusBarTranslucent
|
|
186
|
+
var isStatusBarTranslucent: Boolean? = null
|
|
194
187
|
set(statusBarTranslucent) {
|
|
195
188
|
if (statusBarTranslucent != null) {
|
|
196
189
|
ScreenWindowTraits.applyDidSetStatusBarAppearance()
|
|
197
190
|
}
|
|
198
|
-
|
|
191
|
+
field = statusBarTranslucent
|
|
199
192
|
fragmentWrapper?.let {
|
|
200
193
|
ScreenWindowTraits.setTranslucent(
|
|
201
194
|
this,
|
|
@@ -205,33 +198,30 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
205
198
|
}
|
|
206
199
|
}
|
|
207
200
|
|
|
208
|
-
var statusBarColor: Int?
|
|
209
|
-
get() = mStatusBarColor
|
|
201
|
+
var statusBarColor: Int? = null
|
|
210
202
|
set(statusBarColor) {
|
|
211
203
|
if (statusBarColor != null) {
|
|
212
204
|
ScreenWindowTraits.applyDidSetStatusBarAppearance()
|
|
213
205
|
}
|
|
214
|
-
|
|
206
|
+
field = statusBarColor
|
|
215
207
|
fragmentWrapper?.let { ScreenWindowTraits.setColor(this, it.tryGetActivity(), it.tryGetContext()) }
|
|
216
208
|
}
|
|
217
209
|
|
|
218
|
-
var navigationBarColor: Int?
|
|
219
|
-
get() = mNavigationBarColor
|
|
210
|
+
var navigationBarColor: Int? = null
|
|
220
211
|
set(navigationBarColor) {
|
|
221
212
|
if (navigationBarColor != null) {
|
|
222
213
|
ScreenWindowTraits.applyDidSetNavigationBarAppearance()
|
|
223
214
|
}
|
|
224
|
-
|
|
215
|
+
field = navigationBarColor
|
|
225
216
|
fragmentWrapper?.let { ScreenWindowTraits.setNavigationBarColor(this, it.tryGetActivity()) }
|
|
226
217
|
}
|
|
227
218
|
|
|
228
|
-
var isNavigationBarHidden: Boolean?
|
|
229
|
-
get() = mNavigationBarHidden
|
|
219
|
+
var isNavigationBarHidden: Boolean? = null
|
|
230
220
|
set(navigationBarHidden) {
|
|
231
221
|
if (navigationBarHidden != null) {
|
|
232
222
|
ScreenWindowTraits.applyDidSetNavigationBarAppearance()
|
|
233
223
|
}
|
|
234
|
-
|
|
224
|
+
field = navigationBarHidden
|
|
235
225
|
fragmentWrapper?.let {
|
|
236
226
|
ScreenWindowTraits.setNavigationBarHidden(
|
|
237
227
|
this,
|
|
@@ -240,31 +230,31 @@ class Screen constructor(context: ReactContext?) : FabricEnabledViewGroup(contex
|
|
|
240
230
|
}
|
|
241
231
|
}
|
|
242
232
|
|
|
243
|
-
var nativeBackButtonDismissalEnabled: Boolean
|
|
244
|
-
get() = mNativeBackButtonDismissalEnabled
|
|
245
|
-
set(enableNativeBackButtonDismissal) {
|
|
246
|
-
mNativeBackButtonDismissalEnabled = enableNativeBackButtonDismissal
|
|
247
|
-
}
|
|
233
|
+
var nativeBackButtonDismissalEnabled: Boolean = true
|
|
248
234
|
|
|
249
|
-
private fun calculateHeaderHeight() {
|
|
235
|
+
private fun calculateHeaderHeight(): Pair<Double, Double> {
|
|
250
236
|
val actionBarTv = TypedValue()
|
|
251
237
|
val resolvedActionBarSize = context.theme.resolveAttribute(android.R.attr.actionBarSize, actionBarTv, true)
|
|
252
238
|
|
|
253
239
|
// Check if it's possible to get an attribute from theme context and assign a value from it.
|
|
254
240
|
// Otherwise, the default value will be returned.
|
|
255
241
|
val actionBarHeight = TypedValue.complexToDimensionPixelSize(actionBarTv.data, resources.displayMetrics)
|
|
256
|
-
.takeIf { resolvedActionBarSize && headerConfig?.
|
|
242
|
+
.takeIf { resolvedActionBarSize && headerConfig?.isHeaderHidden != true && headerConfig?.isHeaderTranslucent != true }
|
|
257
243
|
?.let { PixelUtil.toDIPFromPixel(it.toFloat()).toDouble() } ?: 0.0
|
|
258
244
|
|
|
259
245
|
val statusBarHeight = context.resources.getIdentifier("status_bar_height", "dimen", "android")
|
|
260
|
-
|
|
246
|
+
// Count only status bar when action bar is visible and status bar is not hidden
|
|
247
|
+
.takeIf { it > 0 && isStatusBarHidden != true && actionBarHeight > 0 }
|
|
261
248
|
?.let { (context.resources::getDimensionPixelSize)(it) }
|
|
262
249
|
?.let { PixelUtil.toDIPFromPixel(it.toFloat()).toDouble() }
|
|
263
250
|
?: 0.0
|
|
264
251
|
|
|
265
|
-
|
|
252
|
+
return actionBarHeight to statusBarHeight
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private fun notifyHeaderHeightChange(headerHeight: Double) {
|
|
266
256
|
UIManagerHelper.getEventDispatcherForReactTag(context as ReactContext, id)
|
|
267
|
-
?.dispatchEvent(HeaderHeightChangeEvent(id,
|
|
257
|
+
?.dispatchEvent(HeaderHeightChangeEvent(id, headerHeight))
|
|
268
258
|
}
|
|
269
259
|
|
|
270
260
|
enum class StackPresentation {
|
|
@@ -14,19 +14,22 @@ import com.facebook.react.ReactRootView
|
|
|
14
14
|
import com.facebook.react.bridge.ReactContext
|
|
15
15
|
import com.facebook.react.modules.core.ChoreographerCompat
|
|
16
16
|
import com.facebook.react.modules.core.ReactChoreographer
|
|
17
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
18
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
17
19
|
import com.swmansion.rnscreens.Screen.ActivityState
|
|
20
|
+
import com.swmansion.rnscreens.events.ScreenDismissedEvent
|
|
18
21
|
|
|
19
22
|
open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
20
23
|
@JvmField
|
|
21
|
-
protected val
|
|
24
|
+
protected val screenWrappers = ArrayList<ScreenFragmentWrapper>()
|
|
22
25
|
@JvmField
|
|
23
|
-
protected var
|
|
24
|
-
private var
|
|
25
|
-
private var
|
|
26
|
-
private var
|
|
27
|
-
private val
|
|
26
|
+
protected var fragmentManager: FragmentManager? = null
|
|
27
|
+
private var isAttached = false
|
|
28
|
+
private var needsUpdate = false
|
|
29
|
+
private var isLayoutEnqueued = false
|
|
30
|
+
private val layoutCallback: ChoreographerCompat.FrameCallback = object : ChoreographerCompat.FrameCallback() {
|
|
28
31
|
override fun doFrame(frameTimeNanos: Long) {
|
|
29
|
-
|
|
32
|
+
isLayoutEnqueued = false
|
|
30
33
|
measure(
|
|
31
34
|
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
32
35
|
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
|
@@ -34,7 +37,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
34
37
|
layout(left, top, right, bottom)
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
private var
|
|
40
|
+
private var parentScreenWrapper: ScreenFragmentWrapper? = null
|
|
38
41
|
|
|
39
42
|
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
|
40
43
|
var i = 0
|
|
@@ -48,16 +51,9 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
48
51
|
override fun removeView(view: View) {
|
|
49
52
|
// The below block is a workaround for an issue with keyboard handling within fragments. Despite
|
|
50
53
|
// Android handles input focus on the fragments that leave the screen, the keyboard stays open
|
|
51
|
-
// in a number of cases.
|
|
52
|
-
// changes in Android's InputMethodManager have been introduced (specifically around dismissing
|
|
53
|
-
// the keyboard in onDetachedFromWindow). However, we also noticed the keyboard issue happen
|
|
54
|
-
// intermittently on recent versions of Android as well. The issue hasn't been previously
|
|
55
|
-
// noticed as in React Native <= 0.61 there was a logic that'd trigger keyboard dismiss upon a
|
|
56
|
-
// blur event (the blur even gets dispatched properly, the keyboard just stays open despite
|
|
57
|
-
// that) – note the change in RN core here:
|
|
58
|
-
// https://github.com/facebook/react-native/commit/e9b4928311513d3cbbd9d875827694eab6cfa932
|
|
54
|
+
// in a number of cases.
|
|
59
55
|
// The workaround is to force-hide keyboard when the screen that has focus is dismissed (we
|
|
60
|
-
// detect that in removeView as super.removeView causes the input view to un
|
|
56
|
+
// detect that in removeView as super.removeView causes the input view to un-focus while keeping
|
|
61
57
|
// the keyboard open).
|
|
62
58
|
if (view === focusedChild) {
|
|
63
59
|
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)
|
|
@@ -69,19 +65,19 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
69
65
|
override fun requestLayout() {
|
|
70
66
|
super.requestLayout()
|
|
71
67
|
@Suppress("SENSELESS_COMPARISON") // mLayoutCallback can be null here since this method can be called in init
|
|
72
|
-
if (!
|
|
73
|
-
|
|
68
|
+
if (!isLayoutEnqueued && layoutCallback != null) {
|
|
69
|
+
isLayoutEnqueued = true
|
|
74
70
|
// we use NATIVE_ANIMATED_MODULE choreographer queue because it allows us to catch the current
|
|
75
71
|
// looper loop instead of enqueueing the update in the next loop causing a one frame delay.
|
|
76
72
|
ReactChoreographer.getInstance()
|
|
77
73
|
.postFrameCallback(
|
|
78
|
-
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE,
|
|
74
|
+
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE, layoutCallback
|
|
79
75
|
)
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
val isNested: Boolean
|
|
84
|
-
get() =
|
|
80
|
+
get() = parentScreenWrapper != null
|
|
85
81
|
|
|
86
82
|
fun notifyChildUpdate() {
|
|
87
83
|
performUpdatesNow()
|
|
@@ -92,37 +88,37 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
92
88
|
fun addScreen(screen: Screen, index: Int) {
|
|
93
89
|
val fragment = adapt(screen)
|
|
94
90
|
screen.fragmentWrapper = fragment
|
|
95
|
-
|
|
91
|
+
screenWrappers.add(index, fragment)
|
|
96
92
|
screen.container = this
|
|
97
93
|
onScreenChanged()
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
open fun removeScreenAt(index: Int) {
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
screenWrappers[index].screen.container = null
|
|
98
|
+
screenWrappers.removeAt(index)
|
|
103
99
|
onScreenChanged()
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
open fun removeAllScreens() {
|
|
107
|
-
for (screenFragment in
|
|
103
|
+
for (screenFragment in screenWrappers) {
|
|
108
104
|
screenFragment.screen.container = null
|
|
109
105
|
}
|
|
110
|
-
|
|
106
|
+
screenWrappers.clear()
|
|
111
107
|
onScreenChanged()
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
val screenCount: Int
|
|
115
|
-
get() =
|
|
111
|
+
get() = screenWrappers.size
|
|
116
112
|
|
|
117
|
-
fun getScreenAt(index: Int): Screen =
|
|
113
|
+
fun getScreenAt(index: Int): Screen = screenWrappers[index].screen
|
|
118
114
|
|
|
119
|
-
fun getScreenFragmentWrapperAt(index: Int): ScreenFragmentWrapper =
|
|
115
|
+
fun getScreenFragmentWrapperAt(index: Int): ScreenFragmentWrapper = screenWrappers[index]
|
|
120
116
|
|
|
121
117
|
open val topScreen: Screen?
|
|
122
|
-
get() =
|
|
118
|
+
get() = screenWrappers.firstOrNull { getActivityState(it) === ActivityState.ON_TOP }?.screen
|
|
123
119
|
|
|
124
120
|
private fun setFragmentManager(fm: FragmentManager) {
|
|
125
|
-
|
|
121
|
+
fragmentManager = fm
|
|
126
122
|
performUpdatesNow()
|
|
127
123
|
}
|
|
128
124
|
|
|
@@ -174,7 +170,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
174
170
|
if (parent is Screen) {
|
|
175
171
|
checkNotNull(
|
|
176
172
|
parent.fragmentWrapper?.let { fragmentWrapper ->
|
|
177
|
-
|
|
173
|
+
parentScreenWrapper = fragmentWrapper
|
|
178
174
|
fragmentWrapper.addChildScreenContainer(this)
|
|
179
175
|
setFragmentManager(fragmentWrapper.fragment.childFragmentManager)
|
|
180
176
|
}
|
|
@@ -191,7 +187,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
191
187
|
}
|
|
192
188
|
|
|
193
189
|
protected fun createTransaction(): FragmentTransaction {
|
|
194
|
-
return requireNotNull(
|
|
190
|
+
return requireNotNull(fragmentManager) { "fragment manager is null when creating transaction" }
|
|
195
191
|
.beginTransaction()
|
|
196
192
|
.setReorderingAllowed(true)
|
|
197
193
|
}
|
|
@@ -200,6 +196,38 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
200
196
|
transaction.add(id, fragment)
|
|
201
197
|
}
|
|
202
198
|
|
|
199
|
+
fun attachBelowTop() {
|
|
200
|
+
if (screenWrappers.size < 2) {
|
|
201
|
+
throw RuntimeException("[RNScreens] Unable to run transition for less than 2 screens.")
|
|
202
|
+
}
|
|
203
|
+
val transaction = createTransaction()
|
|
204
|
+
val top = topScreen as Screen
|
|
205
|
+
// we have to reattach topScreen so it is on top of the one below
|
|
206
|
+
detachScreen(transaction, top.fragment as Fragment)
|
|
207
|
+
attachScreen(transaction, screenWrappers[screenWrappers.size - 2].fragment)
|
|
208
|
+
attachScreen(transaction, top.fragment as Fragment)
|
|
209
|
+
transaction.commitNowAllowingStateLoss()
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
fun detachBelowTop() {
|
|
213
|
+
if (screenWrappers.size < 2) {
|
|
214
|
+
throw RuntimeException("[RNScreens] Unable to run transition for less than 2 screens.")
|
|
215
|
+
}
|
|
216
|
+
val transaction = createTransaction()
|
|
217
|
+
detachScreen(transaction, screenWrappers[screenWrappers.size - 2].fragment)
|
|
218
|
+
transaction.commitNowAllowingStateLoss()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
fun notifyTopDetached() {
|
|
222
|
+
val top = topScreen as Screen
|
|
223
|
+
if (context is ReactContext) {
|
|
224
|
+
val surfaceId = UIManagerHelper.getSurfaceId(context)
|
|
225
|
+
UIManagerHelper
|
|
226
|
+
.getEventDispatcherForReactTag(context as ReactContext, top.id)
|
|
227
|
+
?.dispatchEvent(ScreenDismissedEvent(surfaceId, top.id))
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
203
231
|
private fun detachScreen(transaction: FragmentTransaction, fragment: Fragment) {
|
|
204
232
|
transaction.remove(fragment)
|
|
205
233
|
}
|
|
@@ -208,11 +236,11 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
208
236
|
screenFragmentWrapper.screen.activityState
|
|
209
237
|
|
|
210
238
|
open fun hasScreen(screenFragmentWrapper: ScreenFragmentWrapper?): Boolean =
|
|
211
|
-
|
|
239
|
+
screenWrappers.contains(screenFragmentWrapper)
|
|
212
240
|
|
|
213
241
|
override fun onAttachedToWindow() {
|
|
214
242
|
super.onAttachedToWindow()
|
|
215
|
-
|
|
243
|
+
isAttached = true
|
|
216
244
|
setupFragmentManager()
|
|
217
245
|
}
|
|
218
246
|
|
|
@@ -238,18 +266,18 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
238
266
|
// view. We also need to make sure all the fragments attached to the given container are removed
|
|
239
267
|
// from fragment manager as in some cases fragment manager may be reused and in such case it'd
|
|
240
268
|
// attempt to reattach previously registered fragments that are not removed
|
|
241
|
-
|
|
269
|
+
fragmentManager?.let {
|
|
242
270
|
if (!it.isDestroyed) {
|
|
243
271
|
removeMyFragments(it)
|
|
244
272
|
it.executePendingTransactions()
|
|
245
273
|
}
|
|
246
274
|
}
|
|
247
275
|
|
|
248
|
-
|
|
249
|
-
|
|
276
|
+
parentScreenWrapper?.removeChildScreenContainer(this)
|
|
277
|
+
parentScreenWrapper = null
|
|
250
278
|
|
|
251
279
|
super.onDetachedFromWindow()
|
|
252
|
-
|
|
280
|
+
isAttached = false
|
|
253
281
|
// When fragment container view is detached we force all its children to be removed.
|
|
254
282
|
// It is because children screens are controlled by their fragments, which can often have a
|
|
255
283
|
// delayed lifecycle (due to transitions). As a result due to ongoing transitions the fragment
|
|
@@ -283,8 +311,8 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
283
311
|
// before transition if also not dispatched after children updates.
|
|
284
312
|
// The exception to this rule is `updateImmediately` which is triggered by actions
|
|
285
313
|
// not connected to React view hierarchy changes, but rather internal events
|
|
286
|
-
|
|
287
|
-
(context as
|
|
314
|
+
needsUpdate = true
|
|
315
|
+
(context as ThemedReactContext).reactApplicationContext.runOnUiQueueThread {
|
|
288
316
|
// We schedule the update here because LayoutAnimations of `react-native-reanimated`
|
|
289
317
|
// sometimes attach/detach screens after the layout block of `ScreensShadowNode` has
|
|
290
318
|
// already run, and we want to update the container then too. In the other cases,
|
|
@@ -298,15 +326,15 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
298
326
|
// we want to update immediately when the fragment manager is set or native back button
|
|
299
327
|
// dismiss is dispatched or Screen's activityState changes since it is not connected to React
|
|
300
328
|
// view hierarchy changes and will not trigger `onBeforeLayout` method of `ScreensShadowNode`
|
|
301
|
-
|
|
329
|
+
needsUpdate = true
|
|
302
330
|
performUpdates()
|
|
303
331
|
}
|
|
304
332
|
|
|
305
333
|
fun performUpdates() {
|
|
306
|
-
if (!
|
|
334
|
+
if (!needsUpdate || !isAttached || fragmentManager == null || fragmentManager?.isDestroyed == true) {
|
|
307
335
|
return
|
|
308
336
|
}
|
|
309
|
-
|
|
337
|
+
needsUpdate = false
|
|
310
338
|
onUpdate()
|
|
311
339
|
notifyContainerUpdate()
|
|
312
340
|
}
|
|
@@ -315,11 +343,11 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
315
343
|
createTransaction().let {
|
|
316
344
|
// detach screens that are no longer active
|
|
317
345
|
val orphaned: MutableSet<Fragment> = HashSet(
|
|
318
|
-
requireNotNull(
|
|
319
|
-
"
|
|
346
|
+
requireNotNull(fragmentManager) {
|
|
347
|
+
"fragment manager is null when performing update in ScreenContainer"
|
|
320
348
|
}.fragments
|
|
321
349
|
)
|
|
322
|
-
for (fragmentWrapper in
|
|
350
|
+
for (fragmentWrapper in screenWrappers) {
|
|
323
351
|
if (getActivityState(fragmentWrapper) === ActivityState.INACTIVE &&
|
|
324
352
|
fragmentWrapper.fragment.isAdded
|
|
325
353
|
) {
|
|
@@ -345,7 +373,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
|
|
|
345
373
|
var addedBefore = false
|
|
346
374
|
val pendingFront: ArrayList<ScreenFragmentWrapper> = ArrayList()
|
|
347
375
|
|
|
348
|
-
for (fragmentWrapper in
|
|
376
|
+
for (fragmentWrapper in screenWrappers) {
|
|
349
377
|
val activityState = getActivityState(fragmentWrapper)
|
|
350
378
|
if (activityState !== ActivityState.INACTIVE && !fragmentWrapper.fragment.isAdded) {
|
|
351
379
|
addedBefore = true
|
|
@@ -27,7 +27,7 @@ import kotlin.math.min
|
|
|
27
27
|
|
|
28
28
|
open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
29
29
|
enum class ScreenLifecycleEvent {
|
|
30
|
-
|
|
30
|
+
DID_APPEAR, WILL_APPEAR, DID_DISAPPEAR, WILL_DISAPPEAR
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
override val fragment: Fragment
|
|
@@ -36,11 +36,13 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
36
36
|
// if we call empty constructor, there is no screen to be assigned so not sure why it is suggested
|
|
37
37
|
@Suppress("JoinDeclarationAndAssignment")
|
|
38
38
|
override lateinit var screen: Screen
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
override val childScreenContainers: MutableList<ScreenContainer> = ArrayList()
|
|
41
|
+
|
|
40
42
|
private var shouldUpdateOnResume = false
|
|
41
43
|
// if we don't set it, it will be 0.0f at the beginning so the progress will not be sent
|
|
42
44
|
// due to progress value being already 0.0f
|
|
43
|
-
private var
|
|
45
|
+
private var transitionProgress = -1f
|
|
44
46
|
|
|
45
47
|
// those 2 vars are needed since sometimes the events would be dispatched twice in child containers
|
|
46
48
|
// (should only happen if parent has `NONE` animation) and we don't need too complicated logic.
|
|
@@ -152,42 +154,39 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
152
154
|
return null
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
override val childScreenContainers: List<ScreenContainer>
|
|
156
|
-
get() = mChildScreenContainers
|
|
157
|
-
|
|
158
157
|
override fun canDispatchLifecycleEvent(event: ScreenLifecycleEvent): Boolean = when (event) {
|
|
159
|
-
ScreenLifecycleEvent.
|
|
160
|
-
ScreenLifecycleEvent.
|
|
161
|
-
ScreenLifecycleEvent.
|
|
162
|
-
ScreenLifecycleEvent.
|
|
158
|
+
ScreenLifecycleEvent.WILL_APPEAR -> canDispatchWillAppear
|
|
159
|
+
ScreenLifecycleEvent.DID_APPEAR -> canDispatchAppear
|
|
160
|
+
ScreenLifecycleEvent.WILL_DISAPPEAR -> !canDispatchWillAppear
|
|
161
|
+
ScreenLifecycleEvent.DID_DISAPPEAR -> !canDispatchAppear
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
override fun updateLastEventDispatched(event: ScreenLifecycleEvent) {
|
|
166
165
|
when (event) {
|
|
167
|
-
ScreenLifecycleEvent.
|
|
168
|
-
ScreenLifecycleEvent.
|
|
169
|
-
ScreenLifecycleEvent.
|
|
170
|
-
ScreenLifecycleEvent.
|
|
166
|
+
ScreenLifecycleEvent.WILL_APPEAR -> canDispatchWillAppear = false
|
|
167
|
+
ScreenLifecycleEvent.DID_APPEAR -> canDispatchAppear = false
|
|
168
|
+
ScreenLifecycleEvent.WILL_DISAPPEAR -> canDispatchWillAppear = true
|
|
169
|
+
ScreenLifecycleEvent.DID_DISAPPEAR -> canDispatchAppear = true
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
private fun dispatchOnWillAppear() {
|
|
175
|
-
dispatchLifecycleEvent(ScreenLifecycleEvent.
|
|
174
|
+
dispatchLifecycleEvent(ScreenLifecycleEvent.WILL_APPEAR, this)
|
|
176
175
|
dispatchTransitionProgressEvent(0.0f, false)
|
|
177
176
|
}
|
|
178
177
|
|
|
179
178
|
private fun dispatchOnAppear() {
|
|
180
|
-
dispatchLifecycleEvent(ScreenLifecycleEvent.
|
|
179
|
+
dispatchLifecycleEvent(ScreenLifecycleEvent.DID_APPEAR, this)
|
|
181
180
|
dispatchTransitionProgressEvent(1.0f, false)
|
|
182
181
|
}
|
|
183
182
|
|
|
184
183
|
private fun dispatchOnWillDisappear() {
|
|
185
|
-
dispatchLifecycleEvent(ScreenLifecycleEvent.
|
|
184
|
+
dispatchLifecycleEvent(ScreenLifecycleEvent.WILL_DISAPPEAR, this)
|
|
186
185
|
dispatchTransitionProgressEvent(0.0f, true)
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
private fun dispatchOnDisappear() {
|
|
190
|
-
dispatchLifecycleEvent(ScreenLifecycleEvent.
|
|
189
|
+
dispatchLifecycleEvent(ScreenLifecycleEvent.DID_DISAPPEAR, this)
|
|
191
190
|
dispatchTransitionProgressEvent(1.0f, true)
|
|
192
191
|
}
|
|
193
192
|
|
|
@@ -198,10 +197,10 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
198
197
|
fragmentWrapper.updateLastEventDispatched(event)
|
|
199
198
|
val surfaceId = UIManagerHelper.getSurfaceId(it)
|
|
200
199
|
val lifecycleEvent: Event<*> = when (event) {
|
|
201
|
-
ScreenLifecycleEvent.
|
|
202
|
-
ScreenLifecycleEvent.
|
|
203
|
-
ScreenLifecycleEvent.
|
|
204
|
-
ScreenLifecycleEvent.
|
|
200
|
+
ScreenLifecycleEvent.WILL_APPEAR -> ScreenWillAppearEvent(surfaceId, it.id)
|
|
201
|
+
ScreenLifecycleEvent.DID_APPEAR -> ScreenAppearEvent(surfaceId, it.id)
|
|
202
|
+
ScreenLifecycleEvent.WILL_DISAPPEAR -> ScreenWillDisappearEvent(surfaceId, it.id)
|
|
203
|
+
ScreenLifecycleEvent.DID_DISAPPEAR -> ScreenDisappearEvent(surfaceId, it.id)
|
|
205
204
|
}
|
|
206
205
|
val screenContext = screen.context as ReactContext
|
|
207
206
|
val eventDispatcher: EventDispatcher? =
|
|
@@ -213,7 +212,7 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
override fun dispatchLifecycleEventInChildContainers(event: ScreenLifecycleEvent) {
|
|
216
|
-
|
|
215
|
+
childScreenContainers.filter { it.screenCount > 0 }.forEach {
|
|
217
216
|
it.topScreen?.fragmentWrapper?.let { fragment -> dispatchLifecycleEvent(event, fragment) }
|
|
218
217
|
}
|
|
219
218
|
}
|
|
@@ -228,14 +227,9 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
228
227
|
|
|
229
228
|
override fun dispatchTransitionProgressEvent(alpha: Float, closing: Boolean) {
|
|
230
229
|
if (this is ScreenStackFragment) {
|
|
231
|
-
if (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- progress is 0 -> key 1
|
|
235
|
-
- progress is 1 -> key 2
|
|
236
|
-
- progress is between 0 and 1 -> key 3
|
|
237
|
-
*/
|
|
238
|
-
val coalescingKey = (if (mProgress == 0.0f) 1 else if (mProgress == 1.0f) 2 else 3).toShort()
|
|
230
|
+
if (transitionProgress != alpha) {
|
|
231
|
+
transitionProgress = max(0.0f, min(1.0f, alpha))
|
|
232
|
+
val coalescingKey = getCoalescingKey(transitionProgress)
|
|
239
233
|
val container: ScreenContainer? = screen.container
|
|
240
234
|
val goingForward = if (container is ScreenStack) container.goingForward else false
|
|
241
235
|
val screenContext = screen.context as ReactContext
|
|
@@ -244,7 +238,7 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
244
238
|
?.dispatchEvent(
|
|
245
239
|
ScreenTransitionProgressEvent(
|
|
246
240
|
UIManagerHelper.getSurfaceId(screenContext),
|
|
247
|
-
screen.id,
|
|
241
|
+
screen.id, transitionProgress, closing, goingForward, coalescingKey
|
|
248
242
|
)
|
|
249
243
|
)
|
|
250
244
|
}
|
|
@@ -252,11 +246,11 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
252
246
|
}
|
|
253
247
|
|
|
254
248
|
override fun addChildScreenContainer(container: ScreenContainer) {
|
|
255
|
-
|
|
249
|
+
childScreenContainers.add(container)
|
|
256
250
|
}
|
|
257
251
|
|
|
258
252
|
override fun removeChildScreenContainer(container: ScreenContainer) {
|
|
259
|
-
|
|
253
|
+
childScreenContainers.remove(container)
|
|
260
254
|
}
|
|
261
255
|
|
|
262
256
|
override fun onViewAnimationStart() {
|
|
@@ -307,7 +301,7 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
307
301
|
?.dispatchEvent(ScreenDismissedEvent(surfaceId, screen.id))
|
|
308
302
|
}
|
|
309
303
|
}
|
|
310
|
-
|
|
304
|
+
childScreenContainers.clear()
|
|
311
305
|
}
|
|
312
306
|
|
|
313
307
|
companion object {
|
|
@@ -327,5 +321,14 @@ open class ScreenFragment : Fragment, ScreenFragmentWrapper {
|
|
|
327
321
|
view.visibility = View.VISIBLE
|
|
328
322
|
return view
|
|
329
323
|
}
|
|
324
|
+
|
|
325
|
+
fun getCoalescingKey(progress: Float): Short {
|
|
326
|
+
/* We want value of 0 and 1 to be always dispatched so we base coalescing key on the progress:
|
|
327
|
+
- progress is 0 -> key 1
|
|
328
|
+
- progress is 1 -> key 2
|
|
329
|
+
- progress is between 0 and 1 -> key 3
|
|
330
|
+
*/
|
|
331
|
+
return (if (progress == 0.0f) 1 else if (progress == 1.0f) 2 else 3).toShort()
|
|
332
|
+
}
|
|
330
333
|
}
|
|
331
334
|
}
|