react-native-screen-transitions 3.4.0-alpha.2 → 3.4.0-alpha.4
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/lib/commonjs/component-stack/components/component-screen.js +1 -1
- package/lib/commonjs/component-stack/components/component-screen.js.map +1 -1
- package/lib/commonjs/shared/animation/snap-to.js +6 -3
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +47 -4
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/index.js +4 -18
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +1 -2
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen.js +3 -3
- package/lib/commonjs/shared/components/native-screen.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +43 -0
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +18 -14
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/index.js +7 -4
- package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +8 -5
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +17 -24
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js +5 -3
- package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/shared/configs/presets.js +9 -10
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/constants.js +26 -6
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +11 -36
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/index.js +4 -10
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +12 -9
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/use-build-gestures.js +1 -1
- package/lib/commonjs/shared/providers/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +5 -5
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js +17 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +72 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +22 -108
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +42 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +50 -0
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles.provider.js +34 -10
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +12 -40
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/gesture.store.js +13 -33
- package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
- package/lib/commonjs/shared/stores/system.store.js +31 -0
- package/lib/commonjs/shared/stores/system.store.js.map +1 -0
- package/lib/commonjs/shared/types/bounds.types.js +1 -3
- package/lib/commonjs/shared/types/bounds.types.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +2 -2
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +2 -2
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +23 -50
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +100 -363
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +15 -101
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js +154 -0
- package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/types.js +1 -3
- package/lib/commonjs/shared/utils/bounds/zoom/types.js.map +1 -1
- package/lib/commonjs/shared/utils/create-store.js +54 -0
- package/lib/commonjs/shared/utils/create-store.js.map +1 -0
- package/lib/module/component-stack/components/component-screen.js +1 -1
- package/lib/module/component-stack/components/component-screen.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +6 -3
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +48 -5
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/index.js +4 -18
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +1 -2
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/native-screen.js +3 -3
- package/lib/module/shared/components/native-screen.js.map +1 -1
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js +38 -0
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +1 -0
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +18 -14
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/module/shared/components/screen-container/index.js +7 -4
- package/lib/module/shared/components/screen-container/index.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +8 -5
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +20 -27
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/index.js +5 -3
- package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/shared/configs/presets.js +10 -11
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/constants.js +25 -5
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +12 -37
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/index.js +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +12 -9
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
- package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
- package/lib/module/shared/providers/gestures/use-build-gestures.js +1 -1
- package/lib/module/shared/providers/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +5 -5
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js +12 -0
- package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +67 -0
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +22 -108
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +37 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +44 -0
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/module/shared/providers/screen/styles.provider.js +33 -11
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +12 -40
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/gesture.store.js +13 -33
- package/lib/module/shared/stores/gesture.store.js.map +1 -1
- package/lib/module/shared/stores/system.store.js +27 -0
- package/lib/module/shared/stores/system.store.js.map +1 -0
- package/lib/module/shared/types/bounds.types.js +9 -1
- package/lib/module/shared/types/bounds.types.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +2 -2
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +3 -3
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +23 -50
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +94 -357
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +12 -98
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/math.js +136 -0
- package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/types.js +1 -1
- package/lib/module/shared/utils/bounds/zoom/types.js.map +1 -1
- package/lib/module/shared/utils/create-store.js +50 -0
- package/lib/module/shared/utils/create-store.js.map +1 -0
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +1 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts +13 -0
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts.map +1 -0
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts +2 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts +2 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
- package/lib/typescript/shared/configs/index.d.ts.map +1 -1
- package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +9 -3
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts +5 -11
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +4 -4
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts +2 -2
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts +8 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +22 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts +4 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +21 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +14 -0
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts +4 -2
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +10 -17
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/gesture.store.d.ts +24 -14
- package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/system.store.d.ts +27 -0
- package/lib/typescript/shared/stores/system.store.d.ts.map +1 -0
- package/lib/typescript/shared/types/animation.types.d.ts +40 -6
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +14 -42
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +2 -2
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +16 -0
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +3 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts +11 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts +2 -3
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +2 -3
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +15 -41
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +44 -0
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +8 -13
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/create-store.d.ts +14 -0
- package/lib/typescript/shared/utils/create-store.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/component-stack/components/component-screen.tsx +1 -1
- package/src/shared/animation/snap-to.ts +10 -4
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +1 -1
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +82 -10
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +2 -5
- package/src/shared/components/create-boundary-component/index.tsx +3 -23
- package/src/shared/components/create-transition-aware-component.tsx +0 -1
- package/src/shared/components/native-screen.tsx +3 -9
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +37 -0
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +42 -43
- package/src/shared/components/screen-container/index.tsx +5 -2
- package/src/shared/components/screen-container/layers/backdrop.tsx +12 -6
- package/src/shared/components/screen-container/layers/content.tsx +3 -0
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +30 -32
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.ts +4 -2
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/index.ts +8 -0
- package/src/shared/components/screen-lifecycle/hooks/use-open-transition.ts +21 -10
- package/src/shared/components/screen-lifecycle/index.tsx +8 -2
- package/src/shared/configs/presets.ts +18 -17
- package/src/shared/constants.ts +19 -3
- package/src/shared/hooks/animation/use-associated-style.ts +12 -62
- package/src/shared/index.ts +4 -3
- package/src/shared/providers/gestures/handlers/use-handlers.ts +13 -10
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +12 -10
- package/src/shared/providers/gestures/helpers/register-direction-claims.ts +1 -1
- package/src/shared/providers/gestures/use-build-gestures.ts +1 -3
- package/src/shared/providers/register-bounds.provider.tsx +5 -11
- package/src/shared/providers/screen/animation/helpers/has-transitions-enabled.ts +14 -0
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +108 -0
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +37 -199
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +77 -0
- package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +61 -0
- package/src/shared/providers/screen/styles.provider.tsx +99 -72
- package/src/shared/providers/stack/direct.provider.tsx +1 -1
- package/src/shared/providers/stack/helpers/use-processed-routes.ts +1 -1
- package/src/shared/stores/animation.store.ts +11 -61
- package/src/shared/stores/gesture.store.ts +25 -45
- package/src/shared/stores/system.store.ts +44 -0
- package/src/shared/types/animation.types.ts +43 -6
- package/src/shared/types/bounds.types.ts +25 -25
- package/src/shared/types/index.ts +2 -0
- package/src/shared/types/screen.types.ts +17 -0
- package/src/shared/utils/animation/animate-to-progress.ts +4 -2
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +3 -3
- package/src/shared/utils/bounds/index.ts +26 -75
- package/src/shared/utils/bounds/zoom/build.ts +174 -497
- package/src/shared/utils/bounds/zoom/config.ts +14 -164
- package/src/shared/utils/bounds/zoom/math.ts +193 -0
- package/src/shared/utils/bounds/zoom/types.ts +15 -17
- package/src/shared/utils/create-store.ts +62 -0
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js +0 -6
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js +0 -54
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/zoom/index.js +0 -20
- package/lib/commonjs/shared/utils/bounds/zoom/index.js.map +0 -1
- package/lib/module/shared/utils/bounds/types/frame-props.js +0 -4
- package/lib/module/shared/utils/bounds/types/frame-props.js.map +0 -1
- package/lib/module/shared/utils/bounds/zoom/accessor.js +0 -49
- package/lib/module/shared/utils/bounds/zoom/accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/zoom/index.js +0 -5
- package/lib/module/shared/utils/bounds/zoom/index.js.map +0 -1
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts +0 -5
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +0 -17
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts +0 -3
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts.map +0 -1
- package/src/shared/utils/bounds/types/frame-props.ts +0 -5
- package/src/shared/utils/bounds/zoom/accessor.ts +0 -69
- package/src/shared/utils/bounds/zoom/index.ts +0 -2
|
@@ -2,158 +2,38 @@ import { useMemo } from "react";
|
|
|
2
2
|
import { useWindowDimensions } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
type DerivedValue,
|
|
5
|
-
type SharedValue,
|
|
6
5
|
useDerivedValue,
|
|
7
6
|
useSharedValue,
|
|
8
7
|
} from "react-native-reanimated";
|
|
9
8
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
createScreenTransitionState,
|
|
13
|
-
DEFAULT_SCREEN_TRANSITION_STATE,
|
|
14
|
-
} from "../../../../constants";
|
|
9
|
+
import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../../../constants";
|
|
15
10
|
import { useStack } from "../../../../hooks/navigation/use-stack";
|
|
16
|
-
import { AnimationStore } from "../../../../stores/animation.store";
|
|
17
|
-
import {
|
|
18
|
-
GestureStore,
|
|
19
|
-
type GestureStoreMap,
|
|
20
|
-
} from "../../../../stores/gesture.store";
|
|
21
11
|
import type {
|
|
22
12
|
ScreenInterpolationProps,
|
|
23
13
|
ScreenStyleInterpolator,
|
|
24
|
-
ScreenTransitionState,
|
|
25
14
|
} from "../../../../types/animation.types";
|
|
26
|
-
import type {
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
import type {
|
|
16
|
+
BoundsAccessor,
|
|
17
|
+
BoundsInterpolationProps,
|
|
18
|
+
} from "../../../../types/bounds.types";
|
|
19
|
+
|
|
29
20
|
import { createBoundsAccessor } from "../../../../utils/bounds";
|
|
30
|
-
import type { BoundsFrameProps } from "../../../../utils/bounds/types/frame-props";
|
|
31
21
|
import { resolveNavigationMaskEnabled } from "../../../../utils/resolve-screen-transition-options";
|
|
32
|
-
import {
|
|
22
|
+
import { useDescriptors } from "../../descriptors";
|
|
33
23
|
import { derivations } from "./derivations";
|
|
34
|
-
import {
|
|
24
|
+
import { hasTransitionsEnabled } from "./has-transitions-enabled";
|
|
25
|
+
import { hydrateTransitionState } from "./hydrate-transition-state";
|
|
26
|
+
import { useBuildTransitionState } from "./use-build-transition-state";
|
|
35
27
|
|
|
36
|
-
type
|
|
37
|
-
progress: SharedValue<number>;
|
|
38
|
-
closing: SharedValue<number>;
|
|
39
|
-
animating: SharedValue<number>;
|
|
40
|
-
entering: SharedValue<number>;
|
|
41
|
-
gesture: GestureStoreMap;
|
|
42
|
-
route: BaseStackRoute;
|
|
43
|
-
meta?: Record<string, unknown>;
|
|
44
|
-
unwrapped: ScreenTransitionState;
|
|
45
|
-
};
|
|
28
|
+
type BaseInterpolatorProps = Omit<ScreenInterpolationProps, "bounds">;
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
screenInterpolatorProps: DerivedValue<
|
|
49
|
-
Omit<ScreenInterpolationProps, "bounds">
|
|
50
|
-
>;
|
|
30
|
+
interface ScreenAnimationPipeline {
|
|
31
|
+
screenInterpolatorProps: DerivedValue<BaseInterpolatorProps>;
|
|
51
32
|
nextInterpolator: ScreenStyleInterpolator | undefined;
|
|
52
33
|
currentInterpolator: ScreenStyleInterpolator | undefined;
|
|
53
34
|
boundsAccessor: BoundsAccessor;
|
|
54
35
|
}
|
|
55
36
|
|
|
56
|
-
/**
|
|
57
|
-
* Computes the animated snap index based on progress and snap points.
|
|
58
|
-
* Returns -1 if no snap points, otherwise interpolates between indices.
|
|
59
|
-
*/
|
|
60
|
-
const computeSnapIndex = (progress: number, snapPoints: number[]): number => {
|
|
61
|
-
"worklet";
|
|
62
|
-
if (snapPoints.length === 0) return -1;
|
|
63
|
-
if (progress <= snapPoints[0]) return 0;
|
|
64
|
-
if (progress >= snapPoints[snapPoints.length - 1])
|
|
65
|
-
return snapPoints.length - 1;
|
|
66
|
-
|
|
67
|
-
for (let i = 0; i < snapPoints.length - 1; i++) {
|
|
68
|
-
if (progress <= snapPoints[i + 1]) {
|
|
69
|
-
const t =
|
|
70
|
-
(progress - snapPoints[i]) / (snapPoints[i + 1] - snapPoints[i]);
|
|
71
|
-
return i + t;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return snapPoints.length - 1;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const unwrapInto = (s: BuiltState): ScreenTransitionState => {
|
|
78
|
-
"worklet";
|
|
79
|
-
const out = s.unwrapped;
|
|
80
|
-
out.progress = s.progress.value;
|
|
81
|
-
out.closing = s.closing.value;
|
|
82
|
-
out.entering = s.entering.value;
|
|
83
|
-
out.animating = s.animating.value;
|
|
84
|
-
out.gesture.x = s.gesture.x.value;
|
|
85
|
-
out.gesture.y = s.gesture.y.value;
|
|
86
|
-
out.gesture.normX = s.gesture.normX.value;
|
|
87
|
-
out.gesture.normY = s.gesture.normY.value;
|
|
88
|
-
out.gesture.dismissing = s.gesture.dismissing.value;
|
|
89
|
-
out.gesture.dragging = s.gesture.dragging.value;
|
|
90
|
-
out.gesture.direction = s.gesture.direction.value;
|
|
91
|
-
|
|
92
|
-
// Deprecated aliases (kept for backwards compatibility)
|
|
93
|
-
out.gesture.normalizedX = out.gesture.normX;
|
|
94
|
-
out.gesture.normalizedY = out.gesture.normY;
|
|
95
|
-
out.gesture.isDismissing = out.gesture.dismissing;
|
|
96
|
-
out.gesture.isDragging = out.gesture.dragging;
|
|
97
|
-
|
|
98
|
-
out.settled =
|
|
99
|
-
out.gesture.dragging ||
|
|
100
|
-
out.animating ||
|
|
101
|
-
out.gesture.dismissing ||
|
|
102
|
-
out.closing
|
|
103
|
-
? 0
|
|
104
|
-
: 1;
|
|
105
|
-
out.meta = s.meta;
|
|
106
|
-
|
|
107
|
-
return out;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const useBuildScreenTransitionState = (
|
|
111
|
-
descriptor: BaseDescriptor | undefined,
|
|
112
|
-
slot: "current" | "next" | "previous",
|
|
113
|
-
): BuiltState | undefined => {
|
|
114
|
-
const key = descriptor?.route?.key;
|
|
115
|
-
const meta = descriptor?.options?.meta;
|
|
116
|
-
const route = descriptor?.route;
|
|
117
|
-
const gestureEnabled = descriptor?.options?.gestureEnabled;
|
|
118
|
-
const snapPoints = descriptor?.options?.snapPoints;
|
|
119
|
-
|
|
120
|
-
const shouldUseNeutralNextGestures =
|
|
121
|
-
slot === "next" &&
|
|
122
|
-
gestureEnabled === false &&
|
|
123
|
-
(!snapPoints || snapPoints.length === 0);
|
|
124
|
-
|
|
125
|
-
return useMemo(() => {
|
|
126
|
-
if (!key || !route) return undefined;
|
|
127
|
-
|
|
128
|
-
const plainRoute = toPlainRoute(route);
|
|
129
|
-
const plainMeta = meta
|
|
130
|
-
? (toPlainValue(meta) as Record<string, unknown>)
|
|
131
|
-
: undefined;
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
progress: AnimationStore.getRouteAnimation(key, "progress"),
|
|
135
|
-
closing: AnimationStore.getRouteAnimation(key, "closing"),
|
|
136
|
-
entering: AnimationStore.getRouteAnimation(key, "entering"),
|
|
137
|
-
animating: AnimationStore.getRouteAnimation(key, "animating"),
|
|
138
|
-
gesture: shouldUseNeutralNextGestures
|
|
139
|
-
? (GestureStore.peekRouteGestures(key) ??
|
|
140
|
-
GestureStore.getNeutralGestures())
|
|
141
|
-
: GestureStore.getRouteGestures(key),
|
|
142
|
-
route: plainRoute,
|
|
143
|
-
meta: plainMeta,
|
|
144
|
-
unwrapped: createScreenTransitionState(plainRoute, plainMeta),
|
|
145
|
-
};
|
|
146
|
-
}, [key, meta, route, shouldUseNeutralNextGestures]);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const hasTransitionsEnabled = (
|
|
150
|
-
options: ScreenTransitionConfig | undefined,
|
|
151
|
-
alwaysOn: boolean,
|
|
152
|
-
) => {
|
|
153
|
-
if (alwaysOn) return true;
|
|
154
|
-
return !!(options as NativeStackScreenTransitionConfig)?.enableTransitions;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
37
|
export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
158
38
|
const { flags, stackProgress: rootStackProgress, routeKeys } = useStack();
|
|
159
39
|
const dimensions = useWindowDimensions();
|
|
@@ -161,55 +41,28 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
161
41
|
const transitionsAlwaysOn = flags.TRANSITIONS_ALWAYS_ON;
|
|
162
42
|
|
|
163
43
|
const {
|
|
164
|
-
current:
|
|
44
|
+
current: currDescriptor,
|
|
165
45
|
next: nextDescriptor,
|
|
166
|
-
previous:
|
|
46
|
+
previous: prevDescriptor,
|
|
167
47
|
} = useDescriptors();
|
|
168
48
|
|
|
169
|
-
const currentAnimation =
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
);
|
|
173
|
-
const nextAnimation = useBuildScreenTransitionState(nextDescriptor, "next");
|
|
174
|
-
const prevAnimation = useBuildScreenTransitionState(
|
|
175
|
-
previousDescriptor,
|
|
176
|
-
"previous",
|
|
177
|
-
);
|
|
49
|
+
const currentAnimation = useBuildTransitionState(currDescriptor, "current");
|
|
50
|
+
const nextAnimation = useBuildTransitionState(nextDescriptor, "next");
|
|
51
|
+
const prevAnimation = useBuildTransitionState(prevDescriptor, "previous");
|
|
178
52
|
|
|
179
|
-
const currentRouteKey =
|
|
53
|
+
const currentRouteKey = currDescriptor?.route?.key;
|
|
180
54
|
const currentIndex = routeKeys.indexOf(currentRouteKey);
|
|
181
55
|
|
|
182
|
-
const sortedNumericSnapPoints = useMemo(() => {
|
|
183
|
-
const points = currentDescriptor?.options?.snapPoints;
|
|
184
|
-
if (!points) return [];
|
|
185
|
-
return points
|
|
186
|
-
.filter((p): p is number => typeof p === "number")
|
|
187
|
-
.sort((a, b) => a - b);
|
|
188
|
-
}, [currentDescriptor?.options?.snapPoints]);
|
|
189
|
-
|
|
190
|
-
const hasAutoSnapPoint = useMemo(
|
|
191
|
-
() => currentDescriptor?.options?.snapPoints?.includes("auto") ?? false,
|
|
192
|
-
[currentDescriptor?.options?.snapPoints],
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
196
|
-
currentRouteKey ?? "_",
|
|
197
|
-
"autoSnapPoint",
|
|
198
|
-
);
|
|
199
|
-
const contentLayoutValue = AnimationStore.getAnimation(
|
|
200
|
-
currentRouteKey ?? "_",
|
|
201
|
-
"contentLayout",
|
|
202
|
-
);
|
|
203
|
-
|
|
204
56
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
205
57
|
const nextHasTransitions =
|
|
206
58
|
!!nextRouteKey &&
|
|
207
59
|
hasTransitionsEnabled(nextDescriptor?.options, transitionsAlwaysOn);
|
|
60
|
+
|
|
208
61
|
const currentNavigationMaskEnabled = resolveNavigationMaskEnabled(
|
|
209
|
-
|
|
62
|
+
currDescriptor?.options ?? {},
|
|
210
63
|
);
|
|
211
64
|
|
|
212
|
-
const
|
|
65
|
+
const boundsFrameProps = useSharedValue<BoundsInterpolationProps>({
|
|
213
66
|
layouts: { screen: dimensions },
|
|
214
67
|
insets,
|
|
215
68
|
previous: undefined,
|
|
@@ -218,33 +71,33 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
218
71
|
progress: 0,
|
|
219
72
|
stackProgress: 0,
|
|
220
73
|
snapIndex: -1,
|
|
221
|
-
navigationMaskEnabled: false,
|
|
222
74
|
focused: true,
|
|
223
75
|
active: DEFAULT_SCREEN_TRANSITION_STATE,
|
|
76
|
+
navigationMaskEnabled: currentNavigationMaskEnabled,
|
|
224
77
|
inactive: undefined,
|
|
225
78
|
});
|
|
226
79
|
|
|
227
80
|
const boundsAccessor = useMemo(() => {
|
|
228
81
|
return createBoundsAccessor(() => {
|
|
229
82
|
"worklet";
|
|
230
|
-
return
|
|
83
|
+
return boundsFrameProps.value;
|
|
231
84
|
});
|
|
232
|
-
}, [
|
|
85
|
+
}, [boundsFrameProps]);
|
|
233
86
|
|
|
234
|
-
const screenInterpolatorProps = useDerivedValue<
|
|
235
|
-
Omit<ScreenInterpolationProps, "bounds">
|
|
236
|
-
>(() => {
|
|
87
|
+
const screenInterpolatorProps = useDerivedValue<BaseInterpolatorProps>(() => {
|
|
237
88
|
"worklet";
|
|
238
89
|
|
|
239
|
-
const previous = prevAnimation
|
|
90
|
+
const previous = prevAnimation
|
|
91
|
+
? hydrateTransitionState(prevAnimation, dimensions)
|
|
92
|
+
: undefined;
|
|
240
93
|
|
|
241
94
|
const next =
|
|
242
95
|
nextAnimation && nextHasTransitions
|
|
243
|
-
?
|
|
96
|
+
? hydrateTransitionState(nextAnimation, dimensions)
|
|
244
97
|
: undefined;
|
|
245
98
|
|
|
246
99
|
const current = currentAnimation
|
|
247
|
-
?
|
|
100
|
+
? hydrateTransitionState(currentAnimation, dimensions)
|
|
248
101
|
: DEFAULT_SCREEN_TRANSITION_STATE;
|
|
249
102
|
|
|
250
103
|
const { progress, ...helpers } = derivations({
|
|
@@ -259,43 +112,28 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
259
112
|
const stackProgress =
|
|
260
113
|
currentIndex >= 0 ? rootStackProgress.value - currentIndex : progress;
|
|
261
114
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
hasAutoSnapPoint && autoSnapPointValue.value > 0
|
|
265
|
-
? autoSnapPointValue.value
|
|
266
|
-
: null;
|
|
267
|
-
const resolvedSnapPoints =
|
|
268
|
-
resolvedAutoSnap !== null
|
|
269
|
-
? [...sortedNumericSnapPoints, resolvedAutoSnap].sort((a, b) => a - b)
|
|
270
|
-
: sortedNumericSnapPoints;
|
|
271
|
-
|
|
272
|
-
const snapIndex = computeSnapIndex(current.progress, resolvedSnapPoints);
|
|
273
|
-
|
|
274
|
-
const nextProps: Omit<ScreenInterpolationProps, "bounds"> = {
|
|
275
|
-
layouts: {
|
|
276
|
-
screen: dimensions,
|
|
277
|
-
content: contentLayoutValue.value ?? undefined,
|
|
278
|
-
},
|
|
115
|
+
const nextProps: BaseInterpolatorProps = {
|
|
116
|
+
layouts: current.layouts,
|
|
279
117
|
insets,
|
|
280
118
|
previous,
|
|
281
119
|
current,
|
|
282
120
|
next,
|
|
283
121
|
progress,
|
|
284
122
|
stackProgress,
|
|
285
|
-
snapIndex,
|
|
123
|
+
snapIndex: current.snapIndex,
|
|
286
124
|
...helpers,
|
|
287
125
|
};
|
|
288
126
|
|
|
289
|
-
|
|
127
|
+
boundsFrameProps.value = {
|
|
290
128
|
...nextProps,
|
|
291
129
|
navigationMaskEnabled: currentNavigationMaskEnabled,
|
|
292
130
|
};
|
|
131
|
+
|
|
293
132
|
return nextProps;
|
|
294
133
|
});
|
|
295
134
|
|
|
296
135
|
const nextInterpolator = nextDescriptor?.options.screenStyleInterpolator;
|
|
297
|
-
const currentInterpolator =
|
|
298
|
-
currentDescriptor?.options.screenStyleInterpolator;
|
|
136
|
+
const currentInterpolator = currDescriptor?.options.screenStyleInterpolator;
|
|
299
137
|
|
|
300
138
|
return {
|
|
301
139
|
screenInterpolatorProps,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
+
import { createScreenTransitionState } from "../../../../constants";
|
|
4
|
+
import { AnimationStore } from "../../../../stores/animation.store";
|
|
5
|
+
import {
|
|
6
|
+
GestureStore,
|
|
7
|
+
type GestureStoreMap,
|
|
8
|
+
} from "../../../../stores/gesture.store";
|
|
9
|
+
import { SystemStore } from "../../../../stores/system.store";
|
|
10
|
+
import type {
|
|
11
|
+
BaseStackRoute,
|
|
12
|
+
Layout,
|
|
13
|
+
ScreenTransitionState,
|
|
14
|
+
} from "../../../../types";
|
|
15
|
+
import type { BaseDescriptor } from "../../descriptors";
|
|
16
|
+
import { toPlainRoute, toPlainValue } from "./worklet";
|
|
17
|
+
|
|
18
|
+
type BuiltState = {
|
|
19
|
+
progress: SharedValue<number>;
|
|
20
|
+
closing: SharedValue<number>;
|
|
21
|
+
animating: SharedValue<number>;
|
|
22
|
+
entering: SharedValue<number>;
|
|
23
|
+
gesture: GestureStoreMap;
|
|
24
|
+
route: BaseStackRoute;
|
|
25
|
+
meta?: Record<string, unknown>;
|
|
26
|
+
resolvedAutoSnapPoint: SharedValue<number>;
|
|
27
|
+
measuredContentLayout: SharedValue<Layout | null>;
|
|
28
|
+
hasAutoSnapPoint: boolean;
|
|
29
|
+
sortedNumericSnapPoints: number[];
|
|
30
|
+
unwrapped: ScreenTransitionState;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const useBuildTransitionState = (
|
|
34
|
+
descriptor: BaseDescriptor | undefined,
|
|
35
|
+
slot: "current" | "next" | "previous",
|
|
36
|
+
): BuiltState | undefined => {
|
|
37
|
+
const key = descriptor?.route?.key;
|
|
38
|
+
const meta = descriptor?.options?.meta;
|
|
39
|
+
const route = descriptor?.route;
|
|
40
|
+
const gestureEnabled = descriptor?.options?.gestureEnabled;
|
|
41
|
+
const snapPoints = descriptor?.options?.snapPoints;
|
|
42
|
+
|
|
43
|
+
const shouldUseNeutralNextGestures =
|
|
44
|
+
slot === "next" &&
|
|
45
|
+
gestureEnabled === false &&
|
|
46
|
+
(!snapPoints || snapPoints.length === 0);
|
|
47
|
+
|
|
48
|
+
return useMemo(() => {
|
|
49
|
+
if (!key || !route) return undefined;
|
|
50
|
+
|
|
51
|
+
const plainRoute = toPlainRoute(route);
|
|
52
|
+
const plainMeta = meta
|
|
53
|
+
? (toPlainValue(meta) as Record<string, unknown>)
|
|
54
|
+
: undefined;
|
|
55
|
+
|
|
56
|
+
const sortedNumericSnapPoints = (snapPoints ?? [])
|
|
57
|
+
.filter((p): p is number => typeof p === "number")
|
|
58
|
+
.sort((a, b) => a - b);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
progress: AnimationStore.getValue(key, "progress"),
|
|
62
|
+
closing: AnimationStore.getValue(key, "closing"),
|
|
63
|
+
entering: AnimationStore.getValue(key, "entering"),
|
|
64
|
+
animating: AnimationStore.getValue(key, "animating"),
|
|
65
|
+
resolvedAutoSnapPoint: SystemStore.getValue(key, "resolvedAutoSnapPoint"),
|
|
66
|
+
measuredContentLayout: SystemStore.getValue(key, "measuredContentLayout"),
|
|
67
|
+
hasAutoSnapPoint: snapPoints?.includes("auto") ?? false,
|
|
68
|
+
sortedNumericSnapPoints,
|
|
69
|
+
gesture: shouldUseNeutralNextGestures
|
|
70
|
+
? (GestureStore.peekBag(key) ?? GestureStore.getCachedBag())
|
|
71
|
+
: GestureStore.getBag(key),
|
|
72
|
+
route: plainRoute,
|
|
73
|
+
meta: plainMeta,
|
|
74
|
+
unwrapped: createScreenTransitionState(plainRoute, plainMeta),
|
|
75
|
+
};
|
|
76
|
+
}, [key, meta, route, shouldUseNeutralNextGestures, snapPoints]);
|
|
77
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DeferredScreenStyleSignal,
|
|
3
|
+
NormalizedTransitionInterpolatedStyle,
|
|
4
|
+
} from "../../../types/animation.types";
|
|
5
|
+
import { normalizeInterpolatedStyle } from "../../../utils/normalize-interpolated-style";
|
|
6
|
+
|
|
7
|
+
export type ScreenStyleResolutionMode = "pass-through" | "deferred" | "live";
|
|
8
|
+
|
|
9
|
+
export type ResolvedInterpolatedStyleOutput = {
|
|
10
|
+
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
11
|
+
resolutionMode: ScreenStyleResolutionMode;
|
|
12
|
+
wasLegacy: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const EMPTY_STYLES = {} as NormalizedTransitionInterpolatedStyle;
|
|
16
|
+
|
|
17
|
+
export const PASS_THROUGH_STYLE_OUTPUT: ResolvedInterpolatedStyleOutput = {
|
|
18
|
+
stylesMap: EMPTY_STYLES,
|
|
19
|
+
resolutionMode: "pass-through",
|
|
20
|
+
wasLegacy: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const resolveEffectiveResolutionMode = ({
|
|
24
|
+
resolutionMode,
|
|
25
|
+
isSettled,
|
|
26
|
+
}: {
|
|
27
|
+
resolutionMode: ScreenStyleResolutionMode;
|
|
28
|
+
isSettled: boolean;
|
|
29
|
+
}): ScreenStyleResolutionMode => {
|
|
30
|
+
"worklet";
|
|
31
|
+
if (resolutionMode === "deferred" && isSettled) {
|
|
32
|
+
return "pass-through";
|
|
33
|
+
}
|
|
34
|
+
return resolutionMode;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const resolveInterpolatedStyleOutput = (
|
|
38
|
+
raw: Record<string, any> | DeferredScreenStyleSignal | null | undefined,
|
|
39
|
+
): ResolvedInterpolatedStyleOutput => {
|
|
40
|
+
"worklet";
|
|
41
|
+
|
|
42
|
+
if (raw === "defer") {
|
|
43
|
+
return {
|
|
44
|
+
stylesMap: EMPTY_STYLES,
|
|
45
|
+
resolutionMode: "deferred",
|
|
46
|
+
wasLegacy: false,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (raw == null) {
|
|
51
|
+
return PASS_THROUGH_STYLE_OUTPUT;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { result, wasLegacy } = normalizeInterpolatedStyle(raw ?? EMPTY_STYLES);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
stylesMap: result,
|
|
58
|
+
resolutionMode: "live",
|
|
59
|
+
wasLegacy,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -8,8 +8,13 @@ import { NO_STYLES } from "../../constants";
|
|
|
8
8
|
import type { NormalizedTransitionInterpolatedStyle } from "../../types/animation.types";
|
|
9
9
|
import createProvider from "../../utils/create-provider";
|
|
10
10
|
import { logger } from "../../utils/logger";
|
|
11
|
-
import { normalizeInterpolatedStyle } from "../../utils/normalize-interpolated-style";
|
|
12
11
|
import { useScreenAnimationContext } from "./animation";
|
|
12
|
+
import {
|
|
13
|
+
PASS_THROUGH_STYLE_OUTPUT,
|
|
14
|
+
resolveEffectiveResolutionMode,
|
|
15
|
+
resolveInterpolatedStyleOutput,
|
|
16
|
+
type ScreenStyleResolutionMode,
|
|
17
|
+
} from "./helpers/resolve-interpolated-style-output";
|
|
13
18
|
|
|
14
19
|
type Props = {
|
|
15
20
|
children: ReactNode;
|
|
@@ -18,9 +23,10 @@ type Props = {
|
|
|
18
23
|
type ScreenStylesContextValue = {
|
|
19
24
|
stylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
20
25
|
ancestorStylesMaps: SharedValue<NormalizedTransitionInterpolatedStyle>[];
|
|
26
|
+
resolutionMode: SharedValue<ScreenStyleResolutionMode>;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
|
-
const {
|
|
29
|
+
export const {
|
|
24
30
|
ScreenStylesProvider,
|
|
25
31
|
ScreenStylesContext,
|
|
26
32
|
useScreenStylesContext: useScreenStyles,
|
|
@@ -44,80 +50,102 @@ const {
|
|
|
44
50
|
const isGesturingDuringCloseAnimation = useSharedValue(false);
|
|
45
51
|
const hasWarnedLegacy = useSharedValue(false);
|
|
46
52
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
53
|
+
const styleResolution = useDerivedValue<{
|
|
54
|
+
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
55
|
+
resolutionMode: ScreenStyleResolutionMode;
|
|
56
|
+
}>(() => {
|
|
57
|
+
"worklet";
|
|
58
|
+
const props = screenInterpolatorProps.value;
|
|
59
|
+
const { current, next, progress } = props;
|
|
60
|
+
const isDragging = current.gesture.dragging;
|
|
61
|
+
const isNextClosing = !!next?.closing;
|
|
62
|
+
|
|
63
|
+
if (isDragging && isNextClosing) {
|
|
64
|
+
isGesturingDuringCloseAnimation.value = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!isDragging && !isNextClosing) {
|
|
68
|
+
isGesturingDuringCloseAnimation.value = false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const isInGestureMode =
|
|
72
|
+
isDragging || isGesturingDuringCloseAnimation.value;
|
|
73
|
+
|
|
74
|
+
// Select interpolator
|
|
75
|
+
// - If in gesture mode, use current screen's interpolator since we're driving
|
|
76
|
+
// the animation from this screen (dragging back to dismiss next).
|
|
77
|
+
const interpolator = isInGestureMode
|
|
78
|
+
? currentInterpolator
|
|
79
|
+
: (nextInterpolator ?? currentInterpolator);
|
|
80
|
+
|
|
81
|
+
if (!interpolator) {
|
|
82
|
+
return PASS_THROUGH_STYLE_OUTPUT;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Build effective props with corrected progress
|
|
86
|
+
// - Gesture mode: use current.progress only (avoids jumps during drag)
|
|
87
|
+
// - Normal: use derived progress as-is
|
|
88
|
+
|
|
89
|
+
let effectiveProgress = progress;
|
|
90
|
+
let effectiveNext = next;
|
|
91
|
+
|
|
92
|
+
if (isInGestureMode) {
|
|
93
|
+
effectiveProgress = current.progress;
|
|
94
|
+
effectiveNext = undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const raw = interpolator({
|
|
99
|
+
...props,
|
|
100
|
+
progress: effectiveProgress,
|
|
101
|
+
next: effectiveNext,
|
|
102
|
+
bounds: boundsAccessor,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const { stylesMap, resolutionMode, wasLegacy } =
|
|
106
|
+
resolveInterpolatedStyleOutput(raw);
|
|
107
|
+
|
|
108
|
+
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
109
|
+
hasWarnedLegacy.value = true;
|
|
110
|
+
logger.warn(
|
|
111
|
+
"Flat interpolator return shape (contentStyle/backdropStyle) is deprecated. " +
|
|
112
|
+
"Use the nested format instead: { content: { style }, backdrop: { style } }.",
|
|
113
|
+
);
|
|
86
114
|
}
|
|
87
115
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
116
|
+
return {
|
|
117
|
+
stylesMap,
|
|
118
|
+
resolutionMode: resolveEffectiveResolutionMode({
|
|
119
|
+
resolutionMode,
|
|
120
|
+
isSettled: current.settled === 1,
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
123
|
+
} catch (err) {
|
|
124
|
+
if (__DEV__) {
|
|
125
|
+
console.warn(
|
|
126
|
+
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
127
|
+
err,
|
|
98
128
|
);
|
|
99
|
-
|
|
100
|
-
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
101
|
-
hasWarnedLegacy.value = true;
|
|
102
|
-
logger.warn(
|
|
103
|
-
"Flat interpolator return shape (contentStyle/backdropStyle) is deprecated. " +
|
|
104
|
-
"Use the nested format instead: { content: { style }, backdrop: { style } }.",
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return result;
|
|
109
|
-
} catch (err) {
|
|
110
|
-
if (__DEV__) {
|
|
111
|
-
console.warn(
|
|
112
|
-
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
113
|
-
err,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
return NO_STYLES as NormalizedTransitionInterpolatedStyle;
|
|
117
129
|
}
|
|
130
|
+
return {
|
|
131
|
+
stylesMap: NO_STYLES as NormalizedTransitionInterpolatedStyle,
|
|
132
|
+
resolutionMode: "live" as const,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const stylesMap = useDerivedValue<NormalizedTransitionInterpolatedStyle>(
|
|
138
|
+
() => {
|
|
139
|
+
"worklet";
|
|
140
|
+
return styleResolution.value.stylesMap;
|
|
118
141
|
},
|
|
119
142
|
);
|
|
120
143
|
|
|
144
|
+
const resolutionMode = useDerivedValue<ScreenStyleResolutionMode>(() => {
|
|
145
|
+
"worklet";
|
|
146
|
+
return styleResolution.value.resolutionMode;
|
|
147
|
+
});
|
|
148
|
+
|
|
121
149
|
const value = useMemo<ScreenStylesContextValue>(() => {
|
|
122
150
|
// Build ancestor chain: [parent, grandparent, great-grandparent, ...]
|
|
123
151
|
const ancestorStylesMaps = parentCtx
|
|
@@ -127,11 +155,10 @@ const {
|
|
|
127
155
|
return {
|
|
128
156
|
stylesMap,
|
|
129
157
|
ancestorStylesMaps,
|
|
158
|
+
resolutionMode,
|
|
130
159
|
};
|
|
131
|
-
}, [stylesMap, parentCtx]);
|
|
160
|
+
}, [resolutionMode, stylesMap, parentCtx]);
|
|
132
161
|
|
|
133
162
|
return { value, children };
|
|
134
163
|
},
|
|
135
164
|
);
|
|
136
|
-
|
|
137
|
-
export { ScreenStylesProvider, useScreenStyles };
|
|
@@ -60,7 +60,7 @@ function useDirectStackValue(
|
|
|
60
60
|
|
|
61
61
|
scenes.push({ route, descriptor, isPreloaded });
|
|
62
62
|
routeKeys.push(route.key);
|
|
63
|
-
animationMaps.push(AnimationStore.
|
|
63
|
+
animationMaps.push(AnimationStore.getBag(route.key));
|
|
64
64
|
|
|
65
65
|
if (!shouldShowFloatOverlay && descriptor) {
|
|
66
66
|
const options = descriptor.options;
|