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,89 @@
|
|
|
1
|
+
import type { Route } from "@react-navigation/native";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import type { DerivedValue } from "react-native-reanimated";
|
|
4
|
+
import type { StackCoreContextValue } from "../../providers/stack/core.provider";
|
|
5
|
+
import type { OverlayMode, OverlayProps } from "../../types/overlay.types";
|
|
6
|
+
import type {
|
|
7
|
+
BaseStackDescriptor,
|
|
8
|
+
BaseStackNavigation,
|
|
9
|
+
BaseStackRoute,
|
|
10
|
+
BaseStackScene,
|
|
11
|
+
} from "../../types/stack.types";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Stack descriptor with overlay options.
|
|
15
|
+
* Extends BaseStackDescriptor with overlay-specific options.
|
|
16
|
+
*/
|
|
17
|
+
export interface StackDescriptor<
|
|
18
|
+
TRoute extends BaseStackRoute = Route<string>,
|
|
19
|
+
TNavigation extends BaseStackNavigation = BaseStackNavigation,
|
|
20
|
+
> extends BaseStackDescriptor<TRoute, TNavigation> {
|
|
21
|
+
options: BaseStackDescriptor["options"] & {
|
|
22
|
+
overlay?: (props: OverlayProps) => React.ReactNode;
|
|
23
|
+
overlayMode?: OverlayMode;
|
|
24
|
+
overlayShown?: boolean;
|
|
25
|
+
meta?: Record<string, unknown>;
|
|
26
|
+
enableTransitions?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Scene type for stack context (route + descriptor pair).
|
|
32
|
+
*/
|
|
33
|
+
export type StackScene<TDescriptor extends StackDescriptor = StackDescriptor> =
|
|
34
|
+
BaseStackScene<TDescriptor>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Common stack context value that both managed and direct stack providers populate.
|
|
38
|
+
* Used by overlays and shared components that need stack progress info.
|
|
39
|
+
*/
|
|
40
|
+
export interface StackContextValue extends StackCoreContextValue {
|
|
41
|
+
/**
|
|
42
|
+
* Route keys for all routes in the stack.
|
|
43
|
+
*/
|
|
44
|
+
routeKeys: string[];
|
|
45
|
+
/**
|
|
46
|
+
* All routes in the stack.
|
|
47
|
+
*/
|
|
48
|
+
routes: Route<string>[];
|
|
49
|
+
/**
|
|
50
|
+
* Descriptor map for all routes.
|
|
51
|
+
*/
|
|
52
|
+
descriptors: Record<string, StackDescriptor>;
|
|
53
|
+
/**
|
|
54
|
+
* Pre-computed scenes (route + descriptor pairs).
|
|
55
|
+
*/
|
|
56
|
+
scenes: StackScene[];
|
|
57
|
+
/**
|
|
58
|
+
* The current focused index from navigation state.
|
|
59
|
+
*/
|
|
60
|
+
focusedIndex: number;
|
|
61
|
+
/**
|
|
62
|
+
* Aggregated stack progress across all routes.
|
|
63
|
+
* Sum of all individual screen progress values.
|
|
64
|
+
* When 4 screens are fully visible, stackProgress = 4.
|
|
65
|
+
*/
|
|
66
|
+
stackProgress: DerivedValue<number>;
|
|
67
|
+
/**
|
|
68
|
+
* Focused index that accounts for closing screens.
|
|
69
|
+
* Returns currentIndex - 1 if any screen is closing, otherwise currentIndex.
|
|
70
|
+
*/
|
|
71
|
+
optimisticFocusedIndex: DerivedValue<number>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const StackContext = createContext<StackContextValue | null>(null);
|
|
75
|
+
StackContext.displayName = "Stack";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Hook to access common stack context values.
|
|
79
|
+
* Works in both blank-stack and native-stack navigators.
|
|
80
|
+
*/
|
|
81
|
+
export function useStack<T extends StackContextValue = StackContextValue>(): T {
|
|
82
|
+
const context = useContext(StackContext);
|
|
83
|
+
|
|
84
|
+
if (context === null) {
|
|
85
|
+
throw new Error("useStack must be used within a Stack provider");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return context as T;
|
|
89
|
+
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type SharedValue,
|
|
6
6
|
useAnimatedReaction,
|
|
7
7
|
} from "react-native-reanimated";
|
|
8
|
+
import { IS_WEB } from "../../constants";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Derives React state from a Reanimated SharedValue.
|
|
@@ -12,6 +13,10 @@ import {
|
|
|
12
13
|
*/
|
|
13
14
|
export function useSharedValueState<T>(sharedValue: SharedValue<T>): T {
|
|
14
15
|
const [state, setState] = useState<T>(() => {
|
|
16
|
+
if (IS_WEB) {
|
|
17
|
+
// Web fallback - executeOnUIRuntimeSync not available
|
|
18
|
+
return sharedValue.value;
|
|
19
|
+
}
|
|
15
20
|
const readOnUI = executeOnUIRuntimeSync((sv: SharedValue<T>) => {
|
|
16
21
|
"worklet";
|
|
17
22
|
return sv.value;
|
package/src/shared/index.ts
CHANGED
|
@@ -23,9 +23,14 @@ export { useScreenGesture } from "./hooks/gestures/use-screen-gesture";
|
|
|
23
23
|
|
|
24
24
|
export type {
|
|
25
25
|
AnimationConfig,
|
|
26
|
+
BoundEntry,
|
|
27
|
+
BoundsLink,
|
|
26
28
|
OverlayInterpolationProps,
|
|
29
|
+
OverlayMode,
|
|
30
|
+
OverlayProps,
|
|
27
31
|
ScreenInterpolationProps,
|
|
28
32
|
ScreenStyleInterpolator,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
ScreenTransitionConfig,
|
|
34
|
+
TransitionInterpolatedStyle,
|
|
35
|
+
TransitionSpec,
|
|
36
|
+
} from "./types";
|
|
@@ -8,7 +8,7 @@ import { useSharedValue } from "react-native-reanimated";
|
|
|
8
8
|
import { useBuildGestures } from "../hooks/gestures/use-build-gestures";
|
|
9
9
|
import type { GestureStoreMap } from "../stores/gesture.store";
|
|
10
10
|
import createProvider from "../utils/create-provider";
|
|
11
|
-
import { useKeys } from "./keys.provider";
|
|
11
|
+
import { useKeys } from "./screen/keys.provider";
|
|
12
12
|
|
|
13
13
|
export type ScrollConfig = {
|
|
14
14
|
x: number;
|
|
@@ -29,11 +29,15 @@ export interface GestureContextType {
|
|
|
29
29
|
gestureEnabled: boolean;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
interface ScreenGestureProviderProps {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
export const {
|
|
33
37
|
ScreenGestureProvider,
|
|
34
38
|
useScreenGestureContext: useGestureContext,
|
|
35
39
|
} = createProvider("ScreenGesture", { guarded: false })<
|
|
36
|
-
|
|
40
|
+
ScreenGestureProviderProps,
|
|
37
41
|
GestureContextType
|
|
38
42
|
>(({ children }) => {
|
|
39
43
|
const { current } = useKeys();
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { useWindowDimensions, type View } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
type AnimatedRef,
|
|
5
|
+
type MeasuredDimensions,
|
|
6
|
+
measure,
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
import createProvider from "../utils/create-provider";
|
|
9
|
+
|
|
10
|
+
interface LayoutAnchorProviderProps {
|
|
11
|
+
anchorRef: AnimatedRef<View>;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface LayoutAnchorContextValue {
|
|
16
|
+
/**
|
|
17
|
+
* Corrects measured dimensions for parent transforms (translation and scale).
|
|
18
|
+
* The anchor should be at (0, 0) with full screen dimensions - any difference
|
|
19
|
+
* is from parent transforms. This function reverses those transforms to yield
|
|
20
|
+
* the true layout position and dimensions.
|
|
21
|
+
*/
|
|
22
|
+
correctMeasurement: (measured: MeasuredDimensions) => MeasuredDimensions;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provides a reference point for correcting bounds measurements.
|
|
27
|
+
*
|
|
28
|
+
* When a parent view has transforms applied (e.g., during screen transitions),
|
|
29
|
+
* `measure()` returns visual positions that include those transforms. This provider
|
|
30
|
+
* establishes an anchor point (typically the screen container at 0,0) and exposes
|
|
31
|
+
* a `correctMeasurement` function that reverses translation and scale transforms
|
|
32
|
+
* to yield the true layout position and dimensions.
|
|
33
|
+
*
|
|
34
|
+
* ## How it works
|
|
35
|
+
*
|
|
36
|
+
* 1. **Translation**: Subtract anchor's pageX/pageY offset
|
|
37
|
+
* 2. **Scale**: Compare anchor's measured size to expected (screen) size to compute
|
|
38
|
+
* scale factor, then divide positions and dimensions by that factor
|
|
39
|
+
*/
|
|
40
|
+
const { LayoutAnchorProvider, useLayoutAnchorContext } = createProvider(
|
|
41
|
+
"LayoutAnchor",
|
|
42
|
+
{ guarded: false },
|
|
43
|
+
)<LayoutAnchorProviderProps, LayoutAnchorContextValue>(
|
|
44
|
+
({ anchorRef, children }) => {
|
|
45
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
46
|
+
|
|
47
|
+
const correctMeasurement = (
|
|
48
|
+
measured: MeasuredDimensions,
|
|
49
|
+
): MeasuredDimensions => {
|
|
50
|
+
"worklet";
|
|
51
|
+
const anchor = measure(anchorRef);
|
|
52
|
+
if (!anchor) return measured;
|
|
53
|
+
|
|
54
|
+
// Compute scale factor by comparing anchor size to expected screen size.
|
|
55
|
+
// Anchor should be full-screen (absoluteFill), so any difference is from scale.
|
|
56
|
+
const scaleX = anchor.width > 0 ? anchor.width / screenWidth : 1;
|
|
57
|
+
const scaleY = anchor.height > 0 ? anchor.height / screenHeight : 1;
|
|
58
|
+
|
|
59
|
+
// Get element position relative to anchor (removes translation)
|
|
60
|
+
const relativeX = measured.pageX - anchor.pageX;
|
|
61
|
+
const relativeY = measured.pageY - anchor.pageY;
|
|
62
|
+
|
|
63
|
+
// Reverse scale: divide relative position and dimensions by scale factor
|
|
64
|
+
return {
|
|
65
|
+
x: measured.x,
|
|
66
|
+
y: measured.y,
|
|
67
|
+
width: scaleX !== 1 ? measured.width / scaleX : measured.width,
|
|
68
|
+
height: scaleY !== 1 ? measured.height / scaleY : measured.height,
|
|
69
|
+
pageX: scaleX !== 1 ? relativeX / scaleX : relativeX,
|
|
70
|
+
pageY: scaleY !== 1 ? relativeY / scaleY : relativeY,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
value: { correctMeasurement },
|
|
76
|
+
children,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
export { LayoutAnchorProvider, useLayoutAnchorContext };
|
|
@@ -17,7 +17,8 @@ import { AnimationStore } from "../stores/animation.store";
|
|
|
17
17
|
import { BoundStore } from "../stores/bounds.store";
|
|
18
18
|
import { prepareStyleForBounds } from "../utils/bounds/helpers/styles";
|
|
19
19
|
import createProvider from "../utils/create-provider";
|
|
20
|
-
import {
|
|
20
|
+
import { useLayoutAnchorContext } from "./layout-anchor.provider";
|
|
21
|
+
import { type BaseDescriptor, useKeys } from "./screen/keys.provider";
|
|
21
22
|
|
|
22
23
|
interface MaybeMeasureAndStoreParams {
|
|
23
24
|
onPress?: ((...args: unknown[]) => void) | undefined;
|
|
@@ -47,19 +48,26 @@ interface RegisterBoundsContextValue {
|
|
|
47
48
|
* Returns an array of screen keys from immediate parent to root.
|
|
48
49
|
* [parentKey, grandparentKey, greatGrandparentKey, ...]
|
|
49
50
|
*/
|
|
50
|
-
const getAncestorKeys = (current:
|
|
51
|
+
const getAncestorKeys = (current: BaseDescriptor): string[] => {
|
|
51
52
|
const ancestors: string[] = [];
|
|
52
|
-
|
|
53
|
+
const nav = current.navigation as any;
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
// Safety check for navigators without getParent
|
|
56
|
+
if (typeof nav?.getParent !== "function") {
|
|
57
|
+
return ancestors;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let parent = nav.getParent();
|
|
61
|
+
|
|
62
|
+
while (parent) {
|
|
63
|
+
const state = parent.getState();
|
|
56
64
|
if (state?.routes && state.index !== undefined) {
|
|
57
65
|
const focusedRoute = state.routes[state.index];
|
|
58
66
|
if (focusedRoute?.key) {
|
|
59
67
|
ancestors.push(focusedRoute.key);
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
parent = parent.getParent();
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
return ancestors;
|
|
@@ -201,6 +209,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
|
|
|
201
209
|
const { current } = useKeys();
|
|
202
210
|
const currentScreenKey = current.route.key;
|
|
203
211
|
const ancestorKeys = useMemo(() => getAncestorKeys(current), [current]);
|
|
212
|
+
const layoutAnchor = useLayoutAnchorContext();
|
|
204
213
|
|
|
205
214
|
// Context & signals
|
|
206
215
|
const parentContext: RegisterBoundsContextValue | null =
|
|
@@ -234,12 +243,17 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
|
|
|
234
243
|
const measured = measure(animatedRef);
|
|
235
244
|
if (!measured) return;
|
|
236
245
|
|
|
246
|
+
// Correct for parent transforms (e.g., when parent screen is animating)
|
|
247
|
+
const correctedMeasured = layoutAnchor
|
|
248
|
+
? layoutAnchor.correctMeasurement(measured)
|
|
249
|
+
: measured;
|
|
250
|
+
|
|
237
251
|
emitUpdate();
|
|
238
252
|
|
|
239
253
|
BoundStore.registerSnapshot(
|
|
240
254
|
sharedBoundTag,
|
|
241
255
|
currentScreenKey,
|
|
242
|
-
|
|
256
|
+
correctedMeasured,
|
|
243
257
|
preparedStyles,
|
|
244
258
|
ancestorKeys,
|
|
245
259
|
);
|
|
@@ -266,7 +280,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
|
|
|
266
280
|
BoundStore.setLinkSource(
|
|
267
281
|
sharedBoundTag,
|
|
268
282
|
currentScreenKey,
|
|
269
|
-
|
|
283
|
+
correctedMeasured,
|
|
270
284
|
preparedStyles,
|
|
271
285
|
ancestorKeys,
|
|
272
286
|
);
|
|
@@ -277,7 +291,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
|
|
|
277
291
|
BoundStore.setLinkDestination(
|
|
278
292
|
sharedBoundTag,
|
|
279
293
|
currentScreenKey,
|
|
280
|
-
|
|
294
|
+
correctedMeasured,
|
|
281
295
|
preparedStyles,
|
|
282
296
|
ancestorKeys,
|
|
283
297
|
);
|
|
@@ -5,34 +5,49 @@ import type {
|
|
|
5
5
|
RouteProp,
|
|
6
6
|
} from "@react-navigation/native";
|
|
7
7
|
import { createContext, useContext, useMemo } from "react";
|
|
8
|
-
import type { ScreenTransitionConfig } from "
|
|
8
|
+
import type { ScreenTransitionConfig } from "../../types/screen.types";
|
|
9
|
+
import type {
|
|
10
|
+
BaseStackDescriptor,
|
|
11
|
+
BaseStackNavigation,
|
|
12
|
+
BaseStackRoute,
|
|
13
|
+
} from "../../types/stack.types";
|
|
14
|
+
|
|
15
|
+
// Re-export for backward compatibility
|
|
16
|
+
export type { BaseStackNavigation as BaseNavigation };
|
|
17
|
+
export type { BaseStackRoute as BaseRoute };
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Base descriptor interface - minimal contract for all stack types.
|
|
21
|
+
* This allows blank-stack and native-stack to work with the shared
|
|
22
|
+
* providers without tight coupling to React Navigation.
|
|
23
|
+
*/
|
|
24
|
+
export type BaseDescriptor = BaseStackDescriptor;
|
|
9
25
|
|
|
26
|
+
/**
|
|
27
|
+
* React Navigation specific descriptor - extends base with full typing
|
|
28
|
+
*/
|
|
10
29
|
export type TransitionDescriptor = Descriptor<
|
|
11
30
|
ScreenTransitionConfig,
|
|
12
31
|
NavigationProp<ParamListBase>,
|
|
13
32
|
RouteProp<ParamListBase>
|
|
14
33
|
>;
|
|
15
34
|
|
|
16
|
-
|
|
17
|
-
TDescriptor extends TransitionDescriptor = TransitionDescriptor,
|
|
18
|
-
> {
|
|
35
|
+
interface KeysContextType<TDescriptor extends BaseDescriptor = BaseDescriptor> {
|
|
19
36
|
previous?: TDescriptor;
|
|
20
37
|
current: TDescriptor;
|
|
21
38
|
next?: TDescriptor;
|
|
22
39
|
}
|
|
23
40
|
|
|
24
|
-
const KeysContext = createContext<
|
|
25
|
-
KeysContextType<TransitionDescriptor> | undefined
|
|
26
|
-
>(undefined);
|
|
41
|
+
const KeysContext = createContext<KeysContextType | undefined>(undefined);
|
|
27
42
|
|
|
28
|
-
interface KeysProviderProps<TDescriptor extends
|
|
43
|
+
interface KeysProviderProps<TDescriptor extends BaseDescriptor> {
|
|
29
44
|
children: React.ReactNode;
|
|
30
45
|
previous?: TDescriptor;
|
|
31
46
|
current: TDescriptor;
|
|
32
47
|
next?: TDescriptor;
|
|
33
48
|
}
|
|
34
49
|
|
|
35
|
-
export function KeysProvider<TDescriptor extends
|
|
50
|
+
export function KeysProvider<TDescriptor extends BaseDescriptor>({
|
|
36
51
|
children,
|
|
37
52
|
previous,
|
|
38
53
|
current,
|
|
@@ -47,7 +62,7 @@ export function KeysProvider<TDescriptor extends TransitionDescriptor>({
|
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
export function useKeys<
|
|
50
|
-
TDescriptor extends
|
|
65
|
+
TDescriptor extends BaseDescriptor = BaseDescriptor,
|
|
51
66
|
>(): KeysContextType<TDescriptor> {
|
|
52
67
|
const context = useContext(KeysContext);
|
|
53
68
|
if (context === undefined) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
import { RootTransitionAware } from "../../components/root-transition-aware";
|
|
4
|
+
import { ScreenGestureProvider } from "../gestures.provider";
|
|
5
|
+
import { type BaseDescriptor, KeysProvider } from "./keys.provider";
|
|
6
|
+
import { ScreenStylesProvider } from "./styles.provider";
|
|
7
|
+
|
|
8
|
+
type Props<TDescriptor extends BaseDescriptor> = {
|
|
9
|
+
previous?: TDescriptor;
|
|
10
|
+
current: TDescriptor;
|
|
11
|
+
next?: TDescriptor;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
LifecycleController: ComponentType<any>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function ScreenComposer<TDescriptor extends BaseDescriptor>({
|
|
17
|
+
previous,
|
|
18
|
+
current,
|
|
19
|
+
next,
|
|
20
|
+
children,
|
|
21
|
+
LifecycleController,
|
|
22
|
+
}: Props<TDescriptor>) {
|
|
23
|
+
return (
|
|
24
|
+
<KeysProvider<TDescriptor>
|
|
25
|
+
previous={previous}
|
|
26
|
+
current={current}
|
|
27
|
+
next={next}
|
|
28
|
+
>
|
|
29
|
+
<ScreenGestureProvider>
|
|
30
|
+
<LifecycleController>
|
|
31
|
+
<ScreenStylesProvider>
|
|
32
|
+
<RootTransitionAware>{children}</RootTransitionAware>
|
|
33
|
+
</ScreenStylesProvider>
|
|
34
|
+
</LifecycleController>
|
|
35
|
+
</ScreenGestureProvider>
|
|
36
|
+
</KeysProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
type SharedValue,
|
|
4
|
+
useDerivedValue,
|
|
5
|
+
useSharedValue,
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { NO_STYLES } from "../../constants";
|
|
8
|
+
import { _useScreenAnimation } from "../../hooks/animation/use-screen-animation";
|
|
9
|
+
import type { TransitionInterpolatedStyle } from "../../types/animation.types";
|
|
10
|
+
import { createBounds } from "../../utils/bounds";
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type ScreenStylesContextValue = {
|
|
17
|
+
stylesMap: SharedValue<TransitionInterpolatedStyle>;
|
|
18
|
+
ancestorStylesMaps: SharedValue<TransitionInterpolatedStyle>[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ScreenStylesContext = createContext<ScreenStylesContextValue | null>(
|
|
22
|
+
null,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function ScreenStylesProvider({ children }: Props) {
|
|
26
|
+
const parentCtx = useContext(ScreenStylesContext);
|
|
27
|
+
|
|
28
|
+
const { screenInterpolatorProps, nextInterpolator, currentInterpolator } =
|
|
29
|
+
_useScreenAnimation();
|
|
30
|
+
|
|
31
|
+
// Track when a gesture is triggered while another screen is closing
|
|
32
|
+
const hasTriggeredGestureWhileInFlight = useSharedValue(false);
|
|
33
|
+
|
|
34
|
+
const stylesMap = useDerivedValue<TransitionInterpolatedStyle>(() => {
|
|
35
|
+
"worklet";
|
|
36
|
+
const props = screenInterpolatorProps.value;
|
|
37
|
+
const bounds = createBounds(props);
|
|
38
|
+
|
|
39
|
+
// Detect when user starts gesture on current screen while next screen is closing
|
|
40
|
+
if (props.current.gesture.isDragging && props.next?.closing) {
|
|
41
|
+
hasTriggeredGestureWhileInFlight.value = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Reset the flag when no longer dragging and next screen is done closing
|
|
45
|
+
if (
|
|
46
|
+
!props.current.gesture.isDragging &&
|
|
47
|
+
!props.next?.closing &&
|
|
48
|
+
hasTriggeredGestureWhileInFlight.value
|
|
49
|
+
) {
|
|
50
|
+
hasTriggeredGestureWhileInFlight.value = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Use current interpolator when gesture triggered while in-flight,
|
|
54
|
+
// otherwise use next interpolator if available (normal case)
|
|
55
|
+
const shouldUseCurrentInterpolator =
|
|
56
|
+
props.current.gesture.isDragging ||
|
|
57
|
+
hasTriggeredGestureWhileInFlight.value;
|
|
58
|
+
|
|
59
|
+
const interpolator = shouldUseCurrentInterpolator
|
|
60
|
+
? currentInterpolator
|
|
61
|
+
: (nextInterpolator ?? currentInterpolator);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Maintainer Note:
|
|
65
|
+
* To avoid unnecessary jumps in off directions, we have to snap back to the currents progress.
|
|
66
|
+
* While this still introduces a 'snap back' animation, it's still very rare that a user would encounter this unless
|
|
67
|
+
* they're spamming things out. Not ideal, but this is the best way to go about dealing with fast rapid gestures.
|
|
68
|
+
*
|
|
69
|
+
* The alternative was preventing users from actually being able to drag back while animation was still in flight. But there was a significant delay
|
|
70
|
+
* when waiting for gestures to register again.
|
|
71
|
+
*/
|
|
72
|
+
const effectiveProps = shouldUseCurrentInterpolator
|
|
73
|
+
? { ...props, progress: props.current.progress, next: undefined }
|
|
74
|
+
: props;
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
if (!interpolator) return NO_STYLES;
|
|
78
|
+
return interpolator({
|
|
79
|
+
...effectiveProps,
|
|
80
|
+
bounds,
|
|
81
|
+
});
|
|
82
|
+
} catch (err) {
|
|
83
|
+
if (__DEV__) {
|
|
84
|
+
console.warn(
|
|
85
|
+
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
86
|
+
err,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return NO_STYLES;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const value = useMemo(() => {
|
|
94
|
+
// Build ancestor chain: [parent, grandparent, great-grandparent, ...]
|
|
95
|
+
const ancestorStylesMaps = parentCtx
|
|
96
|
+
? [parentCtx.stylesMap, ...parentCtx.ancestorStylesMaps]
|
|
97
|
+
: [];
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
stylesMap,
|
|
101
|
+
ancestorStylesMaps,
|
|
102
|
+
};
|
|
103
|
+
}, [stylesMap, parentCtx]);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<ScreenStylesContext.Provider value={value}>
|
|
107
|
+
{children}
|
|
108
|
+
</ScreenStylesContext.Provider>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function useScreenStyles() {
|
|
113
|
+
const ctx = useContext(ScreenStylesContext);
|
|
114
|
+
if (!ctx) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
"useTransitionStyles must be used within a TransitionStylesProvider",
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return ctx;
|
|
120
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SafeAreaProviderCompat } from "@react-navigation/elements";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
5
|
+
import { StackType } from "../../types/stack.types";
|
|
6
|
+
import createProvider from "../../utils/create-provider";
|
|
7
|
+
|
|
8
|
+
export interface StackCoreConfig {
|
|
9
|
+
TRANSITIONS_ALWAYS_ON?: boolean;
|
|
10
|
+
STACK_TYPE?: StackType;
|
|
11
|
+
DISABLE_NATIVE_SCREENS?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface StackCoreProviderProps {
|
|
15
|
+
config: StackCoreConfig;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface StackCoreContextValue {
|
|
20
|
+
flags: {
|
|
21
|
+
TRANSITIONS_ALWAYS_ON: boolean;
|
|
22
|
+
STACK_TYPE?: StackType;
|
|
23
|
+
DISABLE_NATIVE_SCREENS: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { StackCoreProvider: InternalStackCoreProvider, useStackCoreContext } =
|
|
28
|
+
createProvider("StackCore", { guarded: true })<
|
|
29
|
+
StackCoreProviderProps,
|
|
30
|
+
StackCoreContextValue
|
|
31
|
+
>(({ config, children }) => {
|
|
32
|
+
const {
|
|
33
|
+
TRANSITIONS_ALWAYS_ON = false,
|
|
34
|
+
DISABLE_NATIVE_SCREENS = false,
|
|
35
|
+
STACK_TYPE = StackType.BLANK,
|
|
36
|
+
} = config;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
value: {
|
|
40
|
+
flags: {
|
|
41
|
+
TRANSITIONS_ALWAYS_ON,
|
|
42
|
+
STACK_TYPE,
|
|
43
|
+
DISABLE_NATIVE_SCREENS,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
children: (
|
|
47
|
+
<GestureHandlerRootView style={styles.container}>
|
|
48
|
+
<SafeAreaProviderCompat>{children}</SafeAreaProviderCompat>
|
|
49
|
+
</GestureHandlerRootView>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* HOC that wraps a component with the StackCore provider.
|
|
56
|
+
* Just a simple open gate
|
|
57
|
+
*/
|
|
58
|
+
export function withStackCore<TProps extends object>(
|
|
59
|
+
defaultConfig: StackCoreConfig,
|
|
60
|
+
Component: React.ComponentType<TProps>,
|
|
61
|
+
): React.FC<TProps & StackCoreConfig> {
|
|
62
|
+
return function StackCoreWrapper({
|
|
63
|
+
DISABLE_NATIVE_SCREENS,
|
|
64
|
+
TRANSITIONS_ALWAYS_ON,
|
|
65
|
+
STACK_TYPE,
|
|
66
|
+
...props
|
|
67
|
+
}: TProps & StackCoreConfig) {
|
|
68
|
+
// User props first, then defaultConfig overrides (config takes priority)
|
|
69
|
+
const config: StackCoreConfig = {
|
|
70
|
+
...(DISABLE_NATIVE_SCREENS !== undefined && { DISABLE_NATIVE_SCREENS }),
|
|
71
|
+
...(TRANSITIONS_ALWAYS_ON !== undefined && { TRANSITIONS_ALWAYS_ON }),
|
|
72
|
+
...(STACK_TYPE !== undefined && { STACK_TYPE }),
|
|
73
|
+
...defaultConfig,
|
|
74
|
+
};
|
|
75
|
+
return (
|
|
76
|
+
<InternalStackCoreProvider config={config}>
|
|
77
|
+
<Component {...(props as TProps)} />
|
|
78
|
+
</InternalStackCoreProvider>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
container: { flex: 1 },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export { useStackCoreContext };
|