react-native-screen-transitions 3.4.0-alpha.3 → 3.4.0-alpha.5
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 +6 -6
- package/lib/commonjs/shared/components/create-boundary-component/index.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 +1 -1
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
- 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/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 +12 -28
- 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 -4
- 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 +3 -4
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/constants.js +16 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/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-physics.js +3 -2
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-physics.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-reset.js +7 -5
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-reset.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/gesture-targets.js +9 -6
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-targets.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 +17 -3
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js +4 -1
- 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.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 +108 -362
- 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 +6 -6
- package/lib/module/shared/components/create-boundary-component/index.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 +2 -2
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
- 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/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 +13 -29
- 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 +19 -6
- 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 +3 -4
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/constants.js +16 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/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-physics.js +3 -2
- package/lib/module/shared/providers/gestures/helpers/gesture-physics.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-reset.js +7 -5
- package/lib/module/shared/providers/gestures/helpers/gesture-reset.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/gesture-targets.js +9 -6
- package/lib/module/shared/providers/gestures/helpers/gesture-targets.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 +15 -2
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
- package/lib/module/shared/providers/screen/styles.provider.js +5 -2
- 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.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 +101 -355
- 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/native-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.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.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/presets.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +3 -3
- 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-physics.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/helpers/gesture-reset.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/helpers/gesture-targets.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 +6 -2
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +1 -1
- 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 +38 -9
- 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 +11 -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.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 +6 -12
- package/src/shared/components/native-screen.tsx +3 -9
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +2 -2
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +42 -43
- package/src/shared/components/screen-container/layers/backdrop.tsx +12 -6
- package/src/shared/components/screen-container/layers/content.tsx +17 -49
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +26 -5
- 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 +8 -7
- package/src/shared/constants.ts +14 -0
- package/src/shared/hooks/animation/use-associated-style.ts +2 -8
- package/src/shared/index.ts +2 -0
- package/src/shared/providers/gestures/handlers/use-handlers.ts +13 -10
- package/src/shared/providers/gestures/helpers/gesture-physics.ts +4 -2
- package/src/shared/providers/gestures/helpers/gesture-reset.ts +9 -5
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +12 -10
- package/src/shared/providers/gestures/helpers/gesture-targets.ts +14 -6
- 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 +24 -4
- package/src/shared/providers/screen/styles.provider.tsx +5 -1
- 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 +41 -9
- package/src/shared/types/bounds.types.ts +25 -25
- package/src/shared/types/index.ts +2 -0
- package/src/shared/types/screen.types.ts +12 -0
- package/src/shared/utils/animation/animate-to-progress.ts +4 -2
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +0 -1
- package/src/shared/utils/bounds/index.ts +26 -75
- package/src/shared/utils/bounds/zoom/build.ts +179 -502
- 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
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import useStableCallbackValue from "../../../hooks/use-stable-callback-value";
|
|
26
26
|
import { AnimationStore } from "../../../stores/animation.store";
|
|
27
27
|
import { GestureStore } from "../../../stores/gesture.store";
|
|
28
|
+
import { SystemStore } from "../../../stores/system.store";
|
|
28
29
|
import { GestureOffsetState } from "../../../types/gesture.types";
|
|
29
30
|
import type {
|
|
30
31
|
ClaimedDirections,
|
|
@@ -154,8 +155,9 @@ export const useHandlers = ({
|
|
|
154
155
|
|
|
155
156
|
const dimensions = useWindowDimensions();
|
|
156
157
|
const routeKey = current.route.key;
|
|
157
|
-
const animations = AnimationStore.
|
|
158
|
-
const gestureAnimationValues = GestureStore.
|
|
158
|
+
const animations = AnimationStore.getBag(routeKey);
|
|
159
|
+
const gestureAnimationValues = GestureStore.getBag(routeKey);
|
|
160
|
+
const targetProgressValue = SystemStore.getValue(routeKey, "targetProgress");
|
|
159
161
|
const {
|
|
160
162
|
hasSnapPoints,
|
|
161
163
|
hasAutoSnapPoint,
|
|
@@ -165,9 +167,9 @@ export const useHandlers = ({
|
|
|
165
167
|
} = effectiveSnapPoints;
|
|
166
168
|
|
|
167
169
|
// Read the measured "auto" snap point reactively inside worklets.
|
|
168
|
-
const
|
|
170
|
+
const resolvedAutoSnapPointValue = SystemStore.getValue(
|
|
169
171
|
routeKey,
|
|
170
|
-
"
|
|
172
|
+
"resolvedAutoSnapPoint",
|
|
171
173
|
);
|
|
172
174
|
|
|
173
175
|
const directions = useMemo(() => {
|
|
@@ -307,7 +309,7 @@ export const useHandlers = ({
|
|
|
307
309
|
const { resolvedMaxSnapPoint } = resolveRuntimeSnapPoints({
|
|
308
310
|
snapPoints,
|
|
309
311
|
hasAutoSnapPoint,
|
|
310
|
-
|
|
312
|
+
resolvedAutoSnapPoint: resolvedAutoSnapPointValue.value,
|
|
311
313
|
minSnapPoint,
|
|
312
314
|
maxSnapPoint,
|
|
313
315
|
canDismiss,
|
|
@@ -318,7 +320,7 @@ export const useHandlers = ({
|
|
|
318
320
|
|
|
319
321
|
const canExpandMore =
|
|
320
322
|
animations.progress.value < effectiveMaxSnapPoint - EPSILON &&
|
|
321
|
-
|
|
323
|
+
targetProgressValue.value < effectiveMaxSnapPoint - EPSILON;
|
|
322
324
|
|
|
323
325
|
if (!canExpandMore) {
|
|
324
326
|
manager.fail();
|
|
@@ -339,7 +341,7 @@ export const useHandlers = ({
|
|
|
339
341
|
resolveRuntimeSnapPoints({
|
|
340
342
|
snapPoints,
|
|
341
343
|
hasAutoSnapPoint,
|
|
342
|
-
|
|
344
|
+
resolvedAutoSnapPoint: resolvedAutoSnapPointValue.value,
|
|
343
345
|
minSnapPoint,
|
|
344
346
|
maxSnapPoint,
|
|
345
347
|
canDismiss,
|
|
@@ -357,7 +359,6 @@ export const useHandlers = ({
|
|
|
357
359
|
gestureAnimationValues.dragging.value = TRUE;
|
|
358
360
|
gestureAnimationValues.dismissing.value = FALSE;
|
|
359
361
|
gestureStartProgress.value = animations.progress.value;
|
|
360
|
-
animations.animating.value = TRUE;
|
|
361
362
|
});
|
|
362
363
|
|
|
363
364
|
const onUpdate = useStableCallbackValue(
|
|
@@ -392,7 +393,7 @@ export const useHandlers = ({
|
|
|
392
393
|
resolveRuntimeSnapPoints({
|
|
393
394
|
snapPoints,
|
|
394
395
|
hasAutoSnapPoint,
|
|
395
|
-
|
|
396
|
+
resolvedAutoSnapPoint: resolvedAutoSnapPointValue.value,
|
|
396
397
|
minSnapPoint,
|
|
397
398
|
maxSnapPoint,
|
|
398
399
|
canDismiss,
|
|
@@ -468,7 +469,7 @@ export const useHandlers = ({
|
|
|
468
469
|
const { resolvedSnapPoints } = resolveRuntimeSnapPoints({
|
|
469
470
|
snapPoints,
|
|
470
471
|
hasAutoSnapPoint,
|
|
471
|
-
|
|
472
|
+
resolvedAutoSnapPoint: resolvedAutoSnapPointValue.value,
|
|
472
473
|
minSnapPoint,
|
|
473
474
|
maxSnapPoint,
|
|
474
475
|
canDismiss,
|
|
@@ -535,6 +536,7 @@ export const useHandlers = ({
|
|
|
535
536
|
onAnimationFinish: shouldDismiss ? handleDismiss : undefined,
|
|
536
537
|
spec: effectiveSpec,
|
|
537
538
|
animations,
|
|
539
|
+
targetProgress: targetProgressValue,
|
|
538
540
|
initialVelocity,
|
|
539
541
|
});
|
|
540
542
|
} else {
|
|
@@ -576,6 +578,7 @@ export const useHandlers = ({
|
|
|
576
578
|
onAnimationFinish: shouldDismiss ? handleDismiss : undefined,
|
|
577
579
|
spec: transitionSpec,
|
|
578
580
|
animations,
|
|
581
|
+
targetProgress: targetProgressValue,
|
|
579
582
|
initialVelocity: scaledInitialVelocity,
|
|
580
583
|
});
|
|
581
584
|
}
|
|
@@ -31,10 +31,12 @@ type GestureAxisCandidate = {
|
|
|
31
31
|
export const normalizeVelocity = (
|
|
32
32
|
velocityPixelsPerSecond: number,
|
|
33
33
|
screenSize: number,
|
|
34
|
-
maxMagnitude
|
|
34
|
+
maxMagnitude?: number,
|
|
35
35
|
) => {
|
|
36
36
|
"worklet";
|
|
37
|
-
const
|
|
37
|
+
const resolvedMaxMagnitude =
|
|
38
|
+
maxMagnitude ?? DEFAULT_GESTURE_RELEASE_VELOCITY_MAX;
|
|
39
|
+
const max = Math.max(0, Math.abs(resolvedMaxMagnitude));
|
|
38
40
|
return clamp(velocityPixelsPerSecond / Math.max(1, screenSize), -max, max);
|
|
39
41
|
};
|
|
40
42
|
|
|
@@ -32,14 +32,18 @@ export const resetGestureValues = ({
|
|
|
32
32
|
shouldDismiss,
|
|
33
33
|
event,
|
|
34
34
|
dimensions,
|
|
35
|
-
gestureReleaseVelocityScale
|
|
36
|
-
gestureReleaseVelocityMax
|
|
35
|
+
gestureReleaseVelocityScale,
|
|
36
|
+
gestureReleaseVelocityMax,
|
|
37
37
|
}: ResetGestureValuesProps) => {
|
|
38
38
|
"worklet";
|
|
39
|
+
const resolvedGestureReleaseVelocityScale =
|
|
40
|
+
gestureReleaseVelocityScale ?? DEFAULT_GESTURE_RELEASE_VELOCITY_SCALE;
|
|
41
|
+
const resolvedGestureReleaseVelocityMax =
|
|
42
|
+
gestureReleaseVelocityMax ?? DEFAULT_GESTURE_RELEASE_VELOCITY_MAX;
|
|
39
43
|
|
|
40
44
|
const effectiveReleaseVelocityMax = Math.max(
|
|
41
45
|
0,
|
|
42
|
-
Math.abs(
|
|
46
|
+
Math.abs(resolvedGestureReleaseVelocityMax),
|
|
43
47
|
);
|
|
44
48
|
|
|
45
49
|
const vxNorm = normalizeVelocity(
|
|
@@ -67,11 +71,11 @@ export const resetGestureValues = ({
|
|
|
67
71
|
// so the spring carries the gesture's momentum. The spec controls the
|
|
68
72
|
// spring character — use an underdamped spec (e.g. FlingSpec) for orbit/fling.
|
|
69
73
|
const resetVX = shouldDismiss
|
|
70
|
-
? vxNorm *
|
|
74
|
+
? vxNorm * resolvedGestureReleaseVelocityScale
|
|
71
75
|
: vxTowardZero;
|
|
72
76
|
|
|
73
77
|
const resetVY = shouldDismiss
|
|
74
|
-
? vyNorm *
|
|
78
|
+
? vyNorm * resolvedGestureReleaseVelocityScale
|
|
75
79
|
: vyTowardZero;
|
|
76
80
|
|
|
77
81
|
animateMany({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface ResolveRuntimeSnapPointsProps {
|
|
2
2
|
snapPoints: number[];
|
|
3
3
|
hasAutoSnapPoint: boolean;
|
|
4
|
-
|
|
4
|
+
resolvedAutoSnapPoint: number;
|
|
5
5
|
minSnapPoint: number;
|
|
6
6
|
maxSnapPoint: number;
|
|
7
7
|
canDismiss: boolean;
|
|
@@ -17,31 +17,33 @@ interface ResolvedRuntimeSnapPointsResult {
|
|
|
17
17
|
export const resolveRuntimeSnapPoints = ({
|
|
18
18
|
snapPoints,
|
|
19
19
|
hasAutoSnapPoint,
|
|
20
|
-
|
|
20
|
+
resolvedAutoSnapPoint,
|
|
21
21
|
minSnapPoint,
|
|
22
22
|
maxSnapPoint,
|
|
23
23
|
canDismiss,
|
|
24
24
|
}: ResolveRuntimeSnapPointsProps): ResolvedRuntimeSnapPointsResult => {
|
|
25
25
|
"worklet";
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
hasAutoSnapPoint &&
|
|
27
|
+
const nextResolvedAutoSnapPoint =
|
|
28
|
+
hasAutoSnapPoint && resolvedAutoSnapPoint > 0
|
|
29
|
+
? resolvedAutoSnapPoint
|
|
30
|
+
: null;
|
|
29
31
|
|
|
30
32
|
const resolvedSnapPoints =
|
|
31
|
-
|
|
33
|
+
nextResolvedAutoSnapPoint === null
|
|
32
34
|
? snapPoints
|
|
33
|
-
: [...snapPoints,
|
|
35
|
+
: [...snapPoints, nextResolvedAutoSnapPoint].sort((a, b) => a - b);
|
|
34
36
|
|
|
35
37
|
const resolvedMinSnapPoint =
|
|
36
|
-
|
|
38
|
+
nextResolvedAutoSnapPoint !== null && !canDismiss
|
|
37
39
|
? Math.min(
|
|
38
|
-
minSnapPoint === -1 ?
|
|
39
|
-
|
|
40
|
+
minSnapPoint === -1 ? nextResolvedAutoSnapPoint : minSnapPoint,
|
|
41
|
+
nextResolvedAutoSnapPoint,
|
|
40
42
|
)
|
|
41
43
|
: minSnapPoint;
|
|
42
44
|
|
|
43
45
|
return {
|
|
44
|
-
resolvedAutoSnapPoint,
|
|
46
|
+
resolvedAutoSnapPoint: nextResolvedAutoSnapPoint,
|
|
45
47
|
resolvedSnapPoints,
|
|
46
48
|
resolvedMinSnapPoint,
|
|
47
49
|
resolvedMaxSnapPoint:
|
|
@@ -111,22 +111,30 @@ export function determineSnapTarget({
|
|
|
111
111
|
snapPoints,
|
|
112
112
|
velocity,
|
|
113
113
|
dimension,
|
|
114
|
-
velocityFactor
|
|
115
|
-
canDismiss
|
|
114
|
+
velocityFactor,
|
|
115
|
+
canDismiss,
|
|
116
116
|
}: DetermineSnapTargetProps): DetermineSnapTargetResult {
|
|
117
117
|
"worklet";
|
|
118
|
+
const resolvedVelocityFactor =
|
|
119
|
+
velocityFactor ?? DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT;
|
|
120
|
+
const resolvedCanDismiss = canDismiss ?? true;
|
|
118
121
|
|
|
119
122
|
// Convert velocity to progress units (positive = toward dismiss = decreasing progress)
|
|
120
|
-
const velocityInProgress = (velocity / dimension) *
|
|
123
|
+
const velocityInProgress = (velocity / dimension) * resolvedVelocityFactor;
|
|
121
124
|
|
|
122
125
|
// Project where we'd end up with velocity
|
|
123
126
|
const projectedProgress = currentProgress - velocityInProgress;
|
|
124
127
|
|
|
125
|
-
const sanitizedSnapPoints = sanitizeSnapPoints(
|
|
128
|
+
const sanitizedSnapPoints = sanitizeSnapPoints(
|
|
129
|
+
snapPoints,
|
|
130
|
+
resolvedCanDismiss,
|
|
131
|
+
);
|
|
126
132
|
|
|
127
133
|
// Build all possible targets: dismiss (0) only if allowed, plus all snap points
|
|
128
134
|
const allTargets = Array.from(
|
|
129
|
-
new Set(
|
|
135
|
+
new Set(
|
|
136
|
+
resolvedCanDismiss ? [0, ...sanitizedSnapPoints] : sanitizedSnapPoints,
|
|
137
|
+
),
|
|
130
138
|
).sort((a, b) => a - b);
|
|
131
139
|
|
|
132
140
|
if (allTargets.length === 0) {
|
|
@@ -162,6 +170,6 @@ export function determineSnapTarget({
|
|
|
162
170
|
|
|
163
171
|
return {
|
|
164
172
|
targetProgress,
|
|
165
|
-
shouldDismiss:
|
|
173
|
+
shouldDismiss: resolvedCanDismiss && targetProgress === 0,
|
|
166
174
|
};
|
|
167
175
|
}
|
|
@@ -25,7 +25,7 @@ export function useRegisterDirectionClaims(
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const gestureValues = GestureStore.
|
|
28
|
+
const gestureValues = GestureStore.getBag(routeKey);
|
|
29
29
|
const isDismissing = gestureValues.dismissing;
|
|
30
30
|
|
|
31
31
|
const claimedAncestors: Array<{
|
|
@@ -83,9 +83,7 @@ export const useBuildGestures = ({
|
|
|
83
83
|
const { dismissScreen } = useNavigationHelpers();
|
|
84
84
|
|
|
85
85
|
const panGestureRef = useRef<GestureType | undefined>(undefined);
|
|
86
|
-
const gestureAnimationValues = GestureStore.
|
|
87
|
-
current.route.key,
|
|
88
|
-
);
|
|
86
|
+
const gestureAnimationValues = GestureStore.getBag(current.route.key);
|
|
89
87
|
|
|
90
88
|
const { snapPoints: rawSnapPoints } = current.options;
|
|
91
89
|
const canDismiss = Boolean(
|
|
@@ -83,14 +83,11 @@ const useInitialLayoutHandler = (params: {
|
|
|
83
83
|
maybeMeasureAndStore,
|
|
84
84
|
} = params;
|
|
85
85
|
|
|
86
|
-
const isAnimating = AnimationStore.
|
|
87
|
-
currentScreenKey,
|
|
88
|
-
"animating",
|
|
89
|
-
);
|
|
86
|
+
const isAnimating = AnimationStore.getValue(currentScreenKey, "animating");
|
|
90
87
|
|
|
91
88
|
// Check if any ancestor is animating
|
|
92
89
|
const ancestorAnimations = ancestorKeys.map((key) =>
|
|
93
|
-
AnimationStore.
|
|
90
|
+
AnimationStore.getValue(key, "animating"),
|
|
94
91
|
);
|
|
95
92
|
|
|
96
93
|
const hasMeasuredOnLayout = useSharedValue(false);
|
|
@@ -147,7 +144,7 @@ const useBlurMeasurement = (params: {
|
|
|
147
144
|
const hasCapturedSource = useRef(false);
|
|
148
145
|
|
|
149
146
|
const ancestorClosing = [current.route.key, ...ancestorKeys].map((key) =>
|
|
150
|
-
AnimationStore.
|
|
147
|
+
AnimationStore.getValue(key, "closing"),
|
|
151
148
|
);
|
|
152
149
|
|
|
153
150
|
const maybeMeasureOnBlur = useStableCallbackValue(() => {
|
|
@@ -258,10 +255,7 @@ const registerBoundsBundle = createProvider("RegisterBounds", {
|
|
|
258
255
|
const updateSignal: SharedValue<number> =
|
|
259
256
|
parentContext?.updateSignal ?? ownSignal;
|
|
260
257
|
|
|
261
|
-
const isAnimating = AnimationStore.
|
|
262
|
-
currentScreenKey,
|
|
263
|
-
"animating",
|
|
264
|
-
);
|
|
258
|
+
const isAnimating = AnimationStore.getValue(currentScreenKey, "animating");
|
|
265
259
|
const preparedStyles = useMemo(() => prepareStyleForBounds(style), [style]);
|
|
266
260
|
|
|
267
261
|
const emitUpdate = useStableCallbackValue(() => {
|
|
@@ -390,7 +384,7 @@ const registerBoundsBundle = createProvider("RegisterBounds", {
|
|
|
390
384
|
// from state).
|
|
391
385
|
const nextScreenKey = next?.route.key;
|
|
392
386
|
const nextClosing = nextScreenKey
|
|
393
|
-
? AnimationStore.
|
|
387
|
+
? AnimationStore.getValue(nextScreenKey, "closing")
|
|
394
388
|
: null;
|
|
395
389
|
|
|
396
390
|
useParentSyncReaction({ parentContext, maybeMeasureAndStore });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ScreenTransitionConfig } from "../../../../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper for compatibility with NativeStack. Native stack integration requires
|
|
5
|
+
* the `enableTransitions` prop for creating custom animations, however, blank
|
|
6
|
+
* stack animations are always on.
|
|
7
|
+
*/
|
|
8
|
+
export const hasTransitionsEnabled = (
|
|
9
|
+
options: ScreenTransitionConfig | undefined,
|
|
10
|
+
alwaysOn: boolean,
|
|
11
|
+
) => {
|
|
12
|
+
if (alwaysOn) return true;
|
|
13
|
+
return !!(options as any)?.enableTransitions;
|
|
14
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import { EPSILON } from "../../../../constants";
|
|
3
|
+
import type { GestureStoreMap } from "../../../../stores/gesture.store";
|
|
4
|
+
import type { ScreenTransitionState } from "../../../../types/animation.types";
|
|
5
|
+
import type { Layout } from "../../../../types/screen.types";
|
|
6
|
+
import type { BaseStackRoute } from "../../../../types/stack.types";
|
|
7
|
+
|
|
8
|
+
type BuiltState = {
|
|
9
|
+
progress: SharedValue<number>;
|
|
10
|
+
closing: SharedValue<number>;
|
|
11
|
+
animating: SharedValue<number>;
|
|
12
|
+
entering: SharedValue<number>;
|
|
13
|
+
gesture: GestureStoreMap;
|
|
14
|
+
route: BaseStackRoute;
|
|
15
|
+
meta?: Record<string, unknown>;
|
|
16
|
+
resolvedAutoSnapPoint: SharedValue<number>;
|
|
17
|
+
measuredContentLayout: SharedValue<Layout | null>;
|
|
18
|
+
hasAutoSnapPoint: boolean;
|
|
19
|
+
sortedNumericSnapPoints: number[];
|
|
20
|
+
unwrapped: ScreenTransitionState;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Computes the animated snap index based on progress and snap points.
|
|
25
|
+
* Returns -1 if no snap points, otherwise interpolates between indices.
|
|
26
|
+
*/
|
|
27
|
+
const computeSnapIndex = (progress: number, snapPoints: number[]): number => {
|
|
28
|
+
"worklet";
|
|
29
|
+
if (snapPoints.length === 0) return -1;
|
|
30
|
+
if (progress <= snapPoints[0]) return 0;
|
|
31
|
+
if (progress >= snapPoints[snapPoints.length - 1])
|
|
32
|
+
return snapPoints.length - 1;
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < snapPoints.length - 1; i++) {
|
|
35
|
+
if (progress <= snapPoints[i + 1]) {
|
|
36
|
+
const t =
|
|
37
|
+
(progress - snapPoints[i]) / (snapPoints[i + 1] - snapPoints[i]);
|
|
38
|
+
return i + t;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return snapPoints.length - 1;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const hydrateTransitionState = (
|
|
45
|
+
s: BuiltState,
|
|
46
|
+
dimensions: Layout,
|
|
47
|
+
): ScreenTransitionState => {
|
|
48
|
+
"worklet";
|
|
49
|
+
const out = s.unwrapped;
|
|
50
|
+
out.progress = s.progress.value;
|
|
51
|
+
out.closing = s.closing.value;
|
|
52
|
+
out.entering = s.entering.value;
|
|
53
|
+
out.gesture.x = s.gesture.x.value;
|
|
54
|
+
out.gesture.y = s.gesture.y.value;
|
|
55
|
+
out.gesture.normX = s.gesture.normX.value;
|
|
56
|
+
out.gesture.normY = s.gesture.normY.value;
|
|
57
|
+
out.gesture.dismissing = s.gesture.dismissing.value;
|
|
58
|
+
out.gesture.dragging = s.gesture.dragging.value;
|
|
59
|
+
out.gesture.direction = s.gesture.direction.value;
|
|
60
|
+
|
|
61
|
+
const isGestureSettling =
|
|
62
|
+
Math.abs(out.gesture.normX) > EPSILON ||
|
|
63
|
+
Math.abs(out.gesture.normY) > EPSILON;
|
|
64
|
+
|
|
65
|
+
out.animating =
|
|
66
|
+
s.animating.value || out.gesture.dragging || isGestureSettling ? 1 : 0;
|
|
67
|
+
|
|
68
|
+
// Deprecated aliases (kept for backwards compatibility)
|
|
69
|
+
out.gesture.normalizedX = out.gesture.normX;
|
|
70
|
+
out.gesture.normalizedY = out.gesture.normY;
|
|
71
|
+
out.gesture.isDismissing = out.gesture.dismissing;
|
|
72
|
+
out.gesture.isDragging = out.gesture.dragging;
|
|
73
|
+
|
|
74
|
+
out.settled = out.animating || out.gesture.dismissing || out.closing ? 0 : 1;
|
|
75
|
+
|
|
76
|
+
out.meta = s.meta;
|
|
77
|
+
out.layouts.screen.width = dimensions.width;
|
|
78
|
+
out.layouts.screen.height = dimensions.height;
|
|
79
|
+
|
|
80
|
+
const content = s.measuredContentLayout.value;
|
|
81
|
+
if (content) {
|
|
82
|
+
if (!out.layouts.content) {
|
|
83
|
+
out.layouts.content = {
|
|
84
|
+
width: content.width,
|
|
85
|
+
height: content.height,
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
out.layouts.content.width = content.width;
|
|
89
|
+
out.layouts.content.height = content.height;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
out.layouts.content = undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const resolvedAutoSnap =
|
|
96
|
+
s.hasAutoSnapPoint && s.resolvedAutoSnapPoint.value > 0
|
|
97
|
+
? s.resolvedAutoSnapPoint.value
|
|
98
|
+
: null;
|
|
99
|
+
|
|
100
|
+
const resolvedSnapPoints =
|
|
101
|
+
resolvedAutoSnap !== null
|
|
102
|
+
? [...s.sortedNumericSnapPoints, resolvedAutoSnap].sort((a, b) => a - b)
|
|
103
|
+
: s.sortedNumericSnapPoints;
|
|
104
|
+
|
|
105
|
+
out.snapIndex = computeSnapIndex(out.progress, resolvedSnapPoints);
|
|
106
|
+
|
|
107
|
+
return out;
|
|
108
|
+
};
|