react-native-screen-transitions 3.1.0 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -8
- package/lib/commonjs/blank-stack/components/adjusted-screen-container.js +36 -0
- package/lib/commonjs/blank-stack/components/adjusted-screen-container.js.map +1 -0
- package/lib/commonjs/blank-stack/components/{screens.js → adjusted-screen.js} +33 -13
- package/lib/commonjs/blank-stack/components/adjusted-screen.js.map +1 -0
- package/lib/commonjs/blank-stack/components/stack-view.js +44 -61
- package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
- package/lib/commonjs/blank-stack/components/stack-view.native.js +81 -0
- package/lib/commonjs/blank-stack/components/stack-view.native.js.map +1 -0
- package/lib/commonjs/component-stack/components/component-screen-container.js +23 -0
- package/lib/commonjs/component-stack/components/component-screen-container.js.map +1 -0
- package/lib/commonjs/component-stack/components/component-screen.js +36 -0
- package/lib/commonjs/component-stack/components/component-screen.js.map +1 -0
- package/lib/commonjs/component-stack/components/stack-view.js +64 -0
- package/lib/commonjs/component-stack/components/stack-view.js.map +1 -0
- package/lib/commonjs/component-stack/index.js +13 -0
- package/lib/commonjs/component-stack/index.js.map +1 -0
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +52 -0
- package/lib/commonjs/component-stack/navigators/create-component-stack-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 +114 -117
- 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 +39 -0
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js.map +1 -0
- package/lib/commonjs/shared/components/overlay/index.js +13 -0
- package/lib/commonjs/shared/components/overlay/index.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 +4 -31
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/{components/controllers/blank-stack-lifecycle.js → controller/managed-lifecycle.js} +25 -19
- package/lib/commonjs/shared/controller/managed-lifecycle.js.map +1 -0
- 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 +36 -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 +18 -11
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +4 -2
- 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/hooks/reanimated/use-shared-value-state.js +5 -0
- package/lib/commonjs/shared/hooks/reanimated/use-shared-value-state.js.map +1 -1
- 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/layout-anchor.provider.js +73 -0
- package/lib/commonjs/shared/providers/layout-anchor.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/register-bounds.provider.js +19 -8
- 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/screen/styles.provider.js +95 -0
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/core.provider.js +84 -0
- package/lib/commonjs/shared/providers/stack/core.provider.js.map +1 -0
- package/lib/commonjs/shared/providers/stack/direct.provider.js +160 -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 +157 -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/{core.types.js → screen.types.js} +1 -1
- package/lib/commonjs/shared/types/screen.types.js.map +1 -0
- package/lib/commonjs/shared/types/stack.types.js +32 -0
- package/lib/commonjs/shared/types/stack.types.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +13 -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 +70 -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/adjusted-screen-container.js +31 -0
- package/lib/module/blank-stack/components/adjusted-screen-container.js.map +1 -0
- package/lib/module/blank-stack/components/{screens.js → adjusted-screen.js} +32 -12
- package/lib/module/blank-stack/components/adjusted-screen.js.map +1 -0
- package/lib/module/blank-stack/components/stack-view.js +43 -60
- package/lib/module/blank-stack/components/stack-view.js.map +1 -1
- package/lib/module/blank-stack/components/stack-view.native.js +76 -0
- package/lib/module/blank-stack/components/stack-view.native.js.map +1 -0
- package/lib/module/component-stack/components/component-screen-container.js +18 -0
- package/lib/module/component-stack/components/component-screen-container.js.map +1 -0
- package/lib/module/component-stack/components/component-screen.js +30 -0
- package/lib/module/component-stack/components/component-screen.js.map +1 -0
- package/lib/module/component-stack/components/stack-view.js +59 -0
- package/lib/module/component-stack/components/stack-view.js.map +1 -0
- package/lib/module/component-stack/index.js +4 -0
- package/lib/module/component-stack/index.js.map +1 -0
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +48 -0
- package/lib/module/component-stack/navigators/create-component-stack-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 +115 -118
- 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 +35 -0
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js.map +1 -0
- package/lib/module/shared/components/overlay/index.js +9 -0
- package/lib/module/shared/components/overlay/index.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 +2 -29
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/controller/managed-lifecycle.js +72 -0
- package/lib/module/shared/controller/managed-lifecycle.js.map +1 -0
- 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 +31 -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 +18 -11
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +5 -3
- 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/hooks/reanimated/use-shared-value-state.js +5 -0
- package/lib/module/shared/hooks/reanimated/use-shared-value-state.js.map +1 -1
- 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/layout-anchor.provider.js +67 -0
- package/lib/module/shared/providers/layout-anchor.provider.js.map +1 -0
- package/lib/module/shared/providers/register-bounds.provider.js +19 -8
- 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/screen/styles.provider.js +90 -0
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -0
- package/lib/module/shared/providers/stack/core.provider.js +78 -0
- package/lib/module/shared/providers/stack/core.provider.js.map +1 -0
- package/lib/module/shared/providers/stack/direct.provider.js +155 -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 +152 -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 +33 -0
- package/lib/module/shared/types/stack.types.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +13 -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 +65 -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/adjusted-screen-container.d.ts +6 -0
- package/lib/typescript/blank-stack/components/adjusted-screen-container.d.ts.map +1 -0
- package/lib/typescript/blank-stack/components/{screens.d.ts → adjusted-screen.d.ts} +2 -2
- package/lib/typescript/blank-stack/components/adjusted-screen.d.ts.map +1 -0
- 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/blank-stack/components/stack-view.native.d.ts +4 -0
- package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +1 -0
- package/lib/typescript/blank-stack/types.d.ts +10 -49
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/component-screen-container.d.ts +6 -0
- package/lib/typescript/component-stack/components/component-screen-container.d.ts.map +1 -0
- package/lib/typescript/component-stack/components/component-screen.d.ts +8 -0
- package/lib/typescript/component-stack/components/component-screen.d.ts.map +1 -0
- package/lib/typescript/component-stack/components/stack-view.d.ts +4 -0
- package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -0
- package/lib/typescript/component-stack/index.d.ts +3 -0
- package/lib/typescript/component-stack/index.d.ts.map +1 -0
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +16 -0
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts.map +1 -0
- package/lib/typescript/component-stack/types.d.ts +39 -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 +11 -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 +7 -0
- package/lib/typescript/shared/components/overlay/index.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 +2 -16
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts +9 -0
- package/lib/typescript/shared/controller/managed-lifecycle.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/animation/use-high-refresh-rate.d.ts +13 -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 +2 -1
- 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 +66 -0
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/reanimated/use-shared-value-state.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +41 -43
- 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/layout-anchor.provider.d.ts +34 -0
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts.map +1 -0
- 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 +22 -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 +3 -3
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +1 -0
- package/lib/typescript/shared/types/bounds.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 +39 -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 +55 -0
- package/lib/typescript/shared/types/stack.types.d.ts.map +1 -0
- 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/adjusted-screen-container.tsx +25 -0
- package/src/blank-stack/components/{screens.tsx → adjusted-screen.tsx} +35 -14
- package/src/blank-stack/components/stack-view.native.tsx +94 -0
- package/src/blank-stack/components/stack-view.tsx +60 -74
- package/src/blank-stack/types.ts +12 -63
- package/src/component-stack/components/component-screen-container.tsx +15 -0
- package/src/component-stack/components/component-screen.tsx +40 -0
- package/src/component-stack/components/stack-view.tsx +74 -0
- package/src/component-stack/index.ts +10 -0
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +88 -0
- package/src/component-stack/types.ts +101 -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 +138 -167
- package/src/shared/__tests__/sync-routes-with-removed.test.ts +137 -0
- package/src/shared/components/create-transition-aware-component.tsx +5 -6
- package/src/shared/components/overlay/helpers/get-active-overlay.ts +38 -0
- package/src/shared/components/overlay/index.ts +7 -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 +3 -32
- package/src/shared/controller/managed-lifecycle.tsx +73 -0
- package/src/shared/hooks/animation/use-associated-style.tsx +2 -2
- package/src/shared/hooks/animation/use-high-refresh-rate.tsx +34 -0
- package/src/shared/hooks/animation/use-screen-animation.tsx +24 -18
- package/src/shared/hooks/gestures/use-build-gestures.tsx +10 -3
- 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 +89 -0
- package/src/shared/hooks/reanimated/use-shared-value-state.ts +5 -0
- package/src/shared/index.ts +8 -3
- package/src/shared/providers/gestures.provider.tsx +6 -2
- package/src/shared/providers/layout-anchor.provider.tsx +81 -0
- package/src/shared/providers/register-bounds.provider.tsx +23 -9
- package/src/shared/providers/{keys.provider.tsx → screen/keys.provider.tsx} +25 -10
- package/src/shared/providers/screen/screen-composer.tsx +38 -0
- package/src/shared/providers/screen/styles.provider.tsx +120 -0
- package/src/shared/providers/stack/core.provider.tsx +87 -0
- package/src/shared/providers/stack/direct.provider.tsx +231 -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 +229 -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 +3 -3
- package/src/shared/types/bounds.types.ts +5 -0
- package/src/shared/types/gesture.types.ts +0 -2
- package/src/shared/types/index.ts +46 -0
- package/src/shared/types/overlay.types.ts +49 -0
- package/src/shared/types/{core.types.ts → screen.types.ts} +34 -7
- package/src/shared/types/stack.types.ts +63 -0
- 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 +19 -10
- 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 +102 -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/components/screens.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 +0 -62
- package/lib/commonjs/shared/providers/transition-styles.provider.js.map +0 -1
- package/lib/commonjs/shared/types/core.types.js.map +0 -1
- package/lib/commonjs/shared/types/utils.types.js +0 -2
- package/lib/commonjs/shared/types/utils.types.js.map +0 -1
- 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/components/screens.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 +0 -66
- 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 +0 -56
- 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/components/screens.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 +0 -8
- 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/components/controllers/blank-stack-lifecycle.tsx +0 -70
- package/src/shared/providers/flags.provider.tsx +0 -21
- package/src/shared/providers/routes.provider.tsx +0 -54
- package/src/shared/providers/screen-transition.provider.tsx +0 -41
- package/src/shared/providers/transition-styles.provider.tsx +0 -74
- 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,231 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ParamListBase,
|
|
3
|
+
RouteProp,
|
|
4
|
+
StackNavigationState,
|
|
5
|
+
} from "@react-navigation/native";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { type DerivedValue, useDerivedValue } from "react-native-reanimated";
|
|
9
|
+
import type {
|
|
10
|
+
NativeStackDescriptor,
|
|
11
|
+
NativeStackDescriptorMap,
|
|
12
|
+
NativeStackNavigationHelpers,
|
|
13
|
+
} from "../../../native-stack/types";
|
|
14
|
+
import {
|
|
15
|
+
StackContext,
|
|
16
|
+
type StackContextValue,
|
|
17
|
+
} from "../../hooks/navigation/use-stack";
|
|
18
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
19
|
+
import { useStackCoreContext } from "./core.provider";
|
|
20
|
+
|
|
21
|
+
export interface DirectStackScene {
|
|
22
|
+
route: StackNavigationState<ParamListBase>["routes"][number];
|
|
23
|
+
descriptor: NativeStackDescriptor;
|
|
24
|
+
isPreloaded: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DirectStackProps {
|
|
28
|
+
state: StackNavigationState<ParamListBase>;
|
|
29
|
+
navigation: NativeStackNavigationHelpers;
|
|
30
|
+
descriptors: NativeStackDescriptorMap;
|
|
31
|
+
describe: (
|
|
32
|
+
route: RouteProp<ParamListBase>,
|
|
33
|
+
placeholder: boolean,
|
|
34
|
+
) => NativeStackDescriptor;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DirectStackContextValue {
|
|
38
|
+
state: StackNavigationState<ParamListBase>;
|
|
39
|
+
navigation: NativeStackNavigationHelpers;
|
|
40
|
+
descriptors: NativeStackDescriptorMap;
|
|
41
|
+
preloadedDescriptors: NativeStackDescriptorMap;
|
|
42
|
+
scenes: DirectStackScene[];
|
|
43
|
+
focusedIndex: number;
|
|
44
|
+
shouldShowFloatOverlay: boolean;
|
|
45
|
+
stackProgress: DerivedValue<number>;
|
|
46
|
+
optimisticFocusedIndex: DerivedValue<number>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const DirectStackContext = React.createContext<DirectStackContextValue | null>(
|
|
50
|
+
null,
|
|
51
|
+
);
|
|
52
|
+
DirectStackContext.displayName = "DirectStack";
|
|
53
|
+
|
|
54
|
+
function useDirectStackContext(): DirectStackContextValue {
|
|
55
|
+
const context = React.useContext(DirectStackContext);
|
|
56
|
+
if (!context) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
"useDirectStackContext must be used within DirectStackProvider",
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return context;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Internal hook that computes all lifecycle values.
|
|
66
|
+
*/
|
|
67
|
+
function useDirectStackValue(
|
|
68
|
+
props: DirectStackProps,
|
|
69
|
+
): DirectStackContextValue & { stackContextValue: StackContextValue } {
|
|
70
|
+
const { state, navigation, descriptors, describe } = props;
|
|
71
|
+
const { flags } = useStackCoreContext();
|
|
72
|
+
|
|
73
|
+
const preloadedDescriptors = useMemo(() => {
|
|
74
|
+
return state.preloadedRoutes.reduce<NativeStackDescriptorMap>(
|
|
75
|
+
(acc, route) => {
|
|
76
|
+
acc[route.key] = acc[route.key] || describe(route, true);
|
|
77
|
+
return acc;
|
|
78
|
+
},
|
|
79
|
+
{},
|
|
80
|
+
);
|
|
81
|
+
}, [state.preloadedRoutes, describe]);
|
|
82
|
+
|
|
83
|
+
const {
|
|
84
|
+
scenes,
|
|
85
|
+
shouldShowFloatOverlay,
|
|
86
|
+
routeKeys,
|
|
87
|
+
allRoutes,
|
|
88
|
+
allDescriptors,
|
|
89
|
+
} = useMemo(() => {
|
|
90
|
+
const allRoutes = state.routes.concat(state.preloadedRoutes);
|
|
91
|
+
const scenes: DirectStackScene[] = [];
|
|
92
|
+
const routeKeys: string[] = [];
|
|
93
|
+
const allDescriptors: NativeStackDescriptorMap = {
|
|
94
|
+
...preloadedDescriptors,
|
|
95
|
+
...descriptors,
|
|
96
|
+
};
|
|
97
|
+
let shouldShowFloatOverlay = false;
|
|
98
|
+
|
|
99
|
+
for (const route of allRoutes) {
|
|
100
|
+
const descriptor = allDescriptors[route.key];
|
|
101
|
+
const isPreloaded =
|
|
102
|
+
preloadedDescriptors[route.key] !== undefined &&
|
|
103
|
+
descriptors[route.key] === undefined;
|
|
104
|
+
|
|
105
|
+
scenes.push({ route, descriptor, isPreloaded });
|
|
106
|
+
routeKeys.push(route.key);
|
|
107
|
+
|
|
108
|
+
if (!shouldShowFloatOverlay && descriptor) {
|
|
109
|
+
const options = descriptor.options;
|
|
110
|
+
if (
|
|
111
|
+
options?.enableTransitions === true &&
|
|
112
|
+
options?.overlayMode === "float" &&
|
|
113
|
+
options?.overlayShown === true
|
|
114
|
+
) {
|
|
115
|
+
shouldShowFloatOverlay = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
scenes,
|
|
122
|
+
shouldShowFloatOverlay,
|
|
123
|
+
routeKeys,
|
|
124
|
+
allRoutes,
|
|
125
|
+
allDescriptors,
|
|
126
|
+
};
|
|
127
|
+
}, [state.routes, state.preloadedRoutes, descriptors, preloadedDescriptors]);
|
|
128
|
+
|
|
129
|
+
// Get animation store maps for all routes
|
|
130
|
+
const animationMaps = useMemo(
|
|
131
|
+
() => allRoutes.map((route) => AnimationStore.getAll(route.key)),
|
|
132
|
+
[allRoutes],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const stackProgress = useDerivedValue(() => {
|
|
136
|
+
"worklet";
|
|
137
|
+
let total = 0;
|
|
138
|
+
for (let i = 0; i < animationMaps.length; i++) {
|
|
139
|
+
total += animationMaps[i].progress.value;
|
|
140
|
+
}
|
|
141
|
+
return total;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const optimisticFocusedIndex = useDerivedValue(() => {
|
|
145
|
+
"worklet";
|
|
146
|
+
const currentIndex = animationMaps.length - 1;
|
|
147
|
+
let isAnyClosing = false;
|
|
148
|
+
for (let i = 0; i < animationMaps.length; i++) {
|
|
149
|
+
if (animationMaps[i].closing.value > 0) {
|
|
150
|
+
isAnyClosing = true;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return currentIndex - (isAnyClosing ? 1 : 0);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const focusedIndex = state.index;
|
|
158
|
+
|
|
159
|
+
const stackContextValue = useMemo<StackContextValue>(
|
|
160
|
+
() => ({
|
|
161
|
+
flags,
|
|
162
|
+
routeKeys,
|
|
163
|
+
routes: allRoutes,
|
|
164
|
+
descriptors: allDescriptors,
|
|
165
|
+
scenes,
|
|
166
|
+
focusedIndex,
|
|
167
|
+
stackProgress,
|
|
168
|
+
optimisticFocusedIndex,
|
|
169
|
+
}),
|
|
170
|
+
[
|
|
171
|
+
routeKeys,
|
|
172
|
+
allRoutes,
|
|
173
|
+
allDescriptors,
|
|
174
|
+
scenes,
|
|
175
|
+
focusedIndex,
|
|
176
|
+
stackProgress,
|
|
177
|
+
optimisticFocusedIndex,
|
|
178
|
+
flags,
|
|
179
|
+
],
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
// DirectStack context value
|
|
183
|
+
const lifecycleValue = useMemo<DirectStackContextValue>(
|
|
184
|
+
() => ({
|
|
185
|
+
state,
|
|
186
|
+
navigation,
|
|
187
|
+
descriptors,
|
|
188
|
+
preloadedDescriptors,
|
|
189
|
+
scenes,
|
|
190
|
+
focusedIndex,
|
|
191
|
+
shouldShowFloatOverlay,
|
|
192
|
+
stackProgress,
|
|
193
|
+
optimisticFocusedIndex,
|
|
194
|
+
}),
|
|
195
|
+
[
|
|
196
|
+
state,
|
|
197
|
+
navigation,
|
|
198
|
+
descriptors,
|
|
199
|
+
preloadedDescriptors,
|
|
200
|
+
scenes,
|
|
201
|
+
focusedIndex,
|
|
202
|
+
shouldShowFloatOverlay,
|
|
203
|
+
stackProgress,
|
|
204
|
+
optimisticFocusedIndex,
|
|
205
|
+
],
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
return { ...lifecycleValue, stackContextValue };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* HOC that wraps component with DirectStack provider AND StackContext.
|
|
213
|
+
* Used by native-stack which uses navigation state directly (no local route management).
|
|
214
|
+
*/
|
|
215
|
+
function withDirectStack<TProps extends DirectStackProps>(
|
|
216
|
+
Component: React.ComponentType<DirectStackContextValue>,
|
|
217
|
+
): React.FC<TProps> {
|
|
218
|
+
return function DirectStackProvider(props: TProps) {
|
|
219
|
+
const { stackContextValue, ...lifecycleValue } = useDirectStackValue(props);
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<StackContext.Provider value={stackContextValue}>
|
|
223
|
+
<DirectStackContext.Provider value={lifecycleValue}>
|
|
224
|
+
<Component {...lifecycleValue} />
|
|
225
|
+
</DirectStackContext.Provider>
|
|
226
|
+
</StackContext.Provider>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export { useDirectStackContext, withDirectStack };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
BaseStackDescriptor,
|
|
3
|
+
BaseStackRoute,
|
|
4
|
+
} from "../../../types/stack.types";
|
|
5
|
+
|
|
6
|
+
type DescriptorWithDetach = BaseStackDescriptor & {
|
|
7
|
+
options: { detachPreviousScreen?: boolean };
|
|
8
|
+
};
|
|
3
9
|
|
|
4
10
|
export function calculateActiveScreensLimit(
|
|
5
|
-
routes:
|
|
6
|
-
descriptors:
|
|
11
|
+
routes: BaseStackRoute[],
|
|
12
|
+
descriptors: Record<string, DescriptorWithDetach>,
|
|
7
13
|
): number {
|
|
8
14
|
if (routes.length === 0) {
|
|
9
15
|
return 1;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { StackActions } from "@react-navigation/native";
|
|
2
|
+
import { useLayoutEffect, useState } from "react";
|
|
3
|
+
import { useClosingRouteKeys } from "../../../hooks/navigation/use-closing-route-keys";
|
|
4
|
+
import { usePrevious } from "../../../hooks/navigation/use-previous";
|
|
5
|
+
import useStableCallback from "../../../hooks/use-stable-callback";
|
|
6
|
+
import type {
|
|
7
|
+
BaseStackDescriptor,
|
|
8
|
+
BaseStackNavigation,
|
|
9
|
+
BaseStackRoute,
|
|
10
|
+
} from "../../../types/stack.types";
|
|
11
|
+
import { alignRoutesWithLatest } from "../../../utils/navigation/align-routes-with-latest";
|
|
12
|
+
import { areDescriptorsEqual } from "../../../utils/navigation/are-descriptors-equal";
|
|
13
|
+
import { haveSameRouteKeys } from "../../../utils/navigation/have-same-route-keys";
|
|
14
|
+
import { routesAreIdentical } from "../../../utils/navigation/routes-are-identical";
|
|
15
|
+
import { syncRoutesWithRemoved } from "../../../utils/navigation/sync-routes-with-removed";
|
|
16
|
+
import type { ManagedStackProps } from "../managed.provider";
|
|
17
|
+
|
|
18
|
+
export const useLocalRoutes = <
|
|
19
|
+
TDescriptor extends BaseStackDescriptor,
|
|
20
|
+
TNavigation extends BaseStackNavigation,
|
|
21
|
+
>(
|
|
22
|
+
props: ManagedStackProps<TDescriptor, TNavigation>,
|
|
23
|
+
) => {
|
|
24
|
+
type TRoute = TDescriptor["route"];
|
|
25
|
+
type TDescriptorMap = Record<string, TDescriptor>;
|
|
26
|
+
|
|
27
|
+
const previousRoutes = usePrevious(props.state.routes) ?? [];
|
|
28
|
+
const closingRouteKeys = useClosingRouteKeys();
|
|
29
|
+
|
|
30
|
+
const [localState, setLocalState] = useState(() => ({
|
|
31
|
+
routes: props.state.routes as TRoute[],
|
|
32
|
+
descriptors: props.descriptors as TDescriptorMap,
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
|
+
const nextRoutesSnapshot = props.state.routes;
|
|
37
|
+
const previousRoutesSnapshot = previousRoutes;
|
|
38
|
+
|
|
39
|
+
setLocalState((current) => {
|
|
40
|
+
const routeKeysUnchanged = haveSameRouteKeys(
|
|
41
|
+
previousRoutesSnapshot,
|
|
42
|
+
nextRoutesSnapshot,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
let derivedRoutes: TRoute[];
|
|
46
|
+
let derivedDescriptors: TDescriptorMap;
|
|
47
|
+
|
|
48
|
+
if (routeKeysUnchanged) {
|
|
49
|
+
const result = alignRoutesWithLatest(
|
|
50
|
+
current.routes,
|
|
51
|
+
current.descriptors,
|
|
52
|
+
nextRoutesSnapshot,
|
|
53
|
+
props.descriptors,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
derivedRoutes = result.routes as TRoute[];
|
|
57
|
+
derivedDescriptors = result.descriptors as TDescriptorMap;
|
|
58
|
+
} else {
|
|
59
|
+
const fallbackRoutes =
|
|
60
|
+
previousRoutesSnapshot.length > 0
|
|
61
|
+
? previousRoutesSnapshot
|
|
62
|
+
: current.routes;
|
|
63
|
+
|
|
64
|
+
const result = syncRoutesWithRemoved({
|
|
65
|
+
prevRoutes: fallbackRoutes,
|
|
66
|
+
prevDescriptors: current.descriptors,
|
|
67
|
+
nextRoutes: nextRoutesSnapshot,
|
|
68
|
+
nextDescriptors: props.descriptors,
|
|
69
|
+
closingRouteKeys,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
derivedRoutes = result.routes as TRoute[];
|
|
73
|
+
derivedDescriptors = result.descriptors as TDescriptorMap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const routesChanged = !routesAreIdentical(current.routes, derivedRoutes);
|
|
77
|
+
const descriptorsChanged = !areDescriptorsEqual(
|
|
78
|
+
current.descriptors,
|
|
79
|
+
derivedDescriptors,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
if (!routesChanged && !descriptorsChanged) {
|
|
83
|
+
return current;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
routes: routesChanged ? derivedRoutes : current.routes,
|
|
88
|
+
descriptors: descriptorsChanged
|
|
89
|
+
? derivedDescriptors
|
|
90
|
+
: current.descriptors,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}, [props.state.routes, props.descriptors, previousRoutes, closingRouteKeys]);
|
|
94
|
+
|
|
95
|
+
const handleCloseRoute = useStableCallback(
|
|
96
|
+
({ route }: { route: BaseStackRoute }) => {
|
|
97
|
+
if (props.state.routes.some((r) => r.key === route.key)) {
|
|
98
|
+
props.navigation.dispatch({
|
|
99
|
+
...StackActions.pop(),
|
|
100
|
+
source: route.key,
|
|
101
|
+
target: props.state.key,
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
closingRouteKeys.remove(route.key);
|
|
107
|
+
|
|
108
|
+
setLocalState((current) => {
|
|
109
|
+
if (!current.routes.some((candidate) => candidate.key === route.key)) {
|
|
110
|
+
return current;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const nextRoutes = current.routes.filter(
|
|
114
|
+
(candidate) => candidate.key !== route.key,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const nextDescriptors = { ...current.descriptors };
|
|
118
|
+
delete nextDescriptors[route.key];
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
routes: nextRoutes,
|
|
122
|
+
descriptors: nextDescriptors,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
state: localState,
|
|
130
|
+
handleCloseRoute,
|
|
131
|
+
closingRouteKeys,
|
|
132
|
+
};
|
|
133
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { Route } from "@react-navigation/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import {
|
|
5
|
+
type DerivedValue,
|
|
6
|
+
type SharedValue,
|
|
7
|
+
useDerivedValue,
|
|
8
|
+
} from "react-native-reanimated";
|
|
9
|
+
import {
|
|
10
|
+
StackContext,
|
|
11
|
+
type StackContextValue,
|
|
12
|
+
} from "../../hooks/navigation/use-stack";
|
|
13
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
14
|
+
import type {
|
|
15
|
+
BaseStackDescriptor,
|
|
16
|
+
BaseStackNavigation,
|
|
17
|
+
BaseStackRoute,
|
|
18
|
+
BaseStackScene,
|
|
19
|
+
BaseStackState,
|
|
20
|
+
} from "../../types/stack.types";
|
|
21
|
+
import { useStackCoreContext } from "./core.provider";
|
|
22
|
+
import { calculateActiveScreensLimit } from "./helpers/active-screens-limit";
|
|
23
|
+
import { useLocalRoutes } from "./helpers/use-local-routes";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Props for managed stack - generic over descriptor and navigation types.
|
|
27
|
+
* Defaults to base types for backward compatibility.
|
|
28
|
+
*/
|
|
29
|
+
export interface ManagedStackProps<
|
|
30
|
+
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
31
|
+
TNavigation extends BaseStackNavigation = BaseStackNavigation,
|
|
32
|
+
> {
|
|
33
|
+
state: BaseStackState<TDescriptor["route"]>;
|
|
34
|
+
navigation: TNavigation;
|
|
35
|
+
descriptors: Record<string, TDescriptor>;
|
|
36
|
+
describe: (route: TDescriptor["route"], placeholder: boolean) => TDescriptor;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Context value for managed stack - generic over descriptor type.
|
|
41
|
+
*/
|
|
42
|
+
interface ManagedStackContextValue<
|
|
43
|
+
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
44
|
+
> {
|
|
45
|
+
routes: TDescriptor["route"][];
|
|
46
|
+
descriptors: Record<string, TDescriptor>;
|
|
47
|
+
scenes: BaseStackScene<TDescriptor>[];
|
|
48
|
+
activeScreensLimit: number;
|
|
49
|
+
closingRouteKeysShared: SharedValue<string[]>;
|
|
50
|
+
handleCloseRoute: (payload: { route: BaseStackRoute }) => void;
|
|
51
|
+
shouldShowFloatOverlay: boolean;
|
|
52
|
+
focusedIndex: number;
|
|
53
|
+
stackProgress: DerivedValue<number>;
|
|
54
|
+
optimisticFocusedIndex: DerivedValue<number>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ManagedStackContext =
|
|
58
|
+
React.createContext<ManagedStackContextValue | null>(null);
|
|
59
|
+
ManagedStackContext.displayName = "ManagedStack";
|
|
60
|
+
|
|
61
|
+
function useManagedStackContext<
|
|
62
|
+
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
63
|
+
>(): ManagedStackContextValue<TDescriptor> {
|
|
64
|
+
const context = React.useContext(ManagedStackContext);
|
|
65
|
+
if (!context) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"useManagedStackContext must be used within ManagedStackProvider",
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return context as ManagedStackContextValue<TDescriptor>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function useManagedStackValue<
|
|
74
|
+
TDescriptor extends BaseStackDescriptor,
|
|
75
|
+
TNavigation extends BaseStackNavigation,
|
|
76
|
+
>(
|
|
77
|
+
props: ManagedStackProps<TDescriptor, TNavigation>,
|
|
78
|
+
): ManagedStackContextValue<TDescriptor> & {
|
|
79
|
+
stackContextValue: StackContextValue;
|
|
80
|
+
} {
|
|
81
|
+
const { flags } = useStackCoreContext();
|
|
82
|
+
const { state, handleCloseRoute, closingRouteKeys } = useLocalRoutes(props);
|
|
83
|
+
|
|
84
|
+
const { scenes, activeScreensLimit, shouldShowFloatOverlay, routeKeys } =
|
|
85
|
+
useMemo(() => {
|
|
86
|
+
const scenes: BaseStackScene<TDescriptor>[] = [];
|
|
87
|
+
const routeKeys: string[] = [];
|
|
88
|
+
let shouldShowFloatOverlay = false;
|
|
89
|
+
|
|
90
|
+
for (const route of state.routes) {
|
|
91
|
+
const descriptor = state.descriptors[route.key] as TDescriptor;
|
|
92
|
+
scenes.push({ route, descriptor });
|
|
93
|
+
routeKeys.push(route.key);
|
|
94
|
+
|
|
95
|
+
if (!shouldShowFloatOverlay) {
|
|
96
|
+
const options = descriptor?.options;
|
|
97
|
+
shouldShowFloatOverlay =
|
|
98
|
+
options?.overlayMode === "float" && options?.overlayShown === true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
scenes,
|
|
104
|
+
routeKeys,
|
|
105
|
+
activeScreensLimit: calculateActiveScreensLimit(
|
|
106
|
+
state.routes,
|
|
107
|
+
state.descriptors,
|
|
108
|
+
),
|
|
109
|
+
shouldShowFloatOverlay,
|
|
110
|
+
};
|
|
111
|
+
}, [state.routes, state.descriptors]);
|
|
112
|
+
|
|
113
|
+
// Get animation store maps for LOCAL routes (including closing routes)
|
|
114
|
+
const animationMaps = useMemo(
|
|
115
|
+
() => state.routes.map((route) => AnimationStore.getAll(route.key)),
|
|
116
|
+
[state.routes],
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// Aggregated stack progress from LOCAL routes (includes closing routes)
|
|
120
|
+
const stackProgress = useDerivedValue(() => {
|
|
121
|
+
"worklet";
|
|
122
|
+
let total = 0;
|
|
123
|
+
for (let i = 0; i < animationMaps.length; i++) {
|
|
124
|
+
total += animationMaps[i].progress.value;
|
|
125
|
+
}
|
|
126
|
+
return total;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Optimistic focused index: accounts for closing screens
|
|
130
|
+
const optimisticFocusedIndex = useDerivedValue(() => {
|
|
131
|
+
"worklet";
|
|
132
|
+
const currentIndex = animationMaps.length - 1;
|
|
133
|
+
let isAnyClosing = false;
|
|
134
|
+
for (let i = 0; i < animationMaps.length; i++) {
|
|
135
|
+
if (animationMaps[i].closing.value > 0) {
|
|
136
|
+
isAnyClosing = true;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return currentIndex - Number(isAnyClosing);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const focusedIndex = props.state.index;
|
|
144
|
+
|
|
145
|
+
// StackContext value - for overlays via useStack()
|
|
146
|
+
const stackContextValue = useMemo<StackContextValue>(
|
|
147
|
+
() => ({
|
|
148
|
+
flags,
|
|
149
|
+
routeKeys,
|
|
150
|
+
routes: state.routes as Route<string>[],
|
|
151
|
+
descriptors: state.descriptors as Record<string, BaseStackDescriptor>,
|
|
152
|
+
scenes: scenes as BaseStackScene[],
|
|
153
|
+
focusedIndex,
|
|
154
|
+
stackProgress,
|
|
155
|
+
optimisticFocusedIndex,
|
|
156
|
+
}),
|
|
157
|
+
[
|
|
158
|
+
routeKeys,
|
|
159
|
+
state.routes,
|
|
160
|
+
state.descriptors,
|
|
161
|
+
scenes,
|
|
162
|
+
focusedIndex,
|
|
163
|
+
stackProgress,
|
|
164
|
+
optimisticFocusedIndex,
|
|
165
|
+
flags,
|
|
166
|
+
],
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
// ManagedStack context value
|
|
170
|
+
const lifecycleValue = useMemo<ManagedStackContextValue<TDescriptor>>(
|
|
171
|
+
() => ({
|
|
172
|
+
routes: state.routes,
|
|
173
|
+
focusedIndex,
|
|
174
|
+
descriptors: state.descriptors,
|
|
175
|
+
closingRouteKeysShared: closingRouteKeys.shared,
|
|
176
|
+
activeScreensLimit,
|
|
177
|
+
handleCloseRoute,
|
|
178
|
+
scenes,
|
|
179
|
+
shouldShowFloatOverlay,
|
|
180
|
+
stackProgress,
|
|
181
|
+
optimisticFocusedIndex,
|
|
182
|
+
}),
|
|
183
|
+
[
|
|
184
|
+
state.routes,
|
|
185
|
+
state.descriptors,
|
|
186
|
+
focusedIndex,
|
|
187
|
+
closingRouteKeys.shared,
|
|
188
|
+
activeScreensLimit,
|
|
189
|
+
handleCloseRoute,
|
|
190
|
+
scenes,
|
|
191
|
+
shouldShowFloatOverlay,
|
|
192
|
+
stackProgress,
|
|
193
|
+
optimisticFocusedIndex,
|
|
194
|
+
],
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
return { ...lifecycleValue, stackContextValue };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* HOC that wraps component with ManagedStack provider AND StackContext.
|
|
202
|
+
* Used by blank-stack which manages local route state for closing animations.
|
|
203
|
+
* Generic over descriptor type - defaults to BaseStackDescriptor.
|
|
204
|
+
*/
|
|
205
|
+
function withManagedStack<
|
|
206
|
+
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
207
|
+
TNavigation extends BaseStackNavigation = BaseStackNavigation,
|
|
208
|
+
>(
|
|
209
|
+
Component: React.ComponentType<ManagedStackContextValue<TDescriptor>>,
|
|
210
|
+
): React.FC<ManagedStackProps<TDescriptor, TNavigation>> {
|
|
211
|
+
return function ManagedStackProvider(
|
|
212
|
+
props: ManagedStackProps<TDescriptor, TNavigation>,
|
|
213
|
+
) {
|
|
214
|
+
const { stackContextValue, ...lifecycleValue } = useManagedStackValue<
|
|
215
|
+
TDescriptor,
|
|
216
|
+
TNavigation
|
|
217
|
+
>(props);
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<StackContext.Provider value={stackContextValue}>
|
|
221
|
+
<ManagedStackContext.Provider value={lifecycleValue}>
|
|
222
|
+
<Component {...lifecycleValue} />
|
|
223
|
+
</ManagedStackContext.Provider>
|
|
224
|
+
</StackContext.Provider>
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { useManagedStackContext, withManagedStack };
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
makeMutable,
|
|
4
4
|
type StyleProps,
|
|
5
5
|
} from "react-native-reanimated";
|
|
6
|
-
import type { Any } from "../types/utils.types";
|
|
7
6
|
|
|
8
7
|
type TagID = string;
|
|
9
8
|
type ScreenKey = string;
|
|
@@ -38,7 +37,7 @@ function registerSnapshot(
|
|
|
38
37
|
ancestorKeys?: ScreenKey[],
|
|
39
38
|
) {
|
|
40
39
|
"worklet";
|
|
41
|
-
registry.modify((state:
|
|
40
|
+
registry.modify((state: any) => {
|
|
42
41
|
"worklet";
|
|
43
42
|
if (!state[tag]) {
|
|
44
43
|
state[tag] = { snapshots: {}, linkStack: [] };
|
|
@@ -56,7 +55,7 @@ function setLinkSource(
|
|
|
56
55
|
ancestorKeys?: ScreenKey[],
|
|
57
56
|
) {
|
|
58
57
|
"worklet";
|
|
59
|
-
registry.modify((state:
|
|
58
|
+
registry.modify((state: any) => {
|
|
60
59
|
"worklet";
|
|
61
60
|
if (!state[tag]) state[tag] = { snapshots: {}, linkStack: [] };
|
|
62
61
|
|
|
@@ -76,7 +75,7 @@ function setLinkDestination(
|
|
|
76
75
|
ancestorKeys?: ScreenKey[],
|
|
77
76
|
) {
|
|
78
77
|
"worklet";
|
|
79
|
-
registry.modify((state:
|
|
78
|
+
registry.modify((state: any) => {
|
|
80
79
|
"worklet";
|
|
81
80
|
const stack = state[tag]?.linkStack;
|
|
82
81
|
if (!stack || stack.length === 0) return state;
|
|
@@ -173,7 +172,7 @@ function getActiveLink(tag: TagID, screenKey?: ScreenKey): TagLink | null {
|
|
|
173
172
|
*/
|
|
174
173
|
function clear(screenKey: ScreenKey) {
|
|
175
174
|
"worklet";
|
|
176
|
-
registry.modify((state:
|
|
175
|
+
registry.modify((state: any) => {
|
|
177
176
|
"worklet";
|
|
178
177
|
for (const tag in state) {
|
|
179
178
|
// Remove snapshot
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
makeMutable,
|
|
4
4
|
type SharedValue,
|
|
5
5
|
} from "react-native-reanimated";
|
|
6
|
-
import type { ScreenKey } from "../types/core.types";
|
|
7
6
|
import type { GestureDirection } from "../types/gesture.types";
|
|
7
|
+
import type { ScreenKey } from "../types/screen.types";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type GestureKey =
|
|
10
10
|
| "x"
|
|
11
11
|
| "y"
|
|
12
12
|
| "normalizedX"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { ParamListBase, RouteProp } from "@react-navigation/native";
|
|
2
1
|
import type {
|
|
3
2
|
StyleProps,
|
|
4
3
|
WithSpringConfig,
|
|
5
4
|
WithTimingConfig,
|
|
6
5
|
} from "react-native-reanimated";
|
|
7
6
|
import type { EdgeInsets } from "react-native-safe-area-context";
|
|
7
|
+
import type { BaseRoute } from "../providers/screen/keys.provider";
|
|
8
8
|
import type { BoundsAccessor } from "./bounds.types";
|
|
9
|
-
import type { Layout } from "./core.types";
|
|
10
9
|
import type { GestureValues } from "./gesture.types";
|
|
10
|
+
import type { Layout } from "./screen.types";
|
|
11
11
|
|
|
12
12
|
export interface OverlayInterpolationProps {
|
|
13
13
|
progress: number;
|
|
@@ -74,7 +74,7 @@ export type ScreenTransitionState = {
|
|
|
74
74
|
* Pass route params via options: `options={({ route }) => ({ meta: { id: route.params.id } })}`
|
|
75
75
|
* This field may be removed in a future version.
|
|
76
76
|
*/
|
|
77
|
-
route:
|
|
77
|
+
route: BaseRoute;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export interface ScreenInterpolationProps {
|