react-native-screen-transitions 3.0.0 → 3.2.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 +179 -48
- package/lib/commonjs/blank-stack/components/screens.js +2 -2
- package/lib/commonjs/blank-stack/components/screens.js.map +1 -1
- package/lib/commonjs/blank-stack/components/stack-view.js +42 -51
- package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/{shared/components → blank-stack}/controllers/blank-stack-lifecycle.js +17 -8
- package/lib/commonjs/blank-stack/controllers/blank-stack-lifecycle.js.map +1 -0
- package/lib/commonjs/component-stack/components/component-view.js +63 -0
- package/lib/commonjs/component-stack/components/component-view.js.map +1 -0
- package/lib/commonjs/component-stack/components/screens.js +64 -0
- package/lib/commonjs/component-stack/components/screens.js.map +1 -0
- package/lib/commonjs/component-stack/controllers/component-stack-lifecycle.js +82 -0
- package/lib/commonjs/component-stack/controllers/component-stack-lifecycle.js.map +1 -0
- package/lib/commonjs/component-stack/hooks/use-component-navigation-builder.js +321 -0
- package/lib/commonjs/component-stack/hooks/use-component-navigation-builder.js.map +1 -0
- package/lib/commonjs/component-stack/hooks/use-component-navigation.js +28 -0
- package/lib/commonjs/component-stack/hooks/use-component-navigation.js.map +1 -0
- package/lib/commonjs/component-stack/index.js +20 -0
- package/lib/commonjs/component-stack/index.js.map +1 -0
- package/lib/commonjs/component-stack/navigators/create-component-navigator.js +97 -0
- package/lib/commonjs/component-stack/navigators/create-component-navigator.js.map +1 -0
- package/lib/commonjs/component-stack/types.js.map +1 -0
- package/lib/commonjs/{shared/components → native-stack}/controllers/native-stack-lifecycle.js +18 -9
- package/lib/commonjs/native-stack/controllers/native-stack-lifecycle.js.map +1 -0
- package/lib/commonjs/native-stack/views/NativeStackView.native.js +120 -121
- package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js +64 -0
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/index.js +15 -0
- package/lib/commonjs/shared/components/overlay/index.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/variations/container-overlay.js +99 -0
- package/lib/commonjs/shared/components/overlay/variations/container-overlay.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +51 -0
- package/lib/commonjs/shared/components/overlay/variations/float-overlay.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +124 -0
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js +47 -0
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js.map +1 -0
- package/lib/commonjs/shared/components/root-transition-aware.js +2 -2
- package/lib/commonjs/shared/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/shared/constants.js +2 -31
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-high-refresh-rate.js +30 -0
- package/lib/commonjs/shared/hooks/animation/use-high-refresh-rate.js.map +1 -0
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +17 -9
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/commonjs/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-closing-route-keys.js +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-closing-route-keys.js.map +1 -0
- package/lib/commonjs/shared/hooks/navigation/use-previous.js.map +1 -0
- package/lib/commonjs/shared/hooks/navigation/use-stack.js +37 -0
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -0
- package/lib/commonjs/shared/providers/gestures.provider.js +1 -1
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +11 -5
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/{keys.provider.js → screen/keys.provider.js} +12 -0
- package/lib/commonjs/shared/providers/screen/keys.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/{screen-transition.provider.js → screen/screen-composer.js} +7 -7
- package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -0
- package/lib/commonjs/shared/providers/{transition-styles.provider.js → screen/styles.provider.js} +12 -13
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/core.provider.js +61 -0
- package/lib/commonjs/shared/providers/stack/core.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/direct.provider.js +158 -0
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -0
- package/lib/commonjs/{blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.js → shared/providers/stack/helpers/active-screens-limit.js} +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/active-screens-limit.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes.js +93 -0
- package/lib/commonjs/shared/providers/stack/helpers/use-local-routes.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/managed.provider.js +155 -0
- package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -0
- package/lib/commonjs/shared/stores/bounds.store.js.map +1 -1
- package/lib/commonjs/shared/types/index.js +19 -0
- package/lib/commonjs/shared/types/index.js.map +1 -0
- package/lib/commonjs/shared/types/overlay.types.js +6 -0
- package/lib/commonjs/shared/types/overlay.types.js.map +1 -0
- package/lib/commonjs/shared/types/screen.types.js +6 -0
- package/lib/commonjs/shared/types/screen.types.js.map +1 -0
- package/lib/commonjs/shared/types/{core.types.js → stack.types.js} +1 -1
- package/lib/commonjs/shared/types/{core.types.js.map → stack.types.js.map} +1 -1
- package/lib/commonjs/shared/utils/animation/derivations.js +7 -0
- package/lib/commonjs/shared/utils/animation/derivations.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/create-provider.js +16 -13
- package/lib/commonjs/shared/utils/create-provider.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/commonjs/shared/utils/navigation/align-routes-with-latest.js +51 -0
- package/lib/commonjs/shared/utils/navigation/align-routes-with-latest.js.map +1 -0
- package/lib/commonjs/shared/utils/navigation/are-descriptors-equal.js.map +1 -0
- package/lib/commonjs/shared/utils/navigation/compose-descriptors.js.map +1 -0
- package/lib/commonjs/shared/utils/navigation/have-same-route-keys.js.map +1 -0
- package/lib/commonjs/shared/utils/navigation/routes-are-identical.js.map +1 -0
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js +95 -0
- package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js.map +1 -0
- package/lib/commonjs/shared/utils/read-shared-value.js +17 -0
- package/lib/commonjs/shared/utils/read-shared-value.js.map +1 -0
- package/lib/commonjs/shared/utils/reset-stores-for-screen.js +2 -1
- package/lib/commonjs/shared/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/module/blank-stack/components/screens.js +2 -2
- package/lib/module/blank-stack/components/screens.js.map +1 -1
- package/lib/module/blank-stack/components/stack-view.js +41 -50
- package/lib/module/blank-stack/components/stack-view.js.map +1 -1
- package/lib/module/{shared/components → blank-stack}/controllers/blank-stack-lifecycle.js +18 -9
- package/lib/module/blank-stack/controllers/blank-stack-lifecycle.js.map +1 -0
- package/lib/module/component-stack/components/component-view.js +58 -0
- package/lib/module/component-stack/components/component-view.js.map +1 -0
- package/lib/module/component-stack/components/screens.js +58 -0
- package/lib/module/component-stack/components/screens.js.map +1 -0
- package/lib/module/component-stack/controllers/component-stack-lifecycle.js +76 -0
- package/lib/module/component-stack/controllers/component-stack-lifecycle.js.map +1 -0
- package/lib/module/component-stack/hooks/use-component-navigation-builder.js +316 -0
- package/lib/module/component-stack/hooks/use-component-navigation-builder.js.map +1 -0
- package/lib/module/component-stack/hooks/use-component-navigation.js +25 -0
- package/lib/module/component-stack/hooks/use-component-navigation.js.map +1 -0
- package/lib/module/component-stack/index.js +5 -0
- package/lib/module/component-stack/index.js.map +1 -0
- package/lib/module/component-stack/navigators/create-component-navigator.js +91 -0
- package/lib/module/component-stack/navigators/create-component-navigator.js.map +1 -0
- package/lib/module/component-stack/types.js.map +1 -0
- package/lib/module/{shared/components → native-stack}/controllers/native-stack-lifecycle.js +18 -9
- package/lib/module/native-stack/controllers/native-stack-lifecycle.js.map +1 -0
- package/lib/module/native-stack/views/NativeStackView.native.js +121 -122
- package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js +59 -0
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js.map +1 -0
- package/lib/module/shared/components/overlay/index.js +11 -0
- package/lib/module/shared/components/overlay/index.js.map +1 -0
- package/lib/module/shared/components/overlay/variations/container-overlay.js +97 -0
- package/lib/module/shared/components/overlay/variations/container-overlay.js.map +1 -0
- package/lib/module/shared/components/overlay/variations/float-overlay.js +48 -0
- package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -0
- package/lib/module/shared/components/overlay/variations/overlay-host.js +120 -0
- package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -0
- package/lib/module/shared/components/overlay/variations/screen-overlay.js +44 -0
- package/lib/module/shared/components/overlay/variations/screen-overlay.js.map +1 -0
- package/lib/module/shared/components/root-transition-aware.js +2 -2
- package/lib/module/shared/components/root-transition-aware.js.map +1 -1
- package/lib/module/shared/constants.js +0 -29
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-high-refresh-rate.js +24 -0
- package/lib/module/shared/hooks/animation/use-high-refresh-rate.js.map +1 -0
- package/lib/module/shared/hooks/animation/use-screen-animation.js +17 -9
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/module/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-closing-route-keys.js +1 -1
- package/lib/module/shared/hooks/navigation/use-closing-route-keys.js.map +1 -0
- package/lib/module/shared/hooks/navigation/use-previous.js.map +1 -0
- package/lib/module/shared/hooks/navigation/use-stack.js +33 -0
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -0
- package/lib/module/shared/providers/gestures.provider.js +1 -1
- package/lib/module/shared/providers/gestures.provider.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +11 -5
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/{keys.provider.js → screen/keys.provider.js} +12 -0
- package/lib/module/shared/providers/screen/keys.provider.js.map +1 -0
- package/lib/module/shared/providers/{screen-transition.provider.js → screen/screen-composer.js} +6 -6
- package/lib/module/shared/providers/screen/screen-composer.js.map +1 -0
- package/lib/module/shared/providers/{transition-styles.provider.js → screen/styles.provider.js} +10 -10
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -0
- package/lib/module/shared/providers/stack/core.provider.js +55 -0
- package/lib/module/shared/providers/stack/core.provider.js.map +1 -0
- package/lib/module/shared/providers/stack/direct.provider.js +153 -0
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -0
- package/lib/module/{blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.js → shared/providers/stack/helpers/active-screens-limit.js} +1 -1
- package/lib/module/shared/providers/stack/helpers/active-screens-limit.js.map +1 -0
- package/lib/module/shared/providers/stack/helpers/use-local-routes.js +87 -0
- package/lib/module/shared/providers/stack/helpers/use-local-routes.js.map +1 -0
- package/lib/module/shared/providers/stack/managed.provider.js +150 -0
- package/lib/module/shared/providers/stack/managed.provider.js.map +1 -0
- package/lib/module/shared/stores/bounds.store.js.map +1 -1
- package/lib/module/shared/types/index.js +4 -0
- package/lib/module/shared/types/index.js.map +1 -0
- package/lib/module/shared/types/overlay.types.js +4 -0
- package/lib/module/shared/types/overlay.types.js.map +1 -0
- package/lib/module/shared/types/screen.types.js +4 -0
- package/lib/module/shared/types/screen.types.js.map +1 -0
- package/lib/module/shared/types/stack.types.js +4 -0
- package/lib/{commonjs/shared/types/utils.types.js.map → module/shared/types/stack.types.js.map} +1 -1
- package/lib/module/shared/utils/animation/derivations.js +7 -0
- package/lib/module/shared/utils/animation/derivations.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/create-provider.js +16 -13
- package/lib/module/shared/utils/create-provider.js.map +1 -1
- package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/shared/utils/navigation/align-routes-with-latest.js +46 -0
- package/lib/module/shared/utils/navigation/align-routes-with-latest.js.map +1 -0
- package/lib/module/shared/utils/navigation/are-descriptors-equal.js.map +1 -0
- package/lib/module/shared/utils/navigation/compose-descriptors.js.map +1 -0
- package/lib/module/shared/utils/navigation/have-same-route-keys.js.map +1 -0
- package/lib/module/shared/utils/navigation/routes-are-identical.js.map +1 -0
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js +90 -0
- package/lib/module/shared/utils/navigation/sync-routes-with-removed.js.map +1 -0
- package/lib/module/shared/utils/read-shared-value.js +14 -0
- package/lib/module/shared/utils/read-shared-value.js.map +1 -0
- package/lib/module/shared/utils/reset-stores-for-screen.js +2 -2
- package/lib/module/shared/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/typescript/blank-stack/components/stack-view.d.ts +2 -1
- package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
- package/lib/typescript/{shared/components → blank-stack}/controllers/blank-stack-lifecycle.d.ts +2 -1
- package/lib/typescript/blank-stack/controllers/blank-stack-lifecycle.d.ts.map +1 -0
- package/lib/typescript/blank-stack/types.d.ts +9 -50
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/component-view.d.ts +4 -0
- package/lib/typescript/component-stack/components/component-view.d.ts.map +1 -0
- package/lib/typescript/component-stack/components/screens.d.ts +9 -0
- package/lib/typescript/component-stack/components/screens.d.ts.map +1 -0
- package/lib/typescript/component-stack/controllers/component-stack-lifecycle.d.ts +10 -0
- package/lib/typescript/component-stack/controllers/component-stack-lifecycle.d.ts.map +1 -0
- package/lib/typescript/component-stack/hooks/use-component-navigation-builder.d.ts +19 -0
- package/lib/typescript/component-stack/hooks/use-component-navigation-builder.d.ts.map +1 -0
- package/lib/typescript/component-stack/hooks/use-component-navigation.d.ts +19 -0
- package/lib/typescript/component-stack/hooks/use-component-navigation.d.ts.map +1 -0
- package/lib/typescript/component-stack/index.d.ts +4 -0
- package/lib/typescript/component-stack/index.d.ts.map +1 -0
- package/lib/typescript/component-stack/navigators/create-component-navigator.d.ts +35 -0
- package/lib/typescript/component-stack/navigators/create-component-navigator.d.ts.map +1 -0
- package/lib/typescript/component-stack/types.d.ts +206 -0
- package/lib/typescript/component-stack/types.d.ts.map +1 -0
- package/lib/typescript/native-stack/controllers/native-stack-lifecycle.d.ts.map +1 -0
- package/lib/typescript/native-stack/index.d.ts +1 -1
- package/lib/typescript/native-stack/index.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +9 -6
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts +2 -10
- package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts +20 -0
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts.map +1 -0
- package/lib/typescript/shared/components/overlay/index.d.ts +9 -0
- package/lib/typescript/shared/components/overlay/index.d.ts.map +1 -0
- package/lib/typescript/shared/components/overlay/variations/container-overlay.d.ts +8 -0
- package/lib/typescript/shared/components/overlay/variations/container-overlay.d.ts.map +1 -0
- package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts +6 -0
- package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts.map +1 -0
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +12 -0
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -0
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts +6 -0
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts.map +1 -0
- package/lib/typescript/shared/configs/index.d.ts.map +1 -1
- package/lib/typescript/shared/configs/presets.d.ts +1 -1
- package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +1 -16
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-high-refresh-rate.d.ts +6 -0
- package/lib/typescript/shared/hooks/animation/use-high-refresh-rate.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-closing-route-keys.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/navigation/use-previous.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +71 -0
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -0
- package/lib/typescript/shared/index.d.ts +31 -33
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures.provider.d.ts +4 -2
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/keys.provider.d.ts +29 -0
- package/lib/typescript/shared/providers/screen/keys.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts +13 -0
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts +13 -0
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/core.provider.d.ts +11 -0
- package/lib/typescript/shared/providers/stack/core.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts +34 -0
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/active-screens-limit.d.ts +9 -0
- package/lib/typescript/shared/providers/stack/helpers/active-screens-limit.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes.d.ts +19 -0
- package/lib/typescript/shared/providers/stack/helpers/use-local-routes.d.ts.map +1 -0
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts +39 -0
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -0
- package/lib/typescript/shared/stores/animation.store.d.ts +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/gesture.store.d.ts +2 -2
- package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +10 -3
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/gesture.types.d.ts +0 -1
- package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +8 -0
- package/lib/typescript/shared/types/index.d.ts.map +1 -0
- package/lib/typescript/shared/types/overlay.types.d.ts +50 -0
- package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/{core.types.d.ts → screen.types.d.ts} +31 -6
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -0
- package/lib/typescript/shared/types/stack.types.d.ts +52 -0
- package/lib/typescript/shared/types/stack.types.d.ts.map +1 -0
- package/lib/typescript/shared/utils/animation/derivations.d.ts +3 -1
- package/lib/typescript/shared/utils/animation/derivations.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts +2 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts +1 -2
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts +1 -9
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/builder.d.ts +9 -8
- package/lib/typescript/shared/utils/bounds/types/builder.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/geometry.d.ts +2 -1
- package/lib/typescript/shared/utils/bounds/types/geometry.d.ts.map +1 -1
- package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +1 -1
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/utils/navigation/align-routes-with-latest.d.ts +13 -0
- package/lib/typescript/shared/utils/navigation/align-routes-with-latest.d.ts.map +1 -0
- package/lib/typescript/shared/utils/navigation/are-descriptors-equal.d.ts +2 -0
- package/lib/typescript/shared/utils/navigation/are-descriptors-equal.d.ts.map +1 -0
- package/lib/typescript/shared/utils/navigation/compose-descriptors.d.ts +6 -0
- package/lib/typescript/shared/utils/navigation/compose-descriptors.d.ts.map +1 -0
- package/lib/typescript/shared/utils/navigation/have-same-route-keys.d.ts +6 -0
- package/lib/typescript/shared/utils/navigation/have-same-route-keys.d.ts.map +1 -0
- package/lib/typescript/shared/utils/navigation/routes-are-identical.d.ts +6 -0
- package/lib/typescript/shared/utils/navigation/routes-are-identical.d.ts.map +1 -0
- package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts +21 -0
- package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts.map +1 -0
- package/lib/typescript/shared/utils/read-shared-value.d.ts +7 -0
- package/lib/typescript/shared/utils/read-shared-value.d.ts.map +1 -0
- package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts +4 -3
- package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts.map +1 -1
- package/package.json +7 -2
- package/src/blank-stack/components/screens.tsx +2 -2
- package/src/blank-stack/components/stack-view.tsx +59 -67
- package/src/{shared/components → blank-stack}/controllers/blank-stack-lifecycle.tsx +18 -11
- package/src/blank-stack/types.ts +10 -62
- package/src/component-stack/components/component-view.tsx +72 -0
- package/src/component-stack/components/screens.tsx +86 -0
- package/src/component-stack/controllers/component-stack-lifecycle.tsx +80 -0
- package/src/component-stack/hooks/use-component-navigation-builder.tsx +388 -0
- package/src/component-stack/hooks/use-component-navigation.tsx +22 -0
- package/src/component-stack/index.ts +16 -0
- package/src/component-stack/navigators/create-component-navigator.tsx +104 -0
- package/src/component-stack/types.ts +209 -0
- package/src/{shared/components → native-stack}/controllers/native-stack-lifecycle.tsx +18 -11
- package/src/native-stack/index.ts +1 -0
- package/src/native-stack/types.ts +11 -7
- package/src/native-stack/views/NativeStackView.native.tsx +42 -69
- package/src/shared/__tests__/sync-routes-with-removed.test.ts +283 -0
- package/src/shared/components/create-transition-aware-component.tsx +5 -6
- package/src/shared/components/overlay/helpers/get-active-overlay.ts +64 -0
- package/src/shared/components/overlay/index.ts +9 -0
- package/src/shared/components/overlay/variations/container-overlay.tsx +98 -0
- package/src/shared/components/overlay/variations/float-overlay.tsx +44 -0
- package/src/shared/components/overlay/variations/overlay-host.tsx +148 -0
- package/src/shared/components/overlay/variations/screen-overlay.tsx +51 -0
- package/src/shared/components/root-transition-aware.tsx +2 -2
- package/src/shared/configs/presets.ts +1 -1
- package/src/shared/constants.ts +1 -33
- package/src/shared/hooks/animation/use-associated-style.tsx +2 -2
- package/src/shared/hooks/animation/use-high-refresh-rate.tsx +28 -0
- package/src/shared/hooks/animation/use-screen-animation.tsx +20 -15
- package/src/shared/hooks/gestures/use-build-gestures.tsx +1 -2
- package/src/shared/hooks/gestures/use-scroll-registry.tsx +3 -4
- package/src/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-closing-route-keys.tsx +1 -1
- package/src/shared/hooks/navigation/use-stack.tsx +100 -0
- package/src/shared/index.ts +7 -3
- package/src/shared/providers/gestures.provider.tsx +6 -2
- package/src/shared/providers/register-bounds.provider.tsx +13 -6
- package/src/shared/providers/screen/keys.provider.tsx +72 -0
- package/src/shared/providers/screen/screen-composer.tsx +38 -0
- package/src/shared/providers/{transition-styles.provider.tsx → screen/styles.provider.tsx} +14 -13
- package/src/shared/providers/stack/core.provider.tsx +64 -0
- package/src/shared/providers/stack/direct.provider.tsx +228 -0
- package/src/{blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.ts → shared/providers/stack/helpers/active-screens-limit.ts} +10 -4
- package/src/shared/providers/stack/helpers/use-local-routes.tsx +133 -0
- package/src/shared/providers/stack/managed.provider.tsx +226 -0
- package/src/shared/stores/animation.store.ts +1 -1
- package/src/shared/stores/bounds.store.ts +4 -5
- package/src/shared/stores/gesture.store.ts +2 -2
- package/src/shared/types/animation.types.ts +11 -3
- package/src/shared/types/gesture.types.ts +0 -2
- package/src/shared/types/index.ts +47 -0
- package/src/shared/types/overlay.types.ts +62 -0
- package/src/shared/types/{core.types.ts → screen.types.ts} +40 -7
- package/src/shared/types/stack.types.ts +59 -0
- package/src/shared/utils/animation/derivations.ts +8 -1
- package/src/shared/utils/bounds/helpers/geometry.ts +1 -1
- package/src/shared/utils/bounds/helpers/style-composers.ts +1 -1
- package/src/shared/utils/bounds/helpers/styles.ts +1 -2
- package/src/shared/utils/bounds/index.ts +1 -9
- package/src/shared/utils/bounds/types/builder.ts +8 -8
- package/src/shared/utils/bounds/types/geometry.ts +1 -1
- package/src/shared/utils/create-provider.tsx +14 -16
- package/src/shared/utils/gesture/check-gesture-activation.ts +1 -1
- package/src/shared/utils/navigation/align-routes-with-latest.ts +68 -0
- package/src/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/are-descriptors-equal.ts +5 -5
- package/src/shared/utils/navigation/compose-descriptors.ts +21 -0
- package/src/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/have-same-route-keys.ts +6 -4
- package/src/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/routes-are-identical.ts +6 -4
- package/src/shared/utils/navigation/sync-routes-with-removed.ts +132 -0
- package/src/shared/utils/read-shared-value.ts +15 -0
- package/src/shared/utils/reset-stores-for-screen.ts +4 -3
- package/lib/commonjs/blank-stack/components/overlay.js +0 -156
- package/lib/commonjs/blank-stack/components/overlay.js.map +0 -1
- package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js +0 -72
- package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-closing-route-keys.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-previous.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js +0 -196
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/index.js +0 -61
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/index.js.map +0 -1
- package/lib/commonjs/blank-stack/utils/with-stack-navigation/types.js.map +0 -1
- package/lib/commonjs/native-stack/views/FooterComponent.js +0 -17
- package/lib/commonjs/native-stack/views/FooterComponent.js.map +0 -1
- package/lib/commonjs/shared/components/controllers/blank-stack-lifecycle.js.map +0 -1
- package/lib/commonjs/shared/components/controllers/native-stack-lifecycle.js.map +0 -1
- package/lib/commonjs/shared/providers/flags.provider.js +0 -25
- package/lib/commonjs/shared/providers/flags.provider.js.map +0 -1
- package/lib/commonjs/shared/providers/keys.provider.js.map +0 -1
- package/lib/commonjs/shared/providers/routes.provider.js +0 -48
- package/lib/commonjs/shared/providers/routes.provider.js.map +0 -1
- package/lib/commonjs/shared/providers/screen-transition.provider.js.map +0 -1
- package/lib/commonjs/shared/providers/transition-styles.provider.js.map +0 -1
- package/lib/commonjs/shared/types/utils.types.js +0 -2
- package/lib/commonjs/shared/utils/animation/compute-stack-progress.js +0 -20
- package/lib/commonjs/shared/utils/animation/compute-stack-progress.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/constants.js +0 -42
- package/lib/commonjs/shared/utils/bounds/constants.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js +0 -19
- package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js.map +0 -1
- package/lib/commonjs/shared/utils/gesture/apply-offset-rules.js +0 -224
- package/lib/commonjs/shared/utils/gesture/apply-offset-rules.js.map +0 -1
- package/lib/commonjs/shared/utils/reanimated/version.js +0 -12
- package/lib/commonjs/shared/utils/reanimated/version.js.map +0 -1
- package/lib/module/blank-stack/components/overlay.js +0 -152
- package/lib/module/blank-stack/components/overlay.js.map +0 -1
- package/lib/module/blank-stack/hooks/use-overlay-animation.js +0 -68
- package/lib/module/blank-stack/hooks/use-overlay-animation.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-closing-route-keys.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-previous.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js +0 -190
- package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/index.js +0 -55
- package/lib/module/blank-stack/utils/with-stack-navigation/index.js.map +0 -1
- package/lib/module/blank-stack/utils/with-stack-navigation/types.js.map +0 -1
- package/lib/module/native-stack/views/FooterComponent.js +0 -13
- package/lib/module/native-stack/views/FooterComponent.js.map +0 -1
- package/lib/module/shared/components/controllers/blank-stack-lifecycle.js.map +0 -1
- package/lib/module/shared/components/controllers/native-stack-lifecycle.js.map +0 -1
- package/lib/module/shared/providers/flags.provider.js +0 -19
- package/lib/module/shared/providers/flags.provider.js.map +0 -1
- package/lib/module/shared/providers/keys.provider.js.map +0 -1
- package/lib/module/shared/providers/routes.provider.js +0 -42
- package/lib/module/shared/providers/routes.provider.js.map +0 -1
- package/lib/module/shared/providers/screen-transition.provider.js.map +0 -1
- package/lib/module/shared/providers/transition-styles.provider.js.map +0 -1
- package/lib/module/shared/types/core.types.js +0 -4
- package/lib/module/shared/types/core.types.js.map +0 -1
- package/lib/module/shared/types/utils.types.js +0 -2
- package/lib/module/shared/types/utils.types.js.map +0 -1
- package/lib/module/shared/utils/animation/compute-stack-progress.js +0 -15
- package/lib/module/shared/utils/animation/compute-stack-progress.js.map +0 -1
- package/lib/module/shared/utils/bounds/constants.js +0 -37
- package/lib/module/shared/utils/bounds/constants.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js +0 -14
- package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js.map +0 -1
- package/lib/module/shared/utils/gesture/apply-offset-rules.js +0 -219
- package/lib/module/shared/utils/gesture/apply-offset-rules.js.map +0 -1
- package/lib/module/shared/utils/reanimated/version.js +0 -7
- package/lib/module/shared/utils/reanimated/version.js.map +0 -1
- package/lib/typescript/blank-stack/components/overlay.d.ts +0 -5
- package/lib/typescript/blank-stack/components/overlay.d.ts.map +0 -1
- package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts +0 -12
- package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.d.ts +0 -3
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.d.ts +0 -4
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.d.ts +0 -4
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.d.ts +0 -3
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.d.ts +0 -3
- package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/hooks/use-closing-route-keys.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/hooks/use-previous.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.d.ts +0 -20
- package/lib/typescript/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/index.d.ts +0 -4
- package/lib/typescript/blank-stack/utils/with-stack-navigation/index.d.ts.map +0 -1
- package/lib/typescript/blank-stack/utils/with-stack-navigation/types.d.ts +0 -22
- package/lib/typescript/blank-stack/utils/with-stack-navigation/types.d.ts.map +0 -1
- package/lib/typescript/native-stack/views/FooterComponent.d.ts +0 -7
- package/lib/typescript/native-stack/views/FooterComponent.d.ts.map +0 -1
- package/lib/typescript/shared/components/controllers/blank-stack-lifecycle.d.ts.map +0 -1
- package/lib/typescript/shared/components/controllers/native-stack-lifecycle.d.ts.map +0 -1
- package/lib/typescript/shared/providers/flags.provider.d.ts +0 -10
- package/lib/typescript/shared/providers/flags.provider.d.ts.map +0 -1
- package/lib/typescript/shared/providers/keys.provider.d.ts +0 -18
- package/lib/typescript/shared/providers/keys.provider.d.ts.map +0 -1
- package/lib/typescript/shared/providers/routes.provider.d.ts +0 -19
- package/lib/typescript/shared/providers/routes.provider.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen-transition.provider.d.ts +0 -14
- package/lib/typescript/shared/providers/screen-transition.provider.d.ts.map +0 -1
- package/lib/typescript/shared/providers/transition-styles.provider.d.ts +0 -14
- package/lib/typescript/shared/providers/transition-styles.provider.d.ts.map +0 -1
- package/lib/typescript/shared/types/core.types.d.ts.map +0 -1
- package/lib/typescript/shared/types/utils.types.d.ts +0 -5
- package/lib/typescript/shared/types/utils.types.d.ts.map +0 -1
- package/lib/typescript/shared/utils/animation/compute-stack-progress.d.ts +0 -3
- package/lib/typescript/shared/utils/animation/compute-stack-progress.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/constants.d.ts +0 -7
- package/lib/typescript/shared/utils/bounds/constants.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/is-bounds-equal.d.ts +0 -7
- package/lib/typescript/shared/utils/bounds/helpers/is-bounds-equal.d.ts.map +0 -1
- package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts +0 -38
- package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts.map +0 -1
- package/lib/typescript/shared/utils/reanimated/version.d.ts +0 -2
- package/lib/typescript/shared/utils/reanimated/version.d.ts.map +0 -1
- package/src/blank-stack/components/overlay.tsx +0 -169
- package/src/blank-stack/hooks/use-overlay-animation.tsx +0 -86
- package/src/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.ts +0 -17
- package/src/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.tsx +0 -267
- package/src/blank-stack/utils/with-stack-navigation/index.tsx +0 -74
- package/src/blank-stack/utils/with-stack-navigation/types.ts +0 -35
- package/src/native-stack/views/FooterComponent.tsx +0 -10
- package/src/shared/providers/flags.provider.tsx +0 -21
- package/src/shared/providers/keys.provider.tsx +0 -57
- package/src/shared/providers/routes.provider.tsx +0 -54
- package/src/shared/providers/screen-transition.provider.tsx +0 -41
- package/src/shared/types/utils.types.ts +0 -4
- package/src/shared/utils/animation/compute-stack-progress.ts +0 -16
- package/src/shared/utils/bounds/constants.ts +0 -40
- package/src/shared/utils/bounds/helpers/is-bounds-equal.ts +0 -24
- package/src/shared/utils/gesture/apply-offset-rules.ts +0 -312
- package/src/shared/utils/reanimated/version.ts +0 -5
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation → component-stack}/types.js +0 -0
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-previous.js +0 -0
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/are-descriptors-equal.js +0 -0
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/compose-descriptors.js +0 -0
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/have-same-route-keys.js +0 -0
- /package/lib/commonjs/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/routes-are-identical.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation → component-stack}/types.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-previous.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/are-descriptors-equal.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/compose-descriptors.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/have-same-route-keys.js +0 -0
- /package/lib/module/{blank-stack/utils/with-stack-navigation/helpers → shared/utils/navigation}/routes-are-identical.js +0 -0
- /package/lib/typescript/{shared/components → native-stack}/controllers/native-stack-lifecycle.d.ts +0 -0
- /package/lib/typescript/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-closing-route-keys.d.ts +0 -0
- /package/lib/typescript/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-previous.d.ts +0 -0
- /package/src/{blank-stack/utils/with-stack-navigation/hooks → shared/hooks/navigation}/use-previous.tsx +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "bun:test";
|
|
2
|
+
import { AnimationStore } from "../stores/animation.store";
|
|
3
|
+
import { GestureStore } from "../stores/gesture.store";
|
|
4
|
+
import { syncRoutesWithRemoved } from "../utils/navigation/sync-routes-with-removed";
|
|
5
|
+
|
|
6
|
+
const createRoute = (key: string) => ({ key });
|
|
7
|
+
|
|
8
|
+
const createClosingRouteKeys = () => {
|
|
9
|
+
const keys = new Set<string>();
|
|
10
|
+
const sharedValue: string[] = [];
|
|
11
|
+
return {
|
|
12
|
+
ref: { current: keys } as React.RefObject<Set<string>>,
|
|
13
|
+
shared: {
|
|
14
|
+
value: sharedValue,
|
|
15
|
+
get: () => sharedValue,
|
|
16
|
+
set: (v: string[]) => {
|
|
17
|
+
sharedValue.length = 0;
|
|
18
|
+
sharedValue.push(...v);
|
|
19
|
+
},
|
|
20
|
+
addListener: () => () => {},
|
|
21
|
+
removeListener: () => {},
|
|
22
|
+
modify: (fn?: (v: string[]) => string[], _forceUpdate?: boolean) => {
|
|
23
|
+
if (fn) {
|
|
24
|
+
const result = fn(sharedValue);
|
|
25
|
+
sharedValue.length = 0;
|
|
26
|
+
sharedValue.push(...result);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
add: (key: string) => {
|
|
31
|
+
keys.add(key);
|
|
32
|
+
},
|
|
33
|
+
remove: (key: string) => {
|
|
34
|
+
keys.delete(key);
|
|
35
|
+
},
|
|
36
|
+
clear: () => keys.clear(),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Helper to set up a route's animation state
|
|
41
|
+
const setRouteState = (
|
|
42
|
+
routeKey: string,
|
|
43
|
+
state: {
|
|
44
|
+
progress?: number;
|
|
45
|
+
closing?: number;
|
|
46
|
+
isDragging?: number;
|
|
47
|
+
isDismissing?: number;
|
|
48
|
+
},
|
|
49
|
+
) => {
|
|
50
|
+
const animations = AnimationStore.getAll(routeKey);
|
|
51
|
+
const gestures = GestureStore.getRouteGestures(routeKey);
|
|
52
|
+
|
|
53
|
+
if (state.progress !== undefined) animations.progress.value = state.progress;
|
|
54
|
+
if (state.closing !== undefined) animations.closing.value = state.closing;
|
|
55
|
+
if (state.isDragging !== undefined)
|
|
56
|
+
gestures.isDragging.value = state.isDragging;
|
|
57
|
+
if (state.isDismissing !== undefined)
|
|
58
|
+
gestures.isDismissing.value = state.isDismissing;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Reset stores before each test
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
globalThis.resetMutableRegistry();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("syncRoutesWithRemoved", () => {
|
|
67
|
+
describe("basic routing", () => {
|
|
68
|
+
it("returns empty routes when nextRoutes is empty", () => {
|
|
69
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
70
|
+
const result = syncRoutesWithRemoved({
|
|
71
|
+
prevRoutes: [createRoute("a")],
|
|
72
|
+
prevDescriptors: {},
|
|
73
|
+
nextRoutes: [],
|
|
74
|
+
nextDescriptors: {},
|
|
75
|
+
closingRouteKeys,
|
|
76
|
+
});
|
|
77
|
+
expect(result.routes).toEqual([]);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("returns nextRoutes unchanged for normal push (A -> B)", () => {
|
|
81
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
82
|
+
|
|
83
|
+
// Both routes fully visible
|
|
84
|
+
setRouteState("a", { progress: 1 });
|
|
85
|
+
setRouteState("b", { progress: 1 });
|
|
86
|
+
|
|
87
|
+
const result = syncRoutesWithRemoved({
|
|
88
|
+
prevRoutes: [createRoute("a")],
|
|
89
|
+
prevDescriptors: { a: {} },
|
|
90
|
+
nextRoutes: [createRoute("a"), createRoute("b")],
|
|
91
|
+
nextDescriptors: { a: {}, b: {} },
|
|
92
|
+
closingRouteKeys,
|
|
93
|
+
});
|
|
94
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b"]);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("returns nextRoutes unchanged for normal stack (A -> B -> C)", () => {
|
|
98
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
99
|
+
|
|
100
|
+
setRouteState("a", { progress: 1 });
|
|
101
|
+
setRouteState("b", { progress: 1 });
|
|
102
|
+
setRouteState("c", { progress: 1 });
|
|
103
|
+
|
|
104
|
+
const result = syncRoutesWithRemoved({
|
|
105
|
+
prevRoutes: [createRoute("a"), createRoute("b")],
|
|
106
|
+
prevDescriptors: { a: {}, b: {} },
|
|
107
|
+
nextRoutes: [createRoute("a"), createRoute("b"), createRoute("c")],
|
|
108
|
+
nextDescriptors: { a: {}, b: {}, c: {} },
|
|
109
|
+
closingRouteKeys,
|
|
110
|
+
});
|
|
111
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b", "c"]);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("mid-dismiss route reordering", () => {
|
|
116
|
+
it("moves mid-dismiss route to end when pushing while swiping (progress < 0.5)", () => {
|
|
117
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
118
|
+
|
|
119
|
+
setRouteState("a", { progress: 1 });
|
|
120
|
+
setRouteState("b-old", { progress: 0.3 }); // Mid-dismiss
|
|
121
|
+
setRouteState("b-new", { progress: 0 }); // Just pushed
|
|
122
|
+
|
|
123
|
+
const result = syncRoutesWithRemoved({
|
|
124
|
+
prevRoutes: [createRoute("a"), createRoute("b-old")],
|
|
125
|
+
prevDescriptors: { a: {}, "b-old": {} },
|
|
126
|
+
nextRoutes: [
|
|
127
|
+
createRoute("a"),
|
|
128
|
+
createRoute("b-old"),
|
|
129
|
+
createRoute("b-new"),
|
|
130
|
+
],
|
|
131
|
+
nextDescriptors: { a: {}, "b-old": {}, "b-new": {} },
|
|
132
|
+
closingRouteKeys,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b-new", "b-old"]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("marks moved route as closing", () => {
|
|
139
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
140
|
+
|
|
141
|
+
setRouteState("a", { progress: 1 });
|
|
142
|
+
setRouteState("b-old", { progress: 0.3 });
|
|
143
|
+
setRouteState("b-new", { progress: 0 });
|
|
144
|
+
|
|
145
|
+
syncRoutesWithRemoved({
|
|
146
|
+
prevRoutes: [createRoute("a"), createRoute("b-old")],
|
|
147
|
+
prevDescriptors: { a: {}, "b-old": {} },
|
|
148
|
+
nextRoutes: [
|
|
149
|
+
createRoute("a"),
|
|
150
|
+
createRoute("b-old"),
|
|
151
|
+
createRoute("b-new"),
|
|
152
|
+
],
|
|
153
|
+
nextDescriptors: { a: {}, "b-old": {}, "b-new": {} },
|
|
154
|
+
closingRouteKeys,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
expect(closingRouteKeys.ref.current.has("b-old")).toBe(true);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("detects dismissing via isDragging flag", () => {
|
|
161
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
162
|
+
|
|
163
|
+
setRouteState("a", { progress: 1 });
|
|
164
|
+
setRouteState("b-old", { progress: 1, isDragging: 1 }); // Being dragged
|
|
165
|
+
setRouteState("b-new", { progress: 0 });
|
|
166
|
+
|
|
167
|
+
const result = syncRoutesWithRemoved({
|
|
168
|
+
prevRoutes: [createRoute("a"), createRoute("b-old")],
|
|
169
|
+
prevDescriptors: { a: {}, "b-old": {} },
|
|
170
|
+
nextRoutes: [
|
|
171
|
+
createRoute("a"),
|
|
172
|
+
createRoute("b-old"),
|
|
173
|
+
createRoute("b-new"),
|
|
174
|
+
],
|
|
175
|
+
nextDescriptors: { a: {}, "b-old": {}, "b-new": {} },
|
|
176
|
+
closingRouteKeys,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b-new", "b-old"]);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("detects dismissing via isDismissing flag", () => {
|
|
183
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
184
|
+
|
|
185
|
+
setRouteState("a", { progress: 1 });
|
|
186
|
+
setRouteState("b-old", { progress: 1, isDismissing: 1 });
|
|
187
|
+
setRouteState("b-new", { progress: 0 });
|
|
188
|
+
|
|
189
|
+
const result = syncRoutesWithRemoved({
|
|
190
|
+
prevRoutes: [createRoute("a"), createRoute("b-old")],
|
|
191
|
+
prevDescriptors: { a: {}, "b-old": {} },
|
|
192
|
+
nextRoutes: [
|
|
193
|
+
createRoute("a"),
|
|
194
|
+
createRoute("b-old"),
|
|
195
|
+
createRoute("b-new"),
|
|
196
|
+
],
|
|
197
|
+
nextDescriptors: { a: {}, "b-old": {}, "b-new": {} },
|
|
198
|
+
closingRouteKeys,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b-new", "b-old"]);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("detects dismissing via closing flag", () => {
|
|
205
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
206
|
+
|
|
207
|
+
setRouteState("a", { progress: 1 });
|
|
208
|
+
setRouteState("b-old", { progress: 1, closing: 1 });
|
|
209
|
+
setRouteState("b-new", { progress: 0 });
|
|
210
|
+
|
|
211
|
+
const result = syncRoutesWithRemoved({
|
|
212
|
+
prevRoutes: [createRoute("a"), createRoute("b-old")],
|
|
213
|
+
prevDescriptors: { a: {}, "b-old": {} },
|
|
214
|
+
nextRoutes: [
|
|
215
|
+
createRoute("a"),
|
|
216
|
+
createRoute("b-old"),
|
|
217
|
+
createRoute("b-new"),
|
|
218
|
+
],
|
|
219
|
+
nextDescriptors: { a: {}, "b-old": {}, "b-new": {} },
|
|
220
|
+
closingRouteKeys,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b-new", "b-old"]);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it("does not move first route even if dismissing", () => {
|
|
227
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
228
|
+
|
|
229
|
+
setRouteState("a", { progress: 0.3 }); // First route, low progress
|
|
230
|
+
setRouteState("b", { progress: 1 });
|
|
231
|
+
|
|
232
|
+
const result = syncRoutesWithRemoved({
|
|
233
|
+
prevRoutes: [createRoute("a")],
|
|
234
|
+
prevDescriptors: { a: {} },
|
|
235
|
+
nextRoutes: [createRoute("a"), createRoute("b")],
|
|
236
|
+
nextDescriptors: { a: {}, b: {} },
|
|
237
|
+
closingRouteKeys,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b"]);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("does not move last route even if low progress (newly pushed)", () => {
|
|
244
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
245
|
+
|
|
246
|
+
setRouteState("a", { progress: 1 });
|
|
247
|
+
setRouteState("b", { progress: 1 });
|
|
248
|
+
setRouteState("c", { progress: 0.1 }); // Last route, low progress (just pushed)
|
|
249
|
+
|
|
250
|
+
const result = syncRoutesWithRemoved({
|
|
251
|
+
prevRoutes: [createRoute("a"), createRoute("b")],
|
|
252
|
+
prevDescriptors: { a: {}, b: {} },
|
|
253
|
+
nextRoutes: [createRoute("a"), createRoute("b"), createRoute("c")],
|
|
254
|
+
nextDescriptors: { a: {}, b: {}, c: {} },
|
|
255
|
+
closingRouteKeys,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b", "c"]);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
describe("normal back navigation", () => {
|
|
263
|
+
it("keeps closing route at end for normal back (C -> B)", () => {
|
|
264
|
+
const closingRouteKeys = createClosingRouteKeys();
|
|
265
|
+
|
|
266
|
+
setRouteState("a", { progress: 1 });
|
|
267
|
+
setRouteState("b", { progress: 1 });
|
|
268
|
+
setRouteState("c", { progress: 1 });
|
|
269
|
+
|
|
270
|
+
const result = syncRoutesWithRemoved({
|
|
271
|
+
prevRoutes: [createRoute("a"), createRoute("b"), createRoute("c")],
|
|
272
|
+
prevDescriptors: { a: {}, b: {}, c: {} },
|
|
273
|
+
nextRoutes: [createRoute("a"), createRoute("b")],
|
|
274
|
+
nextDescriptors: { a: {}, b: {} },
|
|
275
|
+
closingRouteKeys,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// c should be added to end for close animation
|
|
279
|
+
expect(result.routes.map((r) => r.key)).toEqual(["a", "b", "c"]);
|
|
280
|
+
expect(closingRouteKeys.ref.current.has("c")).toBe(true);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
});
|
|
@@ -8,8 +8,7 @@ import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
|
|
|
8
8
|
import { useScrollRegistry } from "../hooks/gestures/use-scroll-registry";
|
|
9
9
|
import { useGestureContext } from "../providers/gestures.provider";
|
|
10
10
|
import { RegisterBoundsProvider } from "../providers/register-bounds.provider";
|
|
11
|
-
import type { TransitionAwareProps } from "../types/
|
|
12
|
-
import type { Any } from "../types/utils.types";
|
|
11
|
+
import type { TransitionAwareProps } from "../types/screen.types";
|
|
13
12
|
|
|
14
13
|
interface CreateTransitionAwareComponentOptions {
|
|
15
14
|
isScrollable?: boolean;
|
|
@@ -26,7 +25,7 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
26
25
|
const ScrollableInner = forwardRef<
|
|
27
26
|
React.ComponentRef<typeof Wrapped>,
|
|
28
27
|
TransitionAwareProps<P>
|
|
29
|
-
>((props:
|
|
28
|
+
>((props: any, ref) => {
|
|
30
29
|
const { nativeGesture } = useGestureContext()!;
|
|
31
30
|
const { scrollHandler, onContentSizeChange, onLayout } = useScrollRegistry({
|
|
32
31
|
onScroll: props.onScroll,
|
|
@@ -37,7 +36,7 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
37
36
|
return (
|
|
38
37
|
<GestureDetector gesture={nativeGesture}>
|
|
39
38
|
<AnimatedComponent
|
|
40
|
-
{...(props as
|
|
39
|
+
{...(props as any)}
|
|
41
40
|
ref={ref}
|
|
42
41
|
onScroll={scrollHandler}
|
|
43
42
|
onContentSizeChange={onContentSizeChange}
|
|
@@ -53,7 +52,7 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
53
52
|
TransitionAwareProps<P>
|
|
54
53
|
>((props, _) => {
|
|
55
54
|
const { children, style, sharedBoundTag, styleId, onPress, ...rest } =
|
|
56
|
-
props as
|
|
55
|
+
props as any;
|
|
57
56
|
|
|
58
57
|
const animatedRef = useAnimatedRef<View>();
|
|
59
58
|
|
|
@@ -71,7 +70,7 @@ export function createTransitionAwareComponent<P extends object>(
|
|
|
71
70
|
>
|
|
72
71
|
{({ captureActiveOnPress, handleInitialLayout }) => (
|
|
73
72
|
<AnimatedComponent
|
|
74
|
-
{...(rest as
|
|
73
|
+
{...(rest as any)}
|
|
75
74
|
ref={animatedRef}
|
|
76
75
|
style={[style, associatedStyles]}
|
|
77
76
|
onPress={captureActiveOnPress}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { StackScene } from "../../../hooks/navigation/use-stack";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Find the active float overlay from scenes.
|
|
5
|
+
* Scans from the top of the stack downward to find the first screen
|
|
6
|
+
* with overlayMode="float" and overlayShown=true.
|
|
7
|
+
*/
|
|
8
|
+
export function getActiveFloatOverlay(
|
|
9
|
+
scenes: StackScene[],
|
|
10
|
+
index: number,
|
|
11
|
+
transitionsAlwaysOn: boolean,
|
|
12
|
+
): { scene: StackScene; overlayIndex: number } | null {
|
|
13
|
+
if (scenes.length === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// When navigating back, closing scenes are kept at the top of the local stack
|
|
18
|
+
// while the focused index already points to the destination screen. We need to
|
|
19
|
+
// start scanning from the actual top of the stack so the overlay can animate
|
|
20
|
+
// out together with its closing screen instead of disappearing immediately.
|
|
21
|
+
const startIndex = Math.max(index, scenes.length - 1);
|
|
22
|
+
|
|
23
|
+
for (let i = startIndex; i >= 0; i--) {
|
|
24
|
+
const scene = scenes[i];
|
|
25
|
+
const options = scene?.descriptor?.options;
|
|
26
|
+
|
|
27
|
+
// Skip screens without enableTransitions (native-stack only)
|
|
28
|
+
if (!transitionsAlwaysOn && !options?.enableTransitions) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (options?.overlayMode === "float" && options?.overlayShown) {
|
|
33
|
+
return { scene, overlayIndex: i };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Find the active container overlay from scenes.
|
|
42
|
+
* Scans from the bottom of the stack upward to find the first screen
|
|
43
|
+
* with overlayMode="container" and overlayShown=true.
|
|
44
|
+
*/
|
|
45
|
+
export function getActiveContainerOverlay(
|
|
46
|
+
scenes: StackScene[],
|
|
47
|
+
transitionsAlwaysOn: boolean,
|
|
48
|
+
): { scene: StackScene; overlayIndex: number } | null {
|
|
49
|
+
for (let i = 0; i < scenes.length; i++) {
|
|
50
|
+
const scene = scenes[i];
|
|
51
|
+
const options = scene?.descriptor?.options;
|
|
52
|
+
|
|
53
|
+
// Skip screens without enableTransitions (native-stack only)
|
|
54
|
+
if (!transitionsAlwaysOn && !options?.enableTransitions) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (options?.overlayMode === "container" && options?.overlayShown) {
|
|
59
|
+
return { scene, overlayIndex: i };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContainerOverlay } from "./variations/container-overlay";
|
|
2
|
+
import { FloatOverlay } from "./variations/float-overlay";
|
|
3
|
+
import { ScreenOverlay } from "./variations/screen-overlay";
|
|
4
|
+
|
|
5
|
+
export const Overlay = {
|
|
6
|
+
Float: FloatOverlay,
|
|
7
|
+
Screen: ScreenOverlay,
|
|
8
|
+
Container: ContainerOverlay,
|
|
9
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { memo, useMemo } from "react";
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
3
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import type { useScreenAnimation } from "../../../hooks/animation/use-screen-animation";
|
|
6
|
+
import { type StackScene, useStack } from "../../../hooks/navigation/use-stack";
|
|
7
|
+
import type { OverlayInterpolationProps } from "../../../types/animation.types";
|
|
8
|
+
import type { ContainerOverlayProps } from "../../../types/overlay.types";
|
|
9
|
+
import { getActiveContainerOverlay } from "../helpers/get-active-overlay";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Inner component that renders when container overlay is active.
|
|
13
|
+
* Separated to ensure hooks are called unconditionally.
|
|
14
|
+
*/
|
|
15
|
+
const ContainerOverlayHost = memo(function ContainerOverlayHost({
|
|
16
|
+
children,
|
|
17
|
+
scene,
|
|
18
|
+
scenes,
|
|
19
|
+
overlayIndex,
|
|
20
|
+
}: {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
scene: StackScene;
|
|
23
|
+
scenes: StackScene[];
|
|
24
|
+
overlayIndex: number;
|
|
25
|
+
}) {
|
|
26
|
+
const { routes, focusedIndex, stackProgress } = useStack();
|
|
27
|
+
const screen = useWindowDimensions();
|
|
28
|
+
const insets = useSafeAreaInsets();
|
|
29
|
+
|
|
30
|
+
const OverlayComponent = scene.descriptor.options.overlay;
|
|
31
|
+
|
|
32
|
+
// Compute relative progress from overlay position
|
|
33
|
+
const relativeProgress = useDerivedValue(() => {
|
|
34
|
+
"worklet";
|
|
35
|
+
return stackProgress.value - overlayIndex;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const overlayAnimation = useDerivedValue<OverlayInterpolationProps>(() => ({
|
|
39
|
+
progress: relativeProgress.value,
|
|
40
|
+
layouts: { screen },
|
|
41
|
+
insets,
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
// Get focused scene for meta and route info
|
|
45
|
+
const focusedScene = scenes[focusedIndex] ?? scene;
|
|
46
|
+
|
|
47
|
+
if (!OverlayComponent) {
|
|
48
|
+
return <>{children}</>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const overlayProps: ContainerOverlayProps<
|
|
52
|
+
typeof scene.descriptor.navigation
|
|
53
|
+
> = {
|
|
54
|
+
children,
|
|
55
|
+
routes,
|
|
56
|
+
overlayAnimation,
|
|
57
|
+
// screenAnimation is not available at container level, pass a placeholder
|
|
58
|
+
screenAnimation: overlayAnimation as unknown as ReturnType<
|
|
59
|
+
typeof useScreenAnimation
|
|
60
|
+
>,
|
|
61
|
+
focusedRoute: focusedScene.route,
|
|
62
|
+
focusedIndex,
|
|
63
|
+
meta: focusedScene.descriptor.options.meta,
|
|
64
|
+
navigation: scene.descriptor.navigation,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return <OverlayComponent {...overlayProps} />;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Container overlay component that wraps all screen content.
|
|
72
|
+
* Receives children (the screens) and passes them to the overlay component.
|
|
73
|
+
*/
|
|
74
|
+
export function ContainerOverlay({ children }: { children: React.ReactNode }) {
|
|
75
|
+
const { scenes, flags } = useStack();
|
|
76
|
+
|
|
77
|
+
const activeOverlay = useMemo(
|
|
78
|
+
() => getActiveContainerOverlay(scenes, flags.TRANSITIONS_ALWAYS_ON),
|
|
79
|
+
[scenes, flags.TRANSITIONS_ALWAYS_ON],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// If no container overlay, just render children directly
|
|
83
|
+
if (!activeOverlay) {
|
|
84
|
+
return <>{children}</>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const { scene, overlayIndex } = activeOverlay;
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<ContainerOverlayHost
|
|
91
|
+
scene={scene}
|
|
92
|
+
scenes={scenes}
|
|
93
|
+
overlayIndex={overlayIndex}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</ContainerOverlayHost>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useStack } from "../../../hooks/navigation/use-stack";
|
|
3
|
+
import { KeysProvider } from "../../../providers/screen/keys.provider";
|
|
4
|
+
import { ScreenStylesProvider } from "../../../providers/screen/styles.provider";
|
|
5
|
+
import { getActiveFloatOverlay } from "../helpers/get-active-overlay";
|
|
6
|
+
import { OverlayHost } from "./overlay-host";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Float overlay component that renders above all screens.
|
|
10
|
+
* Gets routes and descriptors from stack context.
|
|
11
|
+
*/
|
|
12
|
+
export function FloatOverlay() {
|
|
13
|
+
const { routes, scenes, focusedIndex, flags } = useStack();
|
|
14
|
+
|
|
15
|
+
const activeOverlay = useMemo(
|
|
16
|
+
() =>
|
|
17
|
+
getActiveFloatOverlay(scenes, focusedIndex, flags.TRANSITIONS_ALWAYS_ON),
|
|
18
|
+
[scenes, focusedIndex, flags.TRANSITIONS_ALWAYS_ON],
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (!activeOverlay) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { scene, overlayIndex } = activeOverlay;
|
|
26
|
+
|
|
27
|
+
const previous = scenes[overlayIndex - 1]?.descriptor;
|
|
28
|
+
const current = scene.descriptor;
|
|
29
|
+
const next = scenes[overlayIndex + 1]?.descriptor;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<KeysProvider current={current} previous={previous} next={next}>
|
|
33
|
+
<ScreenStylesProvider>
|
|
34
|
+
<OverlayHost
|
|
35
|
+
scene={scene}
|
|
36
|
+
scenes={scenes}
|
|
37
|
+
routes={routes}
|
|
38
|
+
overlayIndex={overlayIndex}
|
|
39
|
+
isFloating
|
|
40
|
+
/>
|
|
41
|
+
</ScreenStylesProvider>
|
|
42
|
+
</KeysProvider>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NavigationContext,
|
|
3
|
+
NavigationRouteContext,
|
|
4
|
+
type Route,
|
|
5
|
+
} from "@react-navigation/native";
|
|
6
|
+
import { memo, useMemo } from "react";
|
|
7
|
+
import { Animated, StyleSheet, useWindowDimensions, View } from "react-native";
|
|
8
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
9
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
10
|
+
import { useScreenAnimation } from "../../../hooks/animation/use-screen-animation";
|
|
11
|
+
import { type StackScene, useStack } from "../../../hooks/navigation/use-stack";
|
|
12
|
+
import { useSharedValueState } from "../../../hooks/reanimated/use-shared-value-state";
|
|
13
|
+
import type { OverlayInterpolationProps } from "../../../types/animation.types";
|
|
14
|
+
import type { OverlayProps } from "../../../types/overlay.types";
|
|
15
|
+
|
|
16
|
+
type OverlayHostProps = {
|
|
17
|
+
scene: StackScene;
|
|
18
|
+
scenes: StackScene[];
|
|
19
|
+
routes: Route<string>[];
|
|
20
|
+
overlayIndex: number;
|
|
21
|
+
isFloating?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const OverlayHost = memo(function OverlayHost({
|
|
25
|
+
scene,
|
|
26
|
+
scenes,
|
|
27
|
+
routes,
|
|
28
|
+
overlayIndex,
|
|
29
|
+
isFloating,
|
|
30
|
+
}: OverlayHostProps) {
|
|
31
|
+
const OverlayComponent = scene.descriptor.options.overlay;
|
|
32
|
+
const screen = useWindowDimensions();
|
|
33
|
+
|
|
34
|
+
const { stackProgress, optimisticFocusedIndex, routeKeys } = useStack();
|
|
35
|
+
const insets = useSafeAreaInsets();
|
|
36
|
+
|
|
37
|
+
const relativeProgress = useDerivedValue(() => {
|
|
38
|
+
"worklet";
|
|
39
|
+
return stackProgress.value - overlayIndex;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// For float overlays: global focused index (can be any screen in the stack)
|
|
43
|
+
// For screen overlays: relative to overlay position (only screens at or after)
|
|
44
|
+
const optimisticActiveIndex = useSharedValueState(
|
|
45
|
+
useDerivedValue(() => {
|
|
46
|
+
"worklet";
|
|
47
|
+
if (isFloating) {
|
|
48
|
+
// For float overlays, use global optimistic focused index directly
|
|
49
|
+
const globalIndex = optimisticFocusedIndex.get();
|
|
50
|
+
const clampedIndex = Math.max(
|
|
51
|
+
0,
|
|
52
|
+
Math.min(globalIndex, routeKeys.length - 1),
|
|
53
|
+
);
|
|
54
|
+
return clampedIndex;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// For screen overlays, compute relative to overlay position
|
|
58
|
+
const screensAbove = routeKeys.length - 1 - overlayIndex;
|
|
59
|
+
const relativeOptimistic = optimisticFocusedIndex.value - overlayIndex;
|
|
60
|
+
const result = Math.max(0, Math.min(relativeOptimistic, screensAbove));
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const overlayAnimation = useDerivedValue<OverlayInterpolationProps>(() => ({
|
|
67
|
+
progress: relativeProgress.value,
|
|
68
|
+
layouts: { screen },
|
|
69
|
+
insets,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
const focusedScene = useMemo(() => {
|
|
73
|
+
if (overlayIndex === -1) {
|
|
74
|
+
return scene;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isFloating) {
|
|
78
|
+
// For float overlays, optimisticActiveIndex is the global focused index
|
|
79
|
+
return scenes[optimisticActiveIndex] ?? scene;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// For screen overlays, optimisticActiveIndex is relative to overlayIndex
|
|
83
|
+
const maxOffset = Math.max(scenes.length - overlayIndex - 1, 0);
|
|
84
|
+
const normalizedIndex = Math.min(
|
|
85
|
+
Math.max(optimisticActiveIndex, 0),
|
|
86
|
+
maxOffset,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return scenes[overlayIndex + normalizedIndex] ?? scene;
|
|
90
|
+
}, [overlayIndex, optimisticActiveIndex, scenes, scene, isFloating]);
|
|
91
|
+
|
|
92
|
+
const screenAnimation = useScreenAnimation();
|
|
93
|
+
|
|
94
|
+
if (!OverlayComponent) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const overlayProps: OverlayProps<typeof scene.descriptor.navigation> = {
|
|
99
|
+
routes,
|
|
100
|
+
overlayAnimation,
|
|
101
|
+
screenAnimation,
|
|
102
|
+
focusedRoute: focusedScene.route,
|
|
103
|
+
focusedIndex: optimisticActiveIndex,
|
|
104
|
+
meta: focusedScene.descriptor.options.meta,
|
|
105
|
+
navigation: scene.descriptor.navigation,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Cast to OverlayProps function - container overlays are handled by ContainerOverlay component
|
|
109
|
+
const renderOverlay = OverlayComponent as (
|
|
110
|
+
props: OverlayProps,
|
|
111
|
+
) => React.ReactNode;
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Animated.View
|
|
115
|
+
pointerEvents="box-none"
|
|
116
|
+
style={[
|
|
117
|
+
styles.container,
|
|
118
|
+
isFloating ? styles.floating : { zIndex: 1 },
|
|
119
|
+
styles.absolute,
|
|
120
|
+
]}
|
|
121
|
+
>
|
|
122
|
+
<NavigationContext.Provider
|
|
123
|
+
// biome-ignore lint/suspicious/noExplicitAny: navigation type varies by stack
|
|
124
|
+
value={scene.descriptor.navigation as any}
|
|
125
|
+
>
|
|
126
|
+
<NavigationRouteContext.Provider value={scene.route}>
|
|
127
|
+
<View pointerEvents="box-none" style={styles.overlay}>
|
|
128
|
+
{renderOverlay(overlayProps)}
|
|
129
|
+
</View>
|
|
130
|
+
</NavigationRouteContext.Provider>
|
|
131
|
+
</NavigationContext.Provider>
|
|
132
|
+
</Animated.View>
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
overlay: {
|
|
138
|
+
...StyleSheet.absoluteFillObject,
|
|
139
|
+
zIndex: 1,
|
|
140
|
+
},
|
|
141
|
+
container: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
},
|
|
144
|
+
absolute: StyleSheet.absoluteFillObject,
|
|
145
|
+
floating: {
|
|
146
|
+
zIndex: 1000,
|
|
147
|
+
},
|
|
148
|
+
});
|