react-native-screen-transitions 3.6.0 → 3.7.0-beta.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 +2 -2
- package/lib/commonjs/blank-stack/components/stack-view.js +35 -39
- package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +7 -14
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/component-stack/components/stack-view.js +4 -11
- package/lib/commonjs/component-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +6 -0
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/shared/adapters/with-screen-transitions/context.js +28 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/context.js.map +1 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/index.js +69 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/index.js.map +1 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/options.js +57 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/options.js.map +1 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js +143 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/types.js +6 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/types.js.map +1 -0
- package/lib/commonjs/shared/components/activity/helpers.js +9 -0
- package/lib/commonjs/shared/components/activity/helpers.js.map +1 -0
- package/lib/commonjs/shared/components/activity/index.js +20 -0
- package/lib/commonjs/shared/components/activity/index.js.map +1 -0
- package/lib/commonjs/shared/components/activity/variants/activity-container.js +29 -0
- package/lib/commonjs/shared/components/activity/variants/activity-container.js.map +1 -0
- package/lib/commonjs/shared/components/activity/variants/activity-screen.js +107 -0
- package/lib/commonjs/shared/components/activity/variants/activity-screen.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js +10 -4
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js +13 -1
- package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js +8 -17
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-navigation-helpers.js +10 -4
- package/lib/commonjs/shared/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js +63 -6
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/index.js +8 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js +18 -29
- package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/descriptors/index.js +6 -0
- package/lib/commonjs/shared/providers/screen/descriptors/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/ownership/resolve-ownership.js +2 -1
- package/lib/commonjs/shared/providers/screen/gestures/ownership/resolve-ownership.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js +4 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js +4 -3
- package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +4 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +4 -3
- package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +7 -28
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +16 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +2 -14
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +4 -3
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +197 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +58 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +92 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +118 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/types.js +6 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/types.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/index.js +24 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/index.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +131 -0
- package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/managed.provider.js +18 -29
- package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/commonjs/shared/types/stack.types.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +4 -4
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js +2 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/commonjs/shared/utils/create-provider.js +99 -10
- package/lib/commonjs/shared/utils/create-provider.js.map +1 -1
- package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js +8 -5
- package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js +23 -6
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
- package/lib/commonjs/shared/utils/visibility-block-offset.js +13 -0
- package/lib/commonjs/shared/utils/visibility-block-offset.js.map +1 -0
- package/lib/module/blank-stack/components/stack-view.js +36 -40
- package/lib/module/blank-stack/components/stack-view.js.map +1 -1
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +7 -14
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/component-stack/components/stack-view.js +4 -11
- package/lib/module/component-stack/components/stack-view.js.map +1 -1
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +6 -0
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/shared/adapters/with-screen-transitions/context.js +23 -0
- package/lib/module/shared/adapters/with-screen-transitions/context.js.map +1 -0
- package/lib/module/shared/adapters/with-screen-transitions/index.js +65 -0
- package/lib/module/shared/adapters/with-screen-transitions/index.js.map +1 -0
- package/lib/module/shared/adapters/with-screen-transitions/options.js +52 -0
- package/lib/module/shared/adapters/with-screen-transitions/options.js.map +1 -0
- package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js +138 -0
- package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -0
- package/lib/module/shared/adapters/with-screen-transitions/types.js +4 -0
- package/lib/module/shared/adapters/with-screen-transitions/types.js.map +1 -0
- package/lib/module/shared/components/activity/helpers.js +5 -0
- package/lib/module/shared/components/activity/helpers.js.map +1 -0
- package/lib/module/shared/components/activity/index.js +5 -0
- package/lib/module/shared/components/activity/index.js.map +1 -0
- package/lib/module/shared/components/activity/variants/activity-container.js +24 -0
- package/lib/module/shared/components/activity/variants/activity-container.js.map +1 -0
- package/lib/module/shared/components/activity/variants/activity-screen.js +103 -0
- package/lib/module/shared/components/activity/variants/activity-screen.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js +11 -5
- package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js +11 -0
- package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js +8 -17
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/index.js +1 -1
- package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-navigation-helpers.js +11 -5
- package/lib/module/shared/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js +63 -6
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/index.js +3 -0
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js +17 -29
- package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/descriptors/index.js +1 -1
- package/lib/module/shared/providers/screen/descriptors/index.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/ownership/resolve-ownership.js +2 -1
- package/lib/module/shared/providers/screen/gestures/ownership/resolve-ownership.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js +2 -2
- package/lib/module/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js +5 -2
- package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js +4 -3
- package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +5 -2
- package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +4 -3
- package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +7 -28
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +16 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js +3 -15
- package/lib/module/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +5 -4
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +192 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +53 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +78 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +113 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/types.js +4 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/types.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/index.js +19 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/index.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +126 -0
- package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -0
- package/lib/module/shared/providers/stack/managed.provider.js +19 -30
- package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/module/shared/types/stack.types.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js +5 -5
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/config.js +1 -0
- package/lib/module/shared/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/module/shared/utils/create-provider.js +100 -11
- package/lib/module/shared/utils/create-provider.js.map +1 -1
- package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js +8 -5
- package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js +23 -6
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
- package/lib/module/shared/utils/visibility-block-offset.js +8 -0
- package/lib/module/shared/utils/visibility-block-offset.js.map +1 -0
- package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/blank-stack/index.d.ts +1 -1
- package/lib/typescript/blank-stack/index.d.ts.map +1 -1
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +4 -6
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +41 -29
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -1
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +5 -0
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +25 -0
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts +15 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts.map +1 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts +10 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts.map +1 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts +9 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts.map +1 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts +12 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts.map +1 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/types.d.ts +24 -0
- package/lib/typescript/shared/adapters/with-screen-transitions/types.d.ts.map +1 -0
- package/lib/typescript/shared/components/activity/helpers.d.ts +4 -0
- package/lib/typescript/shared/components/activity/helpers.d.ts.map +1 -0
- package/lib/typescript/shared/components/activity/index.d.ts +3 -0
- package/lib/typescript/shared/components/activity/index.d.ts.map +1 -0
- package/lib/typescript/shared/components/activity/variants/activity-container.d.ts +6 -0
- package/lib/typescript/shared/components/activity/variants/activity-container.d.ts.map +1 -0
- package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts +13 -0
- package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +2 -2
- package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts +1 -0
- package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts +1 -2
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-navigation-helpers.d.ts +1 -0
- package/lib/typescript/shared/hooks/navigation/use-navigation-helpers.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +13 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +15 -11
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts +11 -3
- package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/index.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/ownership/resolve-ownership.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/pan-lifecycle.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/pan-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/use-pan-behavior.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-lifecycle.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/use-pinch-behavior.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts +1 -2
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +3 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.d.ts +13 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.d.ts +12 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts +13 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.d.ts +12 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/types.d.ts +40 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/types.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/index.d.ts +12 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/index.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.d.ts +13 -0
- package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +19 -0
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +2 -2
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/providers/managed-stack.types.d.ts +3 -9
- package/lib/typescript/shared/types/providers/managed-stack.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +24 -0
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/stack.types.d.ts +7 -0
- package/lib/typescript/shared/types/stack.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts +1 -0
- package/lib/typescript/shared/utils/bounds/navigation/reveal/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/create-provider.d.ts +17 -3
- package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -1
- package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts +2 -1
- package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts.map +1 -1
- package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts +2 -1
- package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts.map +1 -1
- package/lib/typescript/shared/utils/visibility-block-offset.d.ts +2 -0
- package/lib/typescript/shared/utils/visibility-block-offset.d.ts.map +1 -0
- package/package.json +11 -1
- package/src/blank-stack/components/stack-view.tsx +54 -48
- package/src/blank-stack/index.ts +1 -0
- package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +7 -15
- package/src/blank-stack/types.ts +44 -29
- package/src/component-stack/components/stack-view.tsx +4 -11
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +1 -1
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +5 -0
- package/src/native-stack/types.ts +25 -0
- package/src/shared/adapters/with-screen-transitions/context.tsx +42 -0
- package/src/shared/adapters/with-screen-transitions/index.tsx +150 -0
- package/src/shared/adapters/with-screen-transitions/options.ts +101 -0
- package/src/shared/adapters/with-screen-transitions/stack-layout.tsx +233 -0
- package/src/shared/adapters/with-screen-transitions/types.ts +28 -0
- package/src/shared/components/activity/helpers.ts +8 -0
- package/src/shared/components/activity/index.tsx +2 -0
- package/src/shared/components/activity/variants/activity-container.tsx +25 -0
- package/src/shared/components/activity/variants/activity-screen.tsx +133 -0
- package/src/shared/components/create-boundary-component/hooks/use-measurer.ts +23 -4
- package/src/shared/components/create-boundary-component/utils/measured-bounds.ts +15 -0
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition-intent.ts +9 -26
- package/src/shared/components/screen-lifecycle/index.tsx +1 -1
- package/src/shared/hooks/navigation/use-navigation-helpers.ts +9 -3
- package/src/shared/hooks/navigation/use-stack.tsx +115 -6
- package/src/shared/index.ts +5 -0
- package/src/shared/providers/screen/descriptors/descriptors.provider.tsx +31 -31
- package/src/shared/providers/screen/descriptors/index.tsx +1 -0
- package/src/shared/providers/screen/gestures/ownership/resolve-ownership.ts +2 -1
- package/src/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.ts +2 -2
- package/src/shared/providers/screen/gestures/pan/pan-lifecycle.ts +7 -2
- package/src/shared/providers/screen/gestures/pan/use-pan-behavior.ts +10 -2
- package/src/shared/providers/screen/gestures/pinch/pinch-lifecycle.ts +7 -2
- package/src/shared/providers/screen/gestures/pinch/use-pinch-behavior.ts +8 -3
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +12 -53
- package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +17 -1
- package/src/shared/providers/screen/styles/hooks/use-resolved-slot-style-map.tsx +3 -16
- package/src/shared/providers/stack/direct.provider.tsx +13 -4
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.ts +365 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.ts +121 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.ts +158 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.ts +188 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/types.ts +57 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/index.ts +40 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.ts +160 -0
- package/src/shared/providers/stack/managed.provider.tsx +23 -39
- package/src/shared/types/bounds.types.ts +19 -0
- package/src/shared/types/index.ts +3 -0
- package/src/shared/types/providers/managed-stack.types.ts +6 -8
- package/src/shared/types/screen.types.ts +25 -0
- package/src/shared/types/stack.types.ts +11 -0
- package/src/shared/utils/bounds/navigation/reveal/build.ts +10 -6
- package/src/shared/utils/bounds/navigation/reveal/config.ts +1 -0
- package/src/shared/utils/create-provider.tsx +183 -8
- package/src/shared/utils/navigation/resolve-scene-neighbors.ts +9 -4
- package/src/shared/utils/navigation/sync-routes-with-removed.ts +38 -7
- package/src/shared/utils/visibility-block-offset.ts +4 -0
- package/lib/commonjs/blank-stack/components/stack-view.native.js +0 -64
- package/lib/commonjs/blank-stack/components/stack-view.native.js.map +0 -1
- package/lib/commonjs/shared/components/native-screen-container.js +0 -42
- package/lib/commonjs/shared/components/native-screen-container.js.map +0 -1
- package/lib/commonjs/shared/components/native-screen.js +0 -125
- package/lib/commonjs/shared/components/native-screen.js.map +0 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js +0 -51
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js.map +0 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js +0 -15
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js.map +0 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js +0 -14
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js.map +0 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js +0 -13
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js.map +0 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/index.js +0 -101
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/index.js.map +0 -1
- package/lib/module/blank-stack/components/stack-view.native.js +0 -60
- package/lib/module/blank-stack/components/stack-view.native.js.map +0 -1
- package/lib/module/shared/components/native-screen-container.js +0 -37
- package/lib/module/shared/components/native-screen-container.js.map +0 -1
- package/lib/module/shared/components/native-screen.js +0 -119
- package/lib/module/shared/components/native-screen.js.map +0 -1
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js +0 -47
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js.map +0 -1
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js +0 -10
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js.map +0 -1
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js +0 -9
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js.map +0 -1
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js +0 -8
- package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js.map +0 -1
- package/lib/module/shared/providers/stack/helpers/use-local-routes/index.js +0 -95
- package/lib/module/shared/providers/stack/helpers/use-local-routes/index.js.map +0 -1
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts +0 -3
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +0 -1
- package/lib/typescript/shared/components/native-screen-container.d.ts +0 -6
- package/lib/typescript/shared/components/native-screen-container.d.ts.map +0 -1
- package/lib/typescript/shared/components/native-screen.d.ts +0 -12
- package/lib/typescript/shared/components/native-screen.d.ts.map +0 -1
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.d.ts +0 -10
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.d.ts.map +0 -1
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.d.ts +0 -2
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.d.ts.map +0 -1
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.d.ts +0 -3
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.d.ts.map +0 -1
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.d.ts +0 -3
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.d.ts.map +0 -1
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/index.d.ts +0 -19
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes/index.d.ts.map +0 -1
- package/src/blank-stack/components/stack-view.native.tsx +0 -74
- package/src/shared/components/native-screen-container.tsx +0 -33
- package/src/shared/components/native-screen.tsx +0 -176
- package/src/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.ts +0 -65
- package/src/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.ts +0 -15
- package/src/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.ts +0 -12
- package/src/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.ts +0 -11
- package/src/shared/providers/stack/helpers/use-local-routes/index.ts +0 -147
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ScreenTransitionConfig } from "../../types";
|
|
2
|
+
|
|
3
|
+
type NativeStackTransitionResetOptions = {
|
|
4
|
+
presentation: "containedTransparentModal";
|
|
5
|
+
animation: "none";
|
|
6
|
+
headerShown: false;
|
|
7
|
+
gestureEnabled: false;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type AdapterDescriptorOptions = ScreenTransitionConfig & {
|
|
11
|
+
enableTransitions?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type NativeStackAdapterOptions<
|
|
15
|
+
TNativeOptions extends object = Record<string, unknown>,
|
|
16
|
+
> = Omit<TNativeOptions, keyof AdapterDescriptorOptions> &
|
|
17
|
+
AdapterDescriptorOptions;
|
|
18
|
+
|
|
19
|
+
const NATIVE_STACK_TRANSITION_RESET_OPTIONS: NativeStackTransitionResetOptions =
|
|
20
|
+
{
|
|
21
|
+
presentation: "containedTransparentModal",
|
|
22
|
+
animation: "none",
|
|
23
|
+
headerShown: false,
|
|
24
|
+
gestureEnabled: false,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type GestureEnabledRestore = {
|
|
28
|
+
gestureEnabled: ScreenTransitionConfig["gestureEnabled"];
|
|
29
|
+
hasGestureEnabled: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const gestureEnabledRestoreByAdaptedOptions = new WeakMap<
|
|
33
|
+
Record<string, unknown>,
|
|
34
|
+
GestureEnabledRestore
|
|
35
|
+
>();
|
|
36
|
+
|
|
37
|
+
export type NativeStackAdapterOptionInput =
|
|
38
|
+
| Record<string, unknown>
|
|
39
|
+
| ((...args: any[]) => Record<string, unknown> | undefined);
|
|
40
|
+
|
|
41
|
+
function isPlainOptions(value: unknown): value is Record<string, unknown> {
|
|
42
|
+
return typeof value === "object" && value !== null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function adaptNativeStackTransitionOptions<
|
|
46
|
+
TOptions extends NativeStackAdapterOptionInput | undefined,
|
|
47
|
+
>(options: TOptions): TOptions {
|
|
48
|
+
if (typeof options === "function") {
|
|
49
|
+
return ((...args: any[]) =>
|
|
50
|
+
adaptNativeStackTransitionOptions(options(...args))) as TOptions;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!isPlainOptions(options)) {
|
|
54
|
+
return options;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const hasTransitionsEnabled = options.enableTransitions === true;
|
|
58
|
+
|
|
59
|
+
if (!hasTransitionsEnabled) {
|
|
60
|
+
return options;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const nativeOptions = options as Record<string, unknown>;
|
|
64
|
+
const adaptedOptions: Record<string, unknown> = {
|
|
65
|
+
...nativeOptions,
|
|
66
|
+
...NATIVE_STACK_TRANSITION_RESET_OPTIONS,
|
|
67
|
+
enableTransitions: true,
|
|
68
|
+
};
|
|
69
|
+
gestureEnabledRestoreByAdaptedOptions.set(adaptedOptions, {
|
|
70
|
+
gestureEnabled:
|
|
71
|
+
nativeOptions.gestureEnabled as ScreenTransitionConfig["gestureEnabled"],
|
|
72
|
+
hasGestureEnabled: "gestureEnabled" in nativeOptions,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return adaptedOptions as TOptions;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function resolveAdapterTransitionOptions<
|
|
79
|
+
TOptions extends AdapterDescriptorOptions,
|
|
80
|
+
>(options: TOptions): TOptions & ScreenTransitionConfig {
|
|
81
|
+
const gestureEnabledRestore = gestureEnabledRestoreByAdaptedOptions.get(
|
|
82
|
+
options as Record<string, unknown>,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (!gestureEnabledRestore) {
|
|
86
|
+
return options;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const resolvedOptions = {
|
|
90
|
+
...options,
|
|
91
|
+
enableTransitions: true,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
if (gestureEnabledRestore.hasGestureEnabled) {
|
|
95
|
+
resolvedOptions.gestureEnabled = gestureEnabledRestore.gestureEnabled;
|
|
96
|
+
} else {
|
|
97
|
+
delete resolvedOptions.gestureEnabled;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return resolvedOptions;
|
|
101
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { NavigationState, Route } from "@react-navigation/native";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Overlay } from "../../components/overlay";
|
|
4
|
+
import {
|
|
5
|
+
type StackContextValue,
|
|
6
|
+
StackProvider,
|
|
7
|
+
} from "../../hooks/navigation/use-stack";
|
|
8
|
+
import { ScreenComposer } from "../../providers/screen/screen-composer";
|
|
9
|
+
import {
|
|
10
|
+
useStackCoreContext,
|
|
11
|
+
withStackCore,
|
|
12
|
+
} from "../../providers/stack/core.provider";
|
|
13
|
+
import { useStackDerived } from "../../providers/stack/helpers/use-stack-derived";
|
|
14
|
+
import {
|
|
15
|
+
AnimationStore,
|
|
16
|
+
type AnimationStoreMap,
|
|
17
|
+
} from "../../stores/animation.store";
|
|
18
|
+
import type { BaseStackDescriptor, BaseStackRoute } from "../../types";
|
|
19
|
+
import { StackType } from "../../types/stack.types";
|
|
20
|
+
import { isOverlayVisible } from "../../utils/overlay/visibility";
|
|
21
|
+
import {
|
|
22
|
+
ScreenTransitionsAdapterProvider,
|
|
23
|
+
type ScreenTransitionsAdapterScene,
|
|
24
|
+
useScreenTransitionsAdapterContext,
|
|
25
|
+
} from "./context";
|
|
26
|
+
import {
|
|
27
|
+
type AdapterDescriptorOptions,
|
|
28
|
+
resolveAdapterTransitionOptions,
|
|
29
|
+
} from "./options";
|
|
30
|
+
import type {
|
|
31
|
+
NavigatorLayout,
|
|
32
|
+
NavigatorLayoutArgs,
|
|
33
|
+
ScreenLayout,
|
|
34
|
+
ScreenLayoutArgs,
|
|
35
|
+
} from "./types";
|
|
36
|
+
|
|
37
|
+
type DescriptorMap = Record<string, BaseStackDescriptor>;
|
|
38
|
+
|
|
39
|
+
type NavigationStateWithPreloads = NavigationState & {
|
|
40
|
+
preloadedRoutes?: Route<string>[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type TransitionStackState = {
|
|
44
|
+
routes: BaseStackRoute[];
|
|
45
|
+
routeKeys: string[];
|
|
46
|
+
scenes: ScreenTransitionsAdapterScene[];
|
|
47
|
+
animationMaps: AnimationStoreMap[];
|
|
48
|
+
routeIndexByKey: Map<string, number>;
|
|
49
|
+
shouldShowFloatOverlay: boolean;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const EMPTY_PRELOADED_ROUTES: Route<string>[] = [];
|
|
53
|
+
|
|
54
|
+
function getPreloadedRoutes(state: NavigationState): Route<string>[] {
|
|
55
|
+
return (
|
|
56
|
+
(state as NavigationStateWithPreloads).preloadedRoutes ??
|
|
57
|
+
EMPTY_PRELOADED_ROUTES
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function normalizeDescriptor(
|
|
62
|
+
descriptor: BaseStackDescriptor,
|
|
63
|
+
): BaseStackDescriptor {
|
|
64
|
+
return {
|
|
65
|
+
...descriptor,
|
|
66
|
+
options: resolveAdapterTransitionOptions(
|
|
67
|
+
descriptor.options as AdapterDescriptorOptions,
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function buildTransitionStackState({
|
|
73
|
+
state,
|
|
74
|
+
descriptors,
|
|
75
|
+
}: {
|
|
76
|
+
state: NavigationState;
|
|
77
|
+
descriptors: DescriptorMap;
|
|
78
|
+
}): TransitionStackState {
|
|
79
|
+
const routes = state.routes as BaseStackRoute[];
|
|
80
|
+
const preloadedRoutes = getPreloadedRoutes(state) as BaseStackRoute[];
|
|
81
|
+
const allRoutes = routes.concat(preloadedRoutes);
|
|
82
|
+
const routeKeys: string[] = [];
|
|
83
|
+
const scenes: ScreenTransitionsAdapterScene[] = [];
|
|
84
|
+
const animationMaps: AnimationStoreMap[] = [];
|
|
85
|
+
const routeIndexByKey = new Map<string, number>();
|
|
86
|
+
let shouldShowFloatOverlay = false;
|
|
87
|
+
|
|
88
|
+
for (const route of allRoutes) {
|
|
89
|
+
const descriptor = descriptors[route.key];
|
|
90
|
+
if (!descriptor) {
|
|
91
|
+
if (preloadedRoutes.includes(route)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
throw new Error(
|
|
96
|
+
`withScreenTransitions could not find a descriptor for route "${route.key}".`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const normalizedDescriptor = normalizeDescriptor(descriptor);
|
|
101
|
+
const sceneIndex = scenes.length;
|
|
102
|
+
const previousDescriptor = scenes[sceneIndex - 1]?.descriptor;
|
|
103
|
+
|
|
104
|
+
if (previousDescriptor) {
|
|
105
|
+
scenes[sceneIndex - 1] = {
|
|
106
|
+
...scenes[sceneIndex - 1],
|
|
107
|
+
nextDescriptor: normalizedDescriptor,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
scenes.push({
|
|
112
|
+
route,
|
|
113
|
+
descriptor: normalizedDescriptor,
|
|
114
|
+
previousDescriptor,
|
|
115
|
+
});
|
|
116
|
+
routeKeys.push(route.key);
|
|
117
|
+
animationMaps.push(AnimationStore.getBag(route.key));
|
|
118
|
+
routeIndexByKey.set(route.key, sceneIndex);
|
|
119
|
+
|
|
120
|
+
if (
|
|
121
|
+
!shouldShowFloatOverlay &&
|
|
122
|
+
(normalizedDescriptor.options as AdapterDescriptorOptions)
|
|
123
|
+
.enableTransitions &&
|
|
124
|
+
isOverlayVisible(normalizedDescriptor.options)
|
|
125
|
+
) {
|
|
126
|
+
shouldShowFloatOverlay = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
routes: allRoutes,
|
|
132
|
+
routeKeys,
|
|
133
|
+
scenes,
|
|
134
|
+
animationMaps,
|
|
135
|
+
routeIndexByKey,
|
|
136
|
+
shouldShowFloatOverlay,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type ScreenTransitionsStackContentProps = {
|
|
141
|
+
layout?: NavigatorLayout;
|
|
142
|
+
layoutArgs: NavigatorLayoutArgs;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
function ScreenTransitionsStackContent({
|
|
146
|
+
layout,
|
|
147
|
+
layoutArgs,
|
|
148
|
+
}: ScreenTransitionsStackContentProps) {
|
|
149
|
+
const { flags } = useStackCoreContext();
|
|
150
|
+
const transitionState = useMemo(
|
|
151
|
+
() =>
|
|
152
|
+
buildTransitionStackState({
|
|
153
|
+
state: layoutArgs.state,
|
|
154
|
+
descriptors: layoutArgs.descriptors as DescriptorMap,
|
|
155
|
+
}),
|
|
156
|
+
[layoutArgs.state, layoutArgs.descriptors],
|
|
157
|
+
);
|
|
158
|
+
const { optimisticFocusedIndex } = useStackDerived(
|
|
159
|
+
transitionState.animationMaps,
|
|
160
|
+
);
|
|
161
|
+
const stackContextValue = useMemo<StackContextValue>(
|
|
162
|
+
() => ({
|
|
163
|
+
flags,
|
|
164
|
+
navigatorKey: layoutArgs.state.key,
|
|
165
|
+
routeKeys: transitionState.routeKeys,
|
|
166
|
+
routes: transitionState.routes as Route<string>[],
|
|
167
|
+
scenes: transitionState.scenes,
|
|
168
|
+
optimisticFocusedIndex,
|
|
169
|
+
focusedIndex: layoutArgs.state.index,
|
|
170
|
+
}),
|
|
171
|
+
[
|
|
172
|
+
flags,
|
|
173
|
+
layoutArgs.state.key,
|
|
174
|
+
layoutArgs.state.index,
|
|
175
|
+
transitionState.routeKeys,
|
|
176
|
+
transitionState.routes,
|
|
177
|
+
transitionState.scenes,
|
|
178
|
+
optimisticFocusedIndex,
|
|
179
|
+
],
|
|
180
|
+
);
|
|
181
|
+
const adapterContextValue = useMemo(
|
|
182
|
+
() => ({
|
|
183
|
+
routeIndexByKey: transitionState.routeIndexByKey,
|
|
184
|
+
scenes: transitionState.scenes,
|
|
185
|
+
}),
|
|
186
|
+
[transitionState.routeIndexByKey, transitionState.scenes],
|
|
187
|
+
);
|
|
188
|
+
const children = layout ? layout(layoutArgs) : layoutArgs.children;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<ScreenTransitionsAdapterProvider value={adapterContextValue}>
|
|
192
|
+
<StackProvider value={stackContextValue}>
|
|
193
|
+
{transitionState.shouldShowFloatOverlay ? <Overlay.Float /> : null}
|
|
194
|
+
{children}
|
|
195
|
+
</StackProvider>
|
|
196
|
+
</ScreenTransitionsAdapterProvider>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const ScreenTransitionsStackLayout = withStackCore(
|
|
201
|
+
{ TRANSITIONS_ALWAYS_ON: false, STACK_TYPE: StackType.NATIVE },
|
|
202
|
+
ScreenTransitionsStackContent,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
export function ScreenTransitionsScreenLayout({
|
|
206
|
+
screenLayout,
|
|
207
|
+
screenLayoutArgs,
|
|
208
|
+
}: {
|
|
209
|
+
screenLayout?: ScreenLayout;
|
|
210
|
+
screenLayoutArgs: ScreenLayoutArgs;
|
|
211
|
+
}) {
|
|
212
|
+
const { routeIndexByKey, scenes } = useScreenTransitionsAdapterContext();
|
|
213
|
+
const sceneIndex = routeIndexByKey.get(screenLayoutArgs.route.key);
|
|
214
|
+
const children = screenLayout
|
|
215
|
+
? screenLayout(screenLayoutArgs)
|
|
216
|
+
: screenLayoutArgs.children;
|
|
217
|
+
|
|
218
|
+
if (sceneIndex === undefined) {
|
|
219
|
+
return <>{children}</>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const scene = scenes[sceneIndex];
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<ScreenComposer
|
|
226
|
+
previous={scene.previousDescriptor}
|
|
227
|
+
current={scene.descriptor}
|
|
228
|
+
next={scene.nextDescriptor}
|
|
229
|
+
>
|
|
230
|
+
{children}
|
|
231
|
+
</ScreenComposer>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type NavigatorLayoutArgs = {
|
|
4
|
+
state: any;
|
|
5
|
+
navigation: any;
|
|
6
|
+
descriptors: Record<string, any>;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type NavigatorLayout = (
|
|
11
|
+
props: NavigatorLayoutArgs,
|
|
12
|
+
) => React.ReactElement;
|
|
13
|
+
|
|
14
|
+
export type ScreenLayoutArgs = {
|
|
15
|
+
route: { key: string };
|
|
16
|
+
navigation: any;
|
|
17
|
+
options: any;
|
|
18
|
+
theme: any;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ScreenLayout = (props: ScreenLayoutArgs) => React.ReactElement;
|
|
23
|
+
|
|
24
|
+
export type NavigatorWithScreenTransitions = {
|
|
25
|
+
Navigator: ComponentType<any>;
|
|
26
|
+
Screen: unknown;
|
|
27
|
+
Group: unknown;
|
|
28
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IS_WEB } from "../../constants";
|
|
2
|
+
import type { InactiveBehavior } from "../../types/screen.types";
|
|
3
|
+
|
|
4
|
+
export type { InactiveBehavior } from "../../types/screen.types";
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_INACTIVE_BEHAVIOR: InactiveBehavior = IS_WEB
|
|
7
|
+
? "unmount"
|
|
8
|
+
: "detach";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleSheet, View } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { ScreenContainer } from "react-native-screens";
|
|
4
|
+
import { IS_WEB } from "../../../constants";
|
|
5
|
+
import { useStack } from "../../../hooks/navigation/use-stack";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ActivityContainer = ({ children }: Props) => {
|
|
12
|
+
const nativeScreenDisabled = useStack((s) => s.flags.DISABLE_NATIVE_SCREENS);
|
|
13
|
+
const Component = IS_WEB || nativeScreenDisabled ? View : ScreenContainer;
|
|
14
|
+
return (
|
|
15
|
+
<Component collapsable={false} style={styles.container}>
|
|
16
|
+
{children}
|
|
17
|
+
</Component>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
container: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { StyleSheet, View, type ViewProps } from "react-native";
|
|
4
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
5
|
+
import { Screen } from "react-native-screens";
|
|
6
|
+
import { IS_WEB } from "../../../constants";
|
|
7
|
+
import { useStack } from "../../../hooks/navigation/use-stack";
|
|
8
|
+
import { useSharedValueState } from "../../../hooks/reanimated/use-shared-value-state";
|
|
9
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
10
|
+
import type { StackSceneActivity } from "../../../types/stack.types";
|
|
11
|
+
import { DEFAULT_INACTIVE_BEHAVIOR, type InactiveBehavior } from "../helpers";
|
|
12
|
+
|
|
13
|
+
type ActivityState = 0 | 1 | 2;
|
|
14
|
+
const ActivityStateByActivity = {
|
|
15
|
+
active: 2,
|
|
16
|
+
inert: 1,
|
|
17
|
+
inactive: 0,
|
|
18
|
+
closing: 1,
|
|
19
|
+
} satisfies Record<StackSceneActivity, ActivityState>;
|
|
20
|
+
|
|
21
|
+
const PointerEventsByActivity = {
|
|
22
|
+
active: "auto",
|
|
23
|
+
inert: "auto",
|
|
24
|
+
inactive: "none",
|
|
25
|
+
closing: "none",
|
|
26
|
+
} satisfies Record<StackSceneActivity, ViewProps["pointerEvents"]>;
|
|
27
|
+
|
|
28
|
+
interface ActivityScreenProps {
|
|
29
|
+
activity: StackSceneActivity;
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
inactiveBehavior?: InactiveBehavior;
|
|
32
|
+
paintDriverRouteKey?: string;
|
|
33
|
+
hasNestedState?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const ActivityScreen = memo(function ActivityScreen({
|
|
37
|
+
activity,
|
|
38
|
+
children,
|
|
39
|
+
inactiveBehavior = DEFAULT_INACTIVE_BEHAVIOR,
|
|
40
|
+
paintDriverRouteKey,
|
|
41
|
+
hasNestedState,
|
|
42
|
+
}: ActivityScreenProps) {
|
|
43
|
+
const nativeScreenDisabled = useStack((s) => s.flags.DISABLE_NATIVE_SCREENS);
|
|
44
|
+
const paintDriverAnimations = paintDriverRouteKey
|
|
45
|
+
? AnimationStore.getBag(paintDriverRouteKey)
|
|
46
|
+
: undefined;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Avoid hiding inactive content until the screen that exposes it has settled.
|
|
50
|
+
*
|
|
51
|
+
* For A(inactive), B(inert), C(active), A's paint depends on C finishing its
|
|
52
|
+
* transition. Watching B can still leave a brief blank frame, so we wait for
|
|
53
|
+
* C's progress to reach its settled value of 1 before hiding A.
|
|
54
|
+
*/
|
|
55
|
+
const isPaintDriverSettled = useDerivedValue(() => {
|
|
56
|
+
"worklet";
|
|
57
|
+
|
|
58
|
+
if (!paintDriverAnimations) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return paintDriverAnimations.progress.get() >= 1;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const isPaintDriverSettledOnJS = useSharedValueState(isPaintDriverSettled);
|
|
66
|
+
|
|
67
|
+
let activityState: ActivityState = ActivityStateByActivity[activity];
|
|
68
|
+
let shouldFreeze = false;
|
|
69
|
+
let visible = activity !== "inactive";
|
|
70
|
+
|
|
71
|
+
const shouldWaitForPaintDriver = !isPaintDriverSettledOnJS;
|
|
72
|
+
|
|
73
|
+
if (activity === "inactive") {
|
|
74
|
+
if (inactiveBehavior === "keep") {
|
|
75
|
+
activityState = 1;
|
|
76
|
+
visible = true;
|
|
77
|
+
} else if (shouldWaitForPaintDriver) {
|
|
78
|
+
// Delay hiding until the paint driver has settled to avoid
|
|
79
|
+
// a blank frame during the transition.
|
|
80
|
+
activityState = 1;
|
|
81
|
+
visible = true;
|
|
82
|
+
} else if (inactiveBehavior === "freeze") {
|
|
83
|
+
activityState = 1;
|
|
84
|
+
shouldFreeze = true;
|
|
85
|
+
visible = true;
|
|
86
|
+
} else {
|
|
87
|
+
// `detach` hides native presentation. Non-nested `unmount`
|
|
88
|
+
// removes the React subtree through the JS guard below.
|
|
89
|
+
activityState = 0;
|
|
90
|
+
visible = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const shouldUnmount =
|
|
95
|
+
inactiveBehavior === "unmount" &&
|
|
96
|
+
activity === "inactive" &&
|
|
97
|
+
!hasNestedState &&
|
|
98
|
+
isPaintDriverSettledOnJS;
|
|
99
|
+
|
|
100
|
+
const pointerEvents = PointerEventsByActivity[activity];
|
|
101
|
+
|
|
102
|
+
if (shouldUnmount) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const style = [StyleSheet.absoluteFill, visible ? undefined : styles.hidden];
|
|
107
|
+
|
|
108
|
+
if (IS_WEB || nativeScreenDisabled) {
|
|
109
|
+
return (
|
|
110
|
+
<View style={style} pointerEvents={pointerEvents} collapsable={false}>
|
|
111
|
+
{children}
|
|
112
|
+
</View>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Screen
|
|
118
|
+
style={style}
|
|
119
|
+
activityState={activityState}
|
|
120
|
+
shouldFreeze={shouldFreeze}
|
|
121
|
+
pointerEvents={pointerEvents}
|
|
122
|
+
collapsable={false}
|
|
123
|
+
>
|
|
124
|
+
{children}
|
|
125
|
+
</Screen>
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const styles = StyleSheet.create({
|
|
130
|
+
hidden: {
|
|
131
|
+
display: "none",
|
|
132
|
+
},
|
|
133
|
+
});
|
|
@@ -9,8 +9,10 @@ import {
|
|
|
9
9
|
} from "../../../stores/bounds/internals/links";
|
|
10
10
|
import { ScrollStore } from "../../../stores/scroll.store";
|
|
11
11
|
import { SystemStore } from "../../../stores/system.store";
|
|
12
|
+
import { getVisibilityBlockOffset } from "../../../utils/visibility-block-offset";
|
|
12
13
|
import type { MeasureBoundary } from "../types";
|
|
13
14
|
import {
|
|
15
|
+
applyVisibilityBlockOffset,
|
|
14
16
|
isMeasurementInViewport,
|
|
15
17
|
measureWithOverscrollAwareness,
|
|
16
18
|
} from "../utils/measured-bounds";
|
|
@@ -55,6 +57,19 @@ export const useMeasurer = ({
|
|
|
55
57
|
|
|
56
58
|
if (!measured) return;
|
|
57
59
|
|
|
60
|
+
// Source boundaries do not need offset correction. Only destination
|
|
61
|
+
// captures can measure while the visibility gate is still blocked.
|
|
62
|
+
const shouldAdjustBlockedDestination =
|
|
63
|
+
target.type === "destination" &&
|
|
64
|
+
pendingLifecycleStartBlockCount.get() > 0;
|
|
65
|
+
|
|
66
|
+
const normalizedMeasured = shouldAdjustBlockedDestination
|
|
67
|
+
? applyVisibilityBlockOffset(
|
|
68
|
+
measured,
|
|
69
|
+
getVisibilityBlockOffset(viewportHeight),
|
|
70
|
+
)
|
|
71
|
+
: measured;
|
|
72
|
+
|
|
58
73
|
/**
|
|
59
74
|
* - Destination Pass -
|
|
60
75
|
* Be strict while lifecycle start is blocked for destination capture.
|
|
@@ -68,14 +83,18 @@ export const useMeasurer = ({
|
|
|
68
83
|
const viewportAllowsDestinationWrite =
|
|
69
84
|
target.type !== "destination" ||
|
|
70
85
|
!shouldGuardDestinationViewport ||
|
|
71
|
-
isMeasurementInViewport(
|
|
86
|
+
isMeasurementInViewport(
|
|
87
|
+
normalizedMeasured,
|
|
88
|
+
viewportWidth,
|
|
89
|
+
viewportHeight,
|
|
90
|
+
);
|
|
72
91
|
|
|
73
92
|
if (!viewportAllowsDestinationWrite) return;
|
|
74
93
|
|
|
75
94
|
// Set the bounds entry on every measure to avoid any stale measurements
|
|
76
95
|
// for the public read API.
|
|
77
96
|
setEntry(entryTag, currentScreenKey, {
|
|
78
|
-
bounds:
|
|
97
|
+
bounds: normalizedMeasured,
|
|
79
98
|
});
|
|
80
99
|
|
|
81
100
|
if (target.type === "source") {
|
|
@@ -83,7 +102,7 @@ export const useMeasurer = ({
|
|
|
83
102
|
target.pairKey,
|
|
84
103
|
linkId,
|
|
85
104
|
currentScreenKey,
|
|
86
|
-
|
|
105
|
+
normalizedMeasured,
|
|
87
106
|
preparedStyles,
|
|
88
107
|
group,
|
|
89
108
|
);
|
|
@@ -94,7 +113,7 @@ export const useMeasurer = ({
|
|
|
94
113
|
target.pairKey,
|
|
95
114
|
linkId,
|
|
96
115
|
currentScreenKey,
|
|
97
|
-
|
|
116
|
+
normalizedMeasured,
|
|
98
117
|
preparedStyles,
|
|
99
118
|
group,
|
|
100
119
|
);
|
|
@@ -46,6 +46,21 @@ export const adjustedMeasuredBoundsForOverscrollDeltas = (
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
export const applyVisibilityBlockOffset = (
|
|
50
|
+
measured: MeasuredDimensions,
|
|
51
|
+
offset: number,
|
|
52
|
+
): MeasuredDimensions => {
|
|
53
|
+
"worklet";
|
|
54
|
+
if (offset === 0) {
|
|
55
|
+
return measured;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
...measured,
|
|
60
|
+
pageY: measured.pageY - offset,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
49
64
|
export const isMeasurementInViewport = (
|
|
50
65
|
measured: MeasuredDimensions,
|
|
51
66
|
viewportWidth: number,
|