react-native-screen-transitions 3.6.0 → 3.7.0-alpha.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 +75 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/index.js.map +1 -0
- package/lib/commonjs/shared/adapters/with-screen-transitions/options.js +103 -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/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/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 +199 -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 +62 -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 +81 -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 +123 -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/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 +66 -0
- package/lib/module/shared/adapters/with-screen-transitions/index.js.map +1 -0
- package/lib/module/shared/adapters/with-screen-transitions/options.js +98 -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/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/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 +194 -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 +57 -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 +69 -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 +118 -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/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 +11 -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 +16 -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/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/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 +11 -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/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/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 +155 -0
- package/src/shared/adapters/with-screen-transitions/options.ts +172 -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 +9 -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/hooks/use-maybe-block-visibility.tsx +17 -1
- 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 +368 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.ts +129 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.ts +139 -0
- package/src/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.ts +198 -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/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/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
|
@@ -50,6 +50,11 @@ export type NativeStackNavigationEventMap = {
|
|
|
50
50
|
sheetDetentChange: { data: { index: number; stable: boolean } };
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated The bundled native-stack integration is deprecated and will be removed in a future major release.
|
|
55
|
+
* Use `@react-navigation/native-stack` or Expo Router's native stack with
|
|
56
|
+
* `withScreenTransitions` from `react-native-screen-transitions` instead.
|
|
57
|
+
*/
|
|
53
58
|
export type NativeStackNavigationProp<
|
|
54
59
|
ParamList extends ParamListBase,
|
|
55
60
|
RouteName extends keyof ParamList = string,
|
|
@@ -64,6 +69,11 @@ export type NativeStackNavigationProp<
|
|
|
64
69
|
> &
|
|
65
70
|
StackActionHelpers<ParamList>;
|
|
66
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated The bundled native-stack integration is deprecated and will be removed in a future major release.
|
|
74
|
+
* Use `@react-navigation/native-stack` or Expo Router's native stack with
|
|
75
|
+
* `withScreenTransitions` from `react-native-screen-transitions` instead.
|
|
76
|
+
*/
|
|
67
77
|
export type NativeStackScreenProps<
|
|
68
78
|
ParamList extends ParamListBase,
|
|
69
79
|
RouteName extends keyof ParamList = string,
|
|
@@ -148,6 +158,11 @@ export type NativeStackOverlayProps = OverlayProps<
|
|
|
148
158
|
NativeStackNavigationProp<ParamListBase>
|
|
149
159
|
>;
|
|
150
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated The bundled native-stack integration is deprecated and will be removed in a future major release.
|
|
163
|
+
* Use `NativeStackAdapterOptions` with `withScreenTransitions` from
|
|
164
|
+
* `react-native-screen-transitions` instead.
|
|
165
|
+
*/
|
|
151
166
|
export type NativeStackScreenTransitionConfig = ScreenTransitionConfig & {
|
|
152
167
|
/**
|
|
153
168
|
* Whether to enable transitions. It sets the presentation to containedTransparentModal, animation none, and headerShown to false.
|
|
@@ -155,6 +170,11 @@ export type NativeStackScreenTransitionConfig = ScreenTransitionConfig & {
|
|
|
155
170
|
enableTransitions?: boolean;
|
|
156
171
|
};
|
|
157
172
|
|
|
173
|
+
/**
|
|
174
|
+
* @deprecated The bundled native-stack integration is deprecated and will be removed in a future major release.
|
|
175
|
+
* Use `NativeStackAdapterOptions<NativeStackNavigationOptions>` with
|
|
176
|
+
* `@react-navigation/native-stack` and `withScreenTransitions` instead.
|
|
177
|
+
*/
|
|
158
178
|
export type NativeStackNavigationOptions = NativeStackScreenTransitionConfig & {
|
|
159
179
|
/**
|
|
160
180
|
* String that can be displayed in the header as a fallback for `headerTitle`.
|
|
@@ -701,6 +721,11 @@ export type NativeStackNavigationOptions = NativeStackScreenTransitionConfig & {
|
|
|
701
721
|
unstable_sheetFooter?: () => React.ReactNode;
|
|
702
722
|
};
|
|
703
723
|
|
|
724
|
+
/**
|
|
725
|
+
* @deprecated The bundled native-stack integration is deprecated and will be removed in a future major release.
|
|
726
|
+
* Use `@react-navigation/native-stack` or Expo Router's native stack with
|
|
727
|
+
* `withScreenTransitions` from `react-native-screen-transitions` instead.
|
|
728
|
+
*/
|
|
704
729
|
export type NativeStackNavigatorProps = DefaultNavigatorOptions<
|
|
705
730
|
ParamListBase,
|
|
706
731
|
string | undefined,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import type { BaseStackDescriptor, BaseStackScene } from "../../types";
|
|
3
|
+
|
|
4
|
+
export type ScreenTransitionsAdapterScene =
|
|
5
|
+
BaseStackScene<BaseStackDescriptor> & {
|
|
6
|
+
previousDescriptor?: BaseStackDescriptor;
|
|
7
|
+
nextDescriptor?: BaseStackDescriptor;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface ScreenTransitionsAdapterContextValue {
|
|
11
|
+
routeIndexByKey: ReadonlyMap<string, number>;
|
|
12
|
+
scenes: ScreenTransitionsAdapterScene[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ScreenTransitionsAdapterContext =
|
|
16
|
+
createContext<ScreenTransitionsAdapterContextValue | null>(null);
|
|
17
|
+
|
|
18
|
+
ScreenTransitionsAdapterContext.displayName = "ScreenTransitionsAdapter";
|
|
19
|
+
|
|
20
|
+
export function ScreenTransitionsAdapterProvider({
|
|
21
|
+
children,
|
|
22
|
+
value,
|
|
23
|
+
}: {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
value: ScreenTransitionsAdapterContextValue;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<ScreenTransitionsAdapterContext.Provider value={value}>
|
|
29
|
+
{children}
|
|
30
|
+
</ScreenTransitionsAdapterContext.Provider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function useScreenTransitionsAdapterContext() {
|
|
35
|
+
const context = useContext(ScreenTransitionsAdapterContext);
|
|
36
|
+
if (!context) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
"useScreenTransitionsAdapterContext must be used within withScreenTransitions",
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return context;
|
|
42
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NavigatorTypeBagBase,
|
|
3
|
+
TypedNavigator,
|
|
4
|
+
} from "@react-navigation/native";
|
|
5
|
+
import type { ComponentType, ReactNode } from "react";
|
|
6
|
+
import {
|
|
7
|
+
Children,
|
|
8
|
+
cloneElement,
|
|
9
|
+
forwardRef,
|
|
10
|
+
isValidElement,
|
|
11
|
+
useCallback,
|
|
12
|
+
useMemo,
|
|
13
|
+
} from "react";
|
|
14
|
+
import type {
|
|
15
|
+
NativeStackAdapterOptionInput,
|
|
16
|
+
NativeStackAdapterOptions,
|
|
17
|
+
} from "./options";
|
|
18
|
+
import { adaptNativeStackTransitionOptions } from "./options";
|
|
19
|
+
import {
|
|
20
|
+
ScreenTransitionsScreenLayout,
|
|
21
|
+
ScreenTransitionsStackLayout,
|
|
22
|
+
} from "./stack-layout";
|
|
23
|
+
import type {
|
|
24
|
+
NavigatorLayout,
|
|
25
|
+
NavigatorLayoutArgs,
|
|
26
|
+
NavigatorWithScreenTransitions,
|
|
27
|
+
ScreenLayout,
|
|
28
|
+
ScreenLayoutArgs,
|
|
29
|
+
} from "./types";
|
|
30
|
+
|
|
31
|
+
export type {
|
|
32
|
+
NativeStackAdapterOptions,
|
|
33
|
+
NativeStackNativeGestureOptions,
|
|
34
|
+
ScreenTransitionDescriptorOptions,
|
|
35
|
+
} from "./options";
|
|
36
|
+
export { resolveScreenTransitionOptions } from "./options";
|
|
37
|
+
|
|
38
|
+
type ScreenTransitionsNavigatorProps = {
|
|
39
|
+
layout?: NavigatorLayout;
|
|
40
|
+
screenLayout?: ScreenLayout;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type ScreenTransitionsNavigatorTypeBag<TBag extends NavigatorTypeBagBase> =
|
|
45
|
+
Omit<TBag, "ScreenOptions"> & {
|
|
46
|
+
ScreenOptions: NativeStackAdapterOptions<TBag["ScreenOptions"]>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function adaptNavigatorChildren(children: ReactNode): ReactNode {
|
|
50
|
+
return Children.map(children, (child) => {
|
|
51
|
+
if (!isValidElement(child)) {
|
|
52
|
+
return child;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const props = child.props as Record<string, unknown>;
|
|
56
|
+
const nextProps: Record<string, unknown> = {};
|
|
57
|
+
let changed = false;
|
|
58
|
+
|
|
59
|
+
if ("options" in props) {
|
|
60
|
+
nextProps.options = adaptNativeStackTransitionOptions(
|
|
61
|
+
props.options as NativeStackAdapterOptionInput | undefined,
|
|
62
|
+
);
|
|
63
|
+
changed = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if ("screenOptions" in props) {
|
|
67
|
+
nextProps.screenOptions = adaptNativeStackTransitionOptions(
|
|
68
|
+
props.screenOptions as NativeStackAdapterOptionInput | undefined,
|
|
69
|
+
);
|
|
70
|
+
changed = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (props.children !== undefined && typeof props.children !== "function") {
|
|
74
|
+
nextProps.children = adaptNavigatorChildren(props.children as ReactNode);
|
|
75
|
+
changed = true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!changed) {
|
|
79
|
+
return child;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return cloneElement(child, nextProps);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function withScreenTransitions<
|
|
87
|
+
TBag extends NavigatorTypeBagBase,
|
|
88
|
+
TConfig,
|
|
89
|
+
>(
|
|
90
|
+
navigator: TypedNavigator<TBag, TConfig>,
|
|
91
|
+
): TypedNavigator<ScreenTransitionsNavigatorTypeBag<TBag>, TConfig>;
|
|
92
|
+
export function withScreenTransitions<
|
|
93
|
+
TNavigator extends NavigatorWithScreenTransitions,
|
|
94
|
+
>(navigator: TNavigator): TNavigator;
|
|
95
|
+
export function withScreenTransitions(
|
|
96
|
+
navigator: NavigatorWithScreenTransitions,
|
|
97
|
+
): any {
|
|
98
|
+
const BaseNavigator = navigator.Navigator as ComponentType<any>;
|
|
99
|
+
|
|
100
|
+
const Navigator = forwardRef<unknown, ScreenTransitionsNavigatorProps>(
|
|
101
|
+
function ScreenTransitionsNavigator(
|
|
102
|
+
{ layout, screenLayout, ...props },
|
|
103
|
+
ref,
|
|
104
|
+
) {
|
|
105
|
+
const transitionLayout = useCallback(
|
|
106
|
+
(layoutArgs: NavigatorLayoutArgs) => (
|
|
107
|
+
<ScreenTransitionsStackLayout
|
|
108
|
+
layout={layout}
|
|
109
|
+
layoutArgs={layoutArgs}
|
|
110
|
+
/>
|
|
111
|
+
),
|
|
112
|
+
[layout],
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const transitionScreenLayout = useCallback(
|
|
116
|
+
(screenLayoutArgs: ScreenLayoutArgs) => (
|
|
117
|
+
<ScreenTransitionsScreenLayout
|
|
118
|
+
screenLayout={screenLayout}
|
|
119
|
+
screenLayoutArgs={screenLayoutArgs}
|
|
120
|
+
/>
|
|
121
|
+
),
|
|
122
|
+
[screenLayout],
|
|
123
|
+
);
|
|
124
|
+
const screenOptions = useMemo(
|
|
125
|
+
() => adaptNativeStackTransitionOptions(props.screenOptions),
|
|
126
|
+
[props.screenOptions],
|
|
127
|
+
);
|
|
128
|
+
const children = useMemo(
|
|
129
|
+
() => adaptNavigatorChildren(props.children),
|
|
130
|
+
[props.children],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<BaseNavigator
|
|
135
|
+
{...props}
|
|
136
|
+
screenOptions={screenOptions}
|
|
137
|
+
ref={ref as never}
|
|
138
|
+
layout={transitionLayout}
|
|
139
|
+
screenLayout={transitionScreenLayout}
|
|
140
|
+
>
|
|
141
|
+
{children}
|
|
142
|
+
</BaseNavigator>
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
Navigator.displayName = `withScreenTransitions(${
|
|
148
|
+
BaseNavigator.displayName ?? BaseNavigator.name ?? "Navigator"
|
|
149
|
+
})`;
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
...navigator,
|
|
153
|
+
Navigator,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { ScreenProps } from "react-native-screens";
|
|
2
|
+
import type { ScreenTransitionConfig } from "../../types";
|
|
3
|
+
|
|
4
|
+
type NativeStackTransitionResetOptions = {
|
|
5
|
+
presentation: "containedTransparentModal";
|
|
6
|
+
animation: "none";
|
|
7
|
+
headerShown: false;
|
|
8
|
+
gestureEnabled: false;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type NativeStackNativeGestureOptions = {
|
|
12
|
+
nativeGestureEnabled?: boolean;
|
|
13
|
+
nativeGestureDirection?: ScreenProps["swipeDirection"];
|
|
14
|
+
nativeGestureResponseDistance?: ScreenProps["gestureResponseDistance"];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ScreenTransitionDescriptorOptions = ScreenTransitionConfig & {
|
|
18
|
+
enableTransitions?: boolean;
|
|
19
|
+
screenTransition?: ScreenTransitionConfig | null | false;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type NativeStackAdapterOptions<
|
|
23
|
+
TNativeOptions extends object = Record<string, unknown>,
|
|
24
|
+
> = Omit<
|
|
25
|
+
TNativeOptions,
|
|
26
|
+
| keyof ScreenTransitionDescriptorOptions
|
|
27
|
+
| keyof NativeStackNativeGestureOptions
|
|
28
|
+
> &
|
|
29
|
+
ScreenTransitionDescriptorOptions &
|
|
30
|
+
NativeStackNativeGestureOptions;
|
|
31
|
+
|
|
32
|
+
const NATIVE_STACK_TRANSITION_RESET_OPTIONS: NativeStackTransitionResetOptions =
|
|
33
|
+
{
|
|
34
|
+
presentation: "containedTransparentModal",
|
|
35
|
+
animation: "none",
|
|
36
|
+
headerShown: false,
|
|
37
|
+
gestureEnabled: false,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const COLLIDING_TRANSITION_OPTION_KEYS = [
|
|
41
|
+
"gestureEnabled",
|
|
42
|
+
"gestureDirection",
|
|
43
|
+
"gestureResponseDistance",
|
|
44
|
+
] as const satisfies readonly (keyof ScreenTransitionConfig)[];
|
|
45
|
+
|
|
46
|
+
type CollidingTransitionOptionKey =
|
|
47
|
+
(typeof COLLIDING_TRANSITION_OPTION_KEYS)[number];
|
|
48
|
+
|
|
49
|
+
export type NativeStackAdapterOptionInput =
|
|
50
|
+
| Record<string, unknown>
|
|
51
|
+
| ((...args: any[]) => Record<string, unknown> | undefined);
|
|
52
|
+
|
|
53
|
+
function isPlainOptions(value: unknown): value is Record<string, unknown> {
|
|
54
|
+
return typeof value === "object" && value !== null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function extractCollidingTransitionOptions(
|
|
58
|
+
options: Record<string, unknown>,
|
|
59
|
+
): ScreenTransitionConfig | undefined {
|
|
60
|
+
let screenTransition: ScreenTransitionConfig | undefined;
|
|
61
|
+
|
|
62
|
+
for (const key of COLLIDING_TRANSITION_OPTION_KEYS) {
|
|
63
|
+
if (!(key in options)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
screenTransition ??= {};
|
|
68
|
+
screenTransition[key] = options[key] as never;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return screenTransition;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function removeCollidingTransitionOptions<
|
|
75
|
+
TOptions extends Record<string, unknown>,
|
|
76
|
+
>(options: TOptions): Omit<TOptions, CollidingTransitionOptionKey> {
|
|
77
|
+
const nativeOptions = { ...options };
|
|
78
|
+
|
|
79
|
+
for (const key of COLLIDING_TRANSITION_OPTION_KEYS) {
|
|
80
|
+
delete nativeOptions[key];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return nativeOptions;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function applyNativeGestureAliases<TOptions extends Record<string, unknown>>(
|
|
87
|
+
options: TOptions,
|
|
88
|
+
): TOptions {
|
|
89
|
+
const nativeOptions: Record<string, unknown> = { ...options };
|
|
90
|
+
const {
|
|
91
|
+
nativeGestureEnabled,
|
|
92
|
+
nativeGestureDirection,
|
|
93
|
+
nativeGestureResponseDistance,
|
|
94
|
+
} = options;
|
|
95
|
+
delete nativeOptions.nativeGestureEnabled;
|
|
96
|
+
delete nativeOptions.nativeGestureDirection;
|
|
97
|
+
delete nativeOptions.nativeGestureResponseDistance;
|
|
98
|
+
|
|
99
|
+
if (nativeGestureEnabled !== undefined) {
|
|
100
|
+
nativeOptions.gestureEnabled = nativeGestureEnabled;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (nativeGestureDirection !== undefined) {
|
|
104
|
+
nativeOptions.gestureDirection = nativeGestureDirection;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (nativeGestureResponseDistance !== undefined) {
|
|
108
|
+
nativeOptions.gestureResponseDistance = nativeGestureResponseDistance;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return nativeOptions as TOptions;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function adaptNativeStackTransitionOptions<
|
|
115
|
+
TOptions extends NativeStackAdapterOptionInput | undefined,
|
|
116
|
+
>(options: TOptions): TOptions {
|
|
117
|
+
if (typeof options === "function") {
|
|
118
|
+
return ((...args: any[]) =>
|
|
119
|
+
adaptNativeStackTransitionOptions(options(...args))) as TOptions;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!isPlainOptions(options)) {
|
|
123
|
+
return options;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const inlineScreenTransition = extractCollidingTransitionOptions(options);
|
|
127
|
+
const explicitScreenTransition = options.screenTransition;
|
|
128
|
+
const hasTransitionsEnabled =
|
|
129
|
+
options.enableTransitions === true || !!explicitScreenTransition;
|
|
130
|
+
|
|
131
|
+
if (!hasTransitionsEnabled) {
|
|
132
|
+
return applyNativeGestureAliases(options) as TOptions;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const nativeOptions = applyNativeGestureAliases(
|
|
136
|
+
removeCollidingTransitionOptions(options),
|
|
137
|
+
);
|
|
138
|
+
const nativeGestureEnabled = nativeOptions.gestureEnabled;
|
|
139
|
+
const screenTransition =
|
|
140
|
+
explicitScreenTransition && isPlainOptions(explicitScreenTransition)
|
|
141
|
+
? {
|
|
142
|
+
...inlineScreenTransition,
|
|
143
|
+
...explicitScreenTransition,
|
|
144
|
+
}
|
|
145
|
+
: inlineScreenTransition;
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
...nativeOptions,
|
|
149
|
+
...NATIVE_STACK_TRANSITION_RESET_OPTIONS,
|
|
150
|
+
...(nativeGestureEnabled !== undefined
|
|
151
|
+
? { gestureEnabled: nativeGestureEnabled }
|
|
152
|
+
: null),
|
|
153
|
+
enableTransitions: true,
|
|
154
|
+
...(screenTransition ? { screenTransition } : null),
|
|
155
|
+
} as TOptions;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function resolveScreenTransitionOptions<
|
|
159
|
+
TOptions extends ScreenTransitionDescriptorOptions,
|
|
160
|
+
>(options: TOptions): TOptions & ScreenTransitionConfig {
|
|
161
|
+
const screenTransition = options.screenTransition;
|
|
162
|
+
|
|
163
|
+
if (!screenTransition) {
|
|
164
|
+
return options;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
...options,
|
|
169
|
+
...screenTransition,
|
|
170
|
+
enableTransitions: true,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -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
|
+
resolveScreenTransitionOptions,
|
|
28
|
+
type ScreenTransitionDescriptorOptions,
|
|
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: resolveScreenTransitionOptions(
|
|
67
|
+
descriptor.options as ScreenTransitionDescriptorOptions,
|
|
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 ScreenTransitionDescriptorOptions)
|
|
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";
|