react-native-screen-transitions 3.4.0-alpha.0 → 3.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -2
- package/lib/commonjs/shared/animation/snap-to.js +5 -1
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js +5 -10
- package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js +2 -2
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/index.js +1 -3
- package/lib/commonjs/shared/components/overlay/index.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +2 -16
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/commonjs/shared/components/scene-view.js +2 -4
- package/lib/commonjs/shared/components/scene-view.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +9 -6
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +47 -55
- 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 +77 -0
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -0
- 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 +17 -4
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/commonjs/shared/constants.js +6 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/resolve-screen-gesture-target.js +49 -0
- package/lib/commonjs/shared/hooks/gestures/resolve-screen-gesture-target.js.map +1 -0
- package/lib/commonjs/shared/hooks/gestures/types.js +2 -0
- package/lib/commonjs/shared/hooks/gestures/types.js.map +1 -0
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture.js +7 -3
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/index.js +15 -3
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +55 -18
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js +44 -0
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/animation.provider.js +31 -17
- package/lib/commonjs/shared/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js +1 -9
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +11 -6
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js +33 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/types.js +2 -0
- package/lib/commonjs/shared/providers/screen/animation/types.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/use-screen-animation.js +9 -3
- package/lib/commonjs/shared/providers/screen/animation/use-screen-animation.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 +8 -2
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -0
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +6 -0
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +24 -9
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/geometry.js +3 -2
- package/lib/commonjs/shared/utils/bounds/helpers/geometry.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js +3 -2
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js +2 -2
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js +6 -5
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js +4 -3
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +3 -3
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js +54 -0
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +541 -0
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +118 -0
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/index.js +20 -0
- package/lib/commonjs/shared/utils/bounds/zoom/index.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/types.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js +11 -5
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js.map +1 -1
- package/lib/commonjs/shared/utils/overlay/visibility.js +2 -9
- package/lib/commonjs/shared/utils/overlay/visibility.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +5 -1
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js +5 -10
- package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +1 -1
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js +3 -3
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/module/shared/components/overlay/index.js +1 -3
- package/lib/module/shared/components/overlay/index.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/overlay-host.js +3 -17
- package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/module/shared/components/scene-view.js +3 -5
- package/lib/module/shared/components/scene-view.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +9 -6
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +52 -60
- 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 +72 -0
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -0
- 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 +17 -4
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/module/shared/constants.js +6 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/gestures/resolve-screen-gesture-target.js +45 -0
- package/lib/module/shared/hooks/gestures/resolve-screen-gesture-target.js.map +1 -0
- package/lib/module/shared/hooks/gestures/types.js +2 -0
- package/lib/module/shared/hooks/gestures/types.js.map +1 -0
- package/lib/module/shared/hooks/gestures/use-screen-gesture.js +7 -4
- package/lib/module/shared/hooks/gestures/use-screen-gesture.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/index.js +1 -2
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +55 -18
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js +38 -0
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/animation.provider.js +30 -15
- package/lib/module/shared/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js +1 -9
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +11 -6
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js +29 -0
- package/lib/module/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/index.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/types.js +2 -0
- package/lib/module/shared/providers/screen/animation/types.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/use-screen-animation.js +9 -3
- package/lib/module/shared/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +2 -2
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js +2 -2
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +8 -2
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +7 -0
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +6 -0
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +24 -9
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/geometry.js +3 -2
- package/lib/module/shared/utils/bounds/helpers/geometry.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/interpolators.js +3 -2
- package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js +2 -2
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js +6 -5
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js +4 -3
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +3 -3
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/accessor.js +49 -0
- package/lib/module/shared/utils/bounds/zoom/accessor.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/build.js +536 -0
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/config.js +112 -0
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/index.js +5 -0
- package/lib/module/shared/utils/bounds/zoom/index.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/types.js.map +1 -0
- package/lib/module/shared/utils/gesture/validate-snap-points.js +11 -5
- package/lib/module/shared/utils/gesture/validate-snap-points.js.map +1 -1
- package/lib/module/shared/utils/overlay/visibility.js +1 -7
- package/lib/module/shared/utils/overlay/visibility.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts +0 -1
- package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts +1 -1
- package/lib/typescript/shared/components/overlay/index.d.ts +0 -2
- package/lib/typescript/shared/components/overlay/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/scene-view.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 +7 -0
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -0
- 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.map +1 -1
- package/lib/typescript/shared/constants.d.ts +3 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/resolve-screen-gesture-target.d.ts +10 -0
- package/lib/typescript/shared/hooks/gestures/resolve-screen-gesture-target.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/gestures/types.d.ts +4 -0
- package/lib/typescript/shared/hooks/gestures/types.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture.d.ts +4 -2
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +1 -2
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +16 -17
- 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 +18 -0
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/animation.provider.d.ts +6 -3
- package/lib/typescript/shared/providers/screen/animation/animation.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts +0 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/resolve-screen-animation-target.d.ts +11 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/resolve-screen-animation-target.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/index.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/animation/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/types.d.ts +4 -0
- package/lib/typescript/shared/providers/screen/animation/types.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/use-screen-animation.d.ts +5 -1
- package/lib/typescript/shared/providers/screen/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +4 -0
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/types.d.ts +2 -0
- package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +26 -51
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +46 -9
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +3 -3
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/overlay.types.d.ts +1 -22
- package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +16 -15
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.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/helpers/geometry.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +2 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts +4 -3
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +5 -4
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +4 -0
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +43 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts +3 -0
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts +5 -3
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/utils/overlay/visibility.d.ts +1 -4
- package/lib/typescript/shared/utils/overlay/visibility.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/shared/animation/snap-to.ts +12 -1
- package/src/shared/components/create-boundary-component/utils/build-boundary-match-key.ts +2 -14
- package/src/shared/components/overlay/helpers/get-active-overlay.ts +3 -3
- package/src/shared/components/overlay/index.ts +0 -2
- package/src/shared/components/overlay/variations/overlay-host.tsx +2 -16
- package/src/shared/components/scene-view.tsx +0 -3
- package/src/shared/components/screen-container/layers/backdrop.tsx +25 -6
- package/src/shared/components/screen-container/layers/content.tsx +80 -77
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +93 -0
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/index.ts +1 -2
- package/src/shared/components/screen-lifecycle/hooks/use-open-transition.ts +20 -6
- package/src/shared/constants.ts +6 -2
- package/src/shared/hooks/gestures/resolve-screen-gesture-target.ts +66 -0
- package/src/shared/hooks/gestures/types.ts +5 -0
- package/src/shared/hooks/gestures/use-screen-gesture.ts +10 -3
- package/src/shared/hooks/navigation/use-stack.tsx +1 -2
- package/src/shared/index.ts +14 -16
- package/src/shared/providers/gestures/handlers/use-handlers.ts +67 -24
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +72 -0
- package/src/shared/providers/screen/animation/animation.provider.tsx +46 -10
- package/src/shared/providers/screen/animation/helpers/derivations.ts +0 -8
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +26 -5
- package/src/shared/providers/screen/animation/helpers/resolve-screen-animation-target.ts +44 -0
- package/src/shared/providers/screen/animation/index.tsx +4 -1
- package/src/shared/providers/screen/animation/types.ts +5 -0
- package/src/shared/providers/screen/animation/use-screen-animation.tsx +16 -3
- package/src/shared/providers/stack/direct.provider.tsx +2 -5
- package/src/shared/providers/stack/helpers/use-processed-routes.ts +2 -2
- package/src/shared/stores/animation.store.ts +13 -1
- package/src/shared/stores/bounds/internals/resolver.ts +13 -1
- package/src/shared/stores/bounds/types.ts +2 -0
- package/src/shared/types/animation.types.ts +25 -58
- package/src/shared/types/bounds.types.ts +30 -10
- package/src/shared/types/index.ts +2 -15
- package/src/shared/types/overlay.types.ts +1 -28
- package/src/shared/types/screen.types.ts +17 -16
- package/src/shared/utils/animation/animate-to-progress.ts +7 -0
- package/src/shared/utils/bounds/helpers/build-bounds-options.ts +2 -2
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +34 -8
- package/src/shared/utils/bounds/helpers/geometry.ts +3 -2
- package/src/shared/utils/bounds/helpers/interpolators.ts +8 -6
- package/src/shared/utils/bounds/helpers/link-accessor.ts +10 -6
- package/src/shared/utils/bounds/helpers/resolve-bound-tag.ts +9 -6
- package/src/shared/utils/bounds/helpers/style-composers.ts +4 -3
- package/src/shared/utils/bounds/index.ts +6 -8
- package/src/shared/utils/bounds/types/options.ts +6 -4
- package/src/shared/utils/bounds/zoom/accessor.ts +69 -0
- package/src/shared/utils/bounds/zoom/build.ts +705 -0
- package/src/shared/utils/bounds/zoom/config.ts +179 -0
- package/src/shared/utils/bounds/zoom/index.ts +2 -0
- package/src/shared/utils/bounds/zoom/types.ts +22 -0
- package/src/shared/utils/gesture/validate-snap-points.ts +20 -8
- package/src/shared/utils/overlay/visibility.ts +1 -16
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js +0 -64
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/math.js +0 -132
- package/lib/commonjs/shared/utils/bounds/helpers/math.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/navigation-accessor.js +0 -45
- package/lib/commonjs/shared/utils/bounds/helpers/navigation-accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/helpers.js +0 -60
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/helpers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/index.js +0 -20
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/index.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/types.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/zoom.js +0 -295
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/zoom.js.map +0 -1
- package/lib/module/shared/components/overlay/variations/screen-overlay.js +0 -61
- package/lib/module/shared/components/overlay/variations/screen-overlay.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/math.js +0 -115
- package/lib/module/shared/utils/bounds/helpers/math.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/navigation-accessor.js +0 -40
- package/lib/module/shared/utils/bounds/helpers/navigation-accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/helpers.js +0 -54
- package/lib/module/shared/utils/bounds/sugar/navigation/helpers.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/index.js +0 -15
- package/lib/module/shared/utils/bounds/sugar/navigation/index.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/types.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/zoom.js +0 -290
- package/lib/module/shared/utils/bounds/sugar/navigation/zoom.js.map +0 -1
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts +0 -10
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/math.d.ts +0 -38
- package/lib/typescript/shared/utils/bounds/helpers/math.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/navigation-accessor.d.ts +0 -16
- package/lib/typescript/shared/utils/bounds/helpers/navigation-accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/helpers.d.ts +0 -17
- package/lib/typescript/shared/utils/bounds/sugar/navigation/helpers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/index.d.ts +0 -3
- package/lib/typescript/shared/utils/bounds/sugar/navigation/index.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/types.d.ts +0 -18
- package/lib/typescript/shared/utils/bounds/sugar/navigation/types.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/zoom.d.ts +0 -4
- package/lib/typescript/shared/utils/bounds/sugar/navigation/zoom.d.ts.map +0 -1
- package/src/shared/components/overlay/variations/screen-overlay.tsx +0 -68
- package/src/shared/utils/bounds/helpers/math.ts +0 -161
- package/src/shared/utils/bounds/helpers/navigation-accessor.ts +0 -61
- package/src/shared/utils/bounds/sugar/navigation/helpers.ts +0 -74
- package/src/shared/utils/bounds/sugar/navigation/index.ts +0 -14
- package/src/shared/utils/bounds/sugar/navigation/types.ts +0 -26
- package/src/shared/utils/bounds/sugar/navigation/zoom.ts +0 -348
- /package/lib/commonjs/shared/utils/bounds/{sugar/navigation → zoom}/types.js +0 -0
- /package/lib/module/shared/utils/bounds/{sugar/navigation → zoom}/types.js +0 -0
|
@@ -53,6 +53,10 @@ import {
|
|
|
53
53
|
normalizeVelocity,
|
|
54
54
|
} from "../helpers/gesture-physics";
|
|
55
55
|
import { resetGestureValues } from "../helpers/gesture-reset";
|
|
56
|
+
import {
|
|
57
|
+
findNearestSnapPoint,
|
|
58
|
+
resolveRuntimeSnapPoints,
|
|
59
|
+
} from "../helpers/gesture-snap-points";
|
|
56
60
|
import {
|
|
57
61
|
determineDismissal,
|
|
58
62
|
determineSnapTarget,
|
|
@@ -147,14 +151,22 @@ export const useHandlers = ({
|
|
|
147
151
|
|
|
148
152
|
const { dimensions } = useViewportContext();
|
|
149
153
|
const routeKey = current.route.key;
|
|
150
|
-
const animations = AnimationStore.getRouteAnimations(
|
|
151
|
-
const gestureAnimationValues = GestureStore.getRouteGestures(
|
|
152
|
-
|
|
154
|
+
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
155
|
+
const gestureAnimationValues = GestureStore.getRouteGestures(routeKey);
|
|
156
|
+
const {
|
|
157
|
+
hasSnapPoints,
|
|
158
|
+
hasAutoSnapPoint,
|
|
159
|
+
snapPoints,
|
|
160
|
+
minSnapPoint,
|
|
161
|
+
maxSnapPoint,
|
|
162
|
+
} = effectiveSnapPoints;
|
|
163
|
+
|
|
164
|
+
// Read the measured "auto" snap point reactively inside worklets.
|
|
165
|
+
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
166
|
+
routeKey,
|
|
167
|
+
"autoSnapPoint",
|
|
153
168
|
);
|
|
154
169
|
|
|
155
|
-
const { hasSnapPoints, snapPoints, minSnapPoint, maxSnapPoint } =
|
|
156
|
-
effectiveSnapPoints;
|
|
157
|
-
|
|
158
170
|
const directions = useMemo(() => {
|
|
159
171
|
warnOnSnapDirectionArray({ gestureDirection, hasSnapPoints });
|
|
160
172
|
return resolveGestureDirections({ gestureDirection, hasSnapPoints });
|
|
@@ -289,9 +301,17 @@ export const useHandlers = ({
|
|
|
289
301
|
return;
|
|
290
302
|
}
|
|
291
303
|
|
|
304
|
+
const { resolvedMaxSnapPoint } = resolveRuntimeSnapPoints({
|
|
305
|
+
snapPoints,
|
|
306
|
+
hasAutoSnapPoint,
|
|
307
|
+
autoSnapPoint: autoSnapPointValue.value,
|
|
308
|
+
minSnapPoint,
|
|
309
|
+
maxSnapPoint,
|
|
310
|
+
canDismiss,
|
|
311
|
+
});
|
|
292
312
|
const effectiveMaxSnapPoint = gestureSnapLocked
|
|
293
313
|
? lockedSnapPoint.value
|
|
294
|
-
:
|
|
314
|
+
: resolvedMaxSnapPoint;
|
|
295
315
|
|
|
296
316
|
const canExpandMore =
|
|
297
317
|
animations.progress.value < effectiveMaxSnapPoint - EPSILON &&
|
|
@@ -312,22 +332,23 @@ export const useHandlers = ({
|
|
|
312
332
|
|
|
313
333
|
const onStart = useStableCallbackValue(() => {
|
|
314
334
|
"worklet";
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
nearest = point;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
335
|
+
const { resolvedSnapPoints, resolvedMaxSnapPoint } =
|
|
336
|
+
resolveRuntimeSnapPoints({
|
|
337
|
+
snapPoints,
|
|
338
|
+
hasAutoSnapPoint,
|
|
339
|
+
autoSnapPoint: autoSnapPointValue.value,
|
|
340
|
+
minSnapPoint,
|
|
341
|
+
maxSnapPoint,
|
|
342
|
+
canDismiss,
|
|
343
|
+
});
|
|
327
344
|
|
|
328
|
-
|
|
345
|
+
if (hasSnapPoints && gestureSnapLocked) {
|
|
346
|
+
lockedSnapPoint.value = findNearestSnapPoint(
|
|
347
|
+
animations.progress.value,
|
|
348
|
+
resolvedSnapPoints,
|
|
349
|
+
);
|
|
329
350
|
} else {
|
|
330
|
-
lockedSnapPoint.value =
|
|
351
|
+
lockedSnapPoint.value = resolvedMaxSnapPoint;
|
|
331
352
|
}
|
|
332
353
|
|
|
333
354
|
gestureAnimationValues.dragging.value = TRUE;
|
|
@@ -363,14 +384,25 @@ export const useHandlers = ({
|
|
|
363
384
|
const baseSign = -1;
|
|
364
385
|
const sign = directions.snapAxisInverted ? -baseSign : baseSign;
|
|
365
386
|
const progressDelta = (sign * translation) / dimension;
|
|
387
|
+
|
|
388
|
+
const { resolvedMinSnapPoint, resolvedMaxSnapPoint } =
|
|
389
|
+
resolveRuntimeSnapPoints({
|
|
390
|
+
snapPoints,
|
|
391
|
+
hasAutoSnapPoint,
|
|
392
|
+
autoSnapPoint: autoSnapPointValue.value,
|
|
393
|
+
minSnapPoint,
|
|
394
|
+
maxSnapPoint,
|
|
395
|
+
canDismiss,
|
|
396
|
+
});
|
|
397
|
+
|
|
366
398
|
const maxProgressForGesture = gestureSnapLocked
|
|
367
399
|
? lockedSnapPoint.value
|
|
368
|
-
:
|
|
400
|
+
: resolvedMaxSnapPoint;
|
|
369
401
|
const minProgressForGesture = gestureSnapLocked
|
|
370
402
|
? canDismiss
|
|
371
403
|
? 0
|
|
372
404
|
: lockedSnapPoint.value
|
|
373
|
-
:
|
|
405
|
+
: resolvedMinSnapPoint;
|
|
374
406
|
|
|
375
407
|
animations.progress.value = Math.max(
|
|
376
408
|
minProgressForGesture,
|
|
@@ -430,9 +462,20 @@ export const useHandlers = ({
|
|
|
430
462
|
? -axisVelocity
|
|
431
463
|
: axisVelocity;
|
|
432
464
|
|
|
465
|
+
const { resolvedSnapPoints } = resolveRuntimeSnapPoints({
|
|
466
|
+
snapPoints,
|
|
467
|
+
hasAutoSnapPoint,
|
|
468
|
+
autoSnapPoint: autoSnapPointValue.value,
|
|
469
|
+
minSnapPoint,
|
|
470
|
+
maxSnapPoint,
|
|
471
|
+
canDismiss,
|
|
472
|
+
});
|
|
473
|
+
|
|
433
474
|
const result = determineSnapTarget({
|
|
434
475
|
currentProgress: animations.progress.value,
|
|
435
|
-
snapPoints: gestureSnapLocked
|
|
476
|
+
snapPoints: gestureSnapLocked
|
|
477
|
+
? [lockedSnapPoint.value]
|
|
478
|
+
: resolvedSnapPoints,
|
|
436
479
|
velocity: snapVelocity,
|
|
437
480
|
dimension: axisDimension,
|
|
438
481
|
velocityFactor: snapVelocityImpact,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
interface ResolveRuntimeSnapPointsProps {
|
|
2
|
+
snapPoints: number[];
|
|
3
|
+
hasAutoSnapPoint: boolean;
|
|
4
|
+
autoSnapPoint: number;
|
|
5
|
+
minSnapPoint: number;
|
|
6
|
+
maxSnapPoint: number;
|
|
7
|
+
canDismiss: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ResolvedRuntimeSnapPointsResult {
|
|
11
|
+
resolvedAutoSnapPoint: number | null;
|
|
12
|
+
resolvedSnapPoints: number[];
|
|
13
|
+
resolvedMinSnapPoint: number;
|
|
14
|
+
resolvedMaxSnapPoint: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const resolveRuntimeSnapPoints = ({
|
|
18
|
+
snapPoints,
|
|
19
|
+
hasAutoSnapPoint,
|
|
20
|
+
autoSnapPoint,
|
|
21
|
+
minSnapPoint,
|
|
22
|
+
maxSnapPoint,
|
|
23
|
+
canDismiss,
|
|
24
|
+
}: ResolveRuntimeSnapPointsProps): ResolvedRuntimeSnapPointsResult => {
|
|
25
|
+
"worklet";
|
|
26
|
+
|
|
27
|
+
const resolvedAutoSnapPoint =
|
|
28
|
+
hasAutoSnapPoint && autoSnapPoint > 0 ? autoSnapPoint : null;
|
|
29
|
+
|
|
30
|
+
const resolvedSnapPoints =
|
|
31
|
+
resolvedAutoSnapPoint === null
|
|
32
|
+
? snapPoints
|
|
33
|
+
: [...snapPoints, resolvedAutoSnapPoint].sort((a, b) => a - b);
|
|
34
|
+
|
|
35
|
+
const resolvedMinSnapPoint =
|
|
36
|
+
resolvedAutoSnapPoint !== null && !canDismiss
|
|
37
|
+
? Math.min(
|
|
38
|
+
minSnapPoint === -1 ? resolvedAutoSnapPoint : minSnapPoint,
|
|
39
|
+
resolvedAutoSnapPoint,
|
|
40
|
+
)
|
|
41
|
+
: minSnapPoint;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
resolvedAutoSnapPoint,
|
|
45
|
+
resolvedSnapPoints,
|
|
46
|
+
resolvedMinSnapPoint,
|
|
47
|
+
resolvedMaxSnapPoint:
|
|
48
|
+
resolvedSnapPoints[resolvedSnapPoints.length - 1] ?? maxSnapPoint,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const findNearestSnapPoint = (
|
|
53
|
+
progress: number,
|
|
54
|
+
snapPoints: number[],
|
|
55
|
+
): number => {
|
|
56
|
+
"worklet";
|
|
57
|
+
|
|
58
|
+
let nearest = snapPoints[0] ?? progress;
|
|
59
|
+
let smallestDistance = Math.abs(progress - nearest);
|
|
60
|
+
|
|
61
|
+
for (let i = 1; i < snapPoints.length; i++) {
|
|
62
|
+
const point = snapPoints[i];
|
|
63
|
+
const distance = Math.abs(progress - point);
|
|
64
|
+
|
|
65
|
+
if (distance < smallestDistance) {
|
|
66
|
+
smallestDistance = distance;
|
|
67
|
+
nearest = point;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return nearest;
|
|
72
|
+
};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { type ReactNode, useMemo } from "react";
|
|
1
|
+
import { createContext, type ReactNode, useContext, useMemo } from "react";
|
|
2
2
|
import { type DerivedValue, useDerivedValue } from "react-native-reanimated";
|
|
3
3
|
import type { ScreenInterpolationProps } from "../../../types/animation.types";
|
|
4
|
-
import createProvider from "../../../utils/create-provider";
|
|
5
4
|
import { useScreenAnimationPipeline } from "./helpers/pipeline";
|
|
6
5
|
|
|
7
6
|
type Props = {
|
|
8
7
|
children: ReactNode;
|
|
9
8
|
};
|
|
10
9
|
|
|
11
|
-
type ScreenAnimationContextValue = ReturnType<
|
|
10
|
+
export type ScreenAnimationContextValue = ReturnType<
|
|
12
11
|
typeof useScreenAnimationPipeline
|
|
13
12
|
> & {
|
|
14
13
|
screenAnimation: DerivedValue<ScreenInterpolationProps>;
|
|
14
|
+
ancestorScreenAnimations: DerivedValue<ScreenInterpolationProps>[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const ScreenAnimationContext =
|
|
18
|
+
createContext<ScreenAnimationContextValue | null>(null);
|
|
19
|
+
ScreenAnimationContext.displayName = "ScreenAnimation";
|
|
20
|
+
|
|
21
|
+
function ScreenAnimationProvider({ children }: Props) {
|
|
22
|
+
const parentContext = useContext(ScreenAnimationContext);
|
|
23
|
+
|
|
21
24
|
const {
|
|
22
25
|
screenInterpolatorProps,
|
|
23
26
|
nextInterpolator,
|
|
@@ -34,6 +37,17 @@ const { ScreenAnimationProvider, useScreenAnimationContext } = createProvider(
|
|
|
34
37
|
};
|
|
35
38
|
});
|
|
36
39
|
|
|
40
|
+
const ancestorScreenAnimations = useMemo(() => {
|
|
41
|
+
if (!parentContext) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
parentContext.screenAnimation,
|
|
47
|
+
...parentContext.ancestorScreenAnimations,
|
|
48
|
+
];
|
|
49
|
+
}, [parentContext]);
|
|
50
|
+
|
|
37
51
|
const value = useMemo(
|
|
38
52
|
() => ({
|
|
39
53
|
screenInterpolatorProps,
|
|
@@ -41,6 +55,7 @@ const { ScreenAnimationProvider, useScreenAnimationContext } = createProvider(
|
|
|
41
55
|
currentInterpolator,
|
|
42
56
|
boundsAccessor,
|
|
43
57
|
screenAnimation,
|
|
58
|
+
ancestorScreenAnimations,
|
|
44
59
|
}),
|
|
45
60
|
[
|
|
46
61
|
screenInterpolatorProps,
|
|
@@ -48,10 +63,31 @@ const { ScreenAnimationProvider, useScreenAnimationContext } = createProvider(
|
|
|
48
63
|
currentInterpolator,
|
|
49
64
|
boundsAccessor,
|
|
50
65
|
screenAnimation,
|
|
66
|
+
ancestorScreenAnimations,
|
|
51
67
|
],
|
|
52
68
|
);
|
|
53
69
|
|
|
54
|
-
return
|
|
55
|
-
}
|
|
70
|
+
return (
|
|
71
|
+
<ScreenAnimationContext.Provider value={value}>
|
|
72
|
+
{children}
|
|
73
|
+
</ScreenAnimationContext.Provider>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
56
76
|
|
|
57
|
-
|
|
77
|
+
function useScreenAnimationContext(): ScreenAnimationContextValue {
|
|
78
|
+
const context = useContext(ScreenAnimationContext);
|
|
79
|
+
|
|
80
|
+
if (!context) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"ScreenAnimation context must be used within a ScreenAnimationProvider",
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return context;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
ScreenAnimationContext,
|
|
91
|
+
ScreenAnimationProvider,
|
|
92
|
+
useScreenAnimationContext,
|
|
93
|
+
};
|
|
@@ -24,18 +24,10 @@ export const derivations = ({ previous, current, next }: DerivationsParams) => {
|
|
|
24
24
|
// The screen NOT driving the transition
|
|
25
25
|
const inactive = focused ? previous : current;
|
|
26
26
|
|
|
27
|
-
// deprecated
|
|
28
|
-
const isActiveTransitioning = !!(active.gesture.dragging || active.animating);
|
|
29
|
-
|
|
30
|
-
// deprecated
|
|
31
|
-
const isDismissing = !!(active.gesture.dismissing || active.closing);
|
|
32
|
-
|
|
33
27
|
return {
|
|
34
28
|
progress,
|
|
35
29
|
focused,
|
|
36
30
|
active,
|
|
37
31
|
inactive,
|
|
38
|
-
isActiveTransitioning,
|
|
39
|
-
isDismissing,
|
|
40
32
|
};
|
|
41
33
|
};
|
|
@@ -175,11 +175,24 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
175
175
|
const currentRouteKey = currentDescriptor?.route?.key;
|
|
176
176
|
const currentIndex = routeKeys.indexOf(currentRouteKey);
|
|
177
177
|
|
|
178
|
-
const
|
|
178
|
+
const sortedNumericSnapPoints = useMemo(() => {
|
|
179
179
|
const points = currentDescriptor?.options?.snapPoints;
|
|
180
|
-
|
|
180
|
+
if (!points) return [];
|
|
181
|
+
return points
|
|
182
|
+
.filter((p): p is number => typeof p === "number")
|
|
183
|
+
.sort((a, b) => a - b);
|
|
181
184
|
}, [currentDescriptor?.options?.snapPoints]);
|
|
182
185
|
|
|
186
|
+
const hasAutoSnapPoint = useMemo(
|
|
187
|
+
() => currentDescriptor?.options?.snapPoints?.includes("auto") ?? false,
|
|
188
|
+
[currentDescriptor?.options?.snapPoints],
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
192
|
+
currentRouteKey ?? "_",
|
|
193
|
+
"autoSnapPoint",
|
|
194
|
+
);
|
|
195
|
+
|
|
183
196
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
184
197
|
const nextHasTransitions =
|
|
185
198
|
!!nextRouteKey &&
|
|
@@ -199,8 +212,6 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
199
212
|
focused: true,
|
|
200
213
|
active: DEFAULT_SCREEN_TRANSITION_STATE,
|
|
201
214
|
inactive: undefined,
|
|
202
|
-
isActiveTransitioning: false,
|
|
203
|
-
isDismissing: false,
|
|
204
215
|
});
|
|
205
216
|
|
|
206
217
|
const boundsAccessor = useMemo(() => {
|
|
@@ -238,7 +249,17 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
238
249
|
const stackProgress =
|
|
239
250
|
currentIndex >= 0 ? rootStackProgress.value - currentIndex : progress;
|
|
240
251
|
|
|
241
|
-
|
|
252
|
+
// Resolve 'auto' snap point reactively so computeSnapIndex stays accurate
|
|
253
|
+
const resolvedAutoSnap =
|
|
254
|
+
hasAutoSnapPoint && autoSnapPointValue.value > 0
|
|
255
|
+
? autoSnapPointValue.value
|
|
256
|
+
: null;
|
|
257
|
+
const resolvedSnapPoints =
|
|
258
|
+
resolvedAutoSnap !== null
|
|
259
|
+
? [...sortedNumericSnapPoints, resolvedAutoSnap].sort((a, b) => a - b)
|
|
260
|
+
: sortedNumericSnapPoints;
|
|
261
|
+
|
|
262
|
+
const snapIndex = computeSnapIndex(current.progress, resolvedSnapPoints);
|
|
242
263
|
|
|
243
264
|
const nextProps = {
|
|
244
265
|
layouts: { screen: dimensions },
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DerivedValue } from "react-native-reanimated";
|
|
2
|
+
import type { ScreenInterpolationProps } from "../../../../types/animation.types";
|
|
3
|
+
import type { ScreenAnimationTarget } from "../types";
|
|
4
|
+
|
|
5
|
+
type Params = {
|
|
6
|
+
target: ScreenAnimationTarget | undefined;
|
|
7
|
+
self: DerivedValue<ScreenInterpolationProps>;
|
|
8
|
+
ancestors: DerivedValue<ScreenInterpolationProps>[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const isAncestorTarget = (
|
|
12
|
+
target: ScreenAnimationTarget,
|
|
13
|
+
): target is { ancestor: number } => {
|
|
14
|
+
return typeof target === "object" && target !== null && "ancestor" in target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function resolveScreenAnimationTarget({
|
|
18
|
+
target,
|
|
19
|
+
self,
|
|
20
|
+
ancestors,
|
|
21
|
+
}: Params): DerivedValue<ScreenInterpolationProps> {
|
|
22
|
+
if (!target || target === "self") {
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (target === "parent") {
|
|
27
|
+
return ancestors[0] ?? self;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (target === "root") {
|
|
31
|
+
return ancestors[ancestors.length - 1] ?? self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isAncestorTarget(target)) {
|
|
35
|
+
return self;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const depth = target.ancestor;
|
|
39
|
+
if (!Number.isInteger(depth) || depth < 1) {
|
|
40
|
+
return self;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return ancestors[depth - 1] ?? self;
|
|
44
|
+
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import type { DerivedValue } from "react-native-reanimated";
|
|
2
|
+
import type { ScreenInterpolationProps } from "../../../types/animation.types";
|
|
1
3
|
import { useScreenAnimationContext } from "./animation.provider";
|
|
4
|
+
import { resolveScreenAnimationTarget } from "./helpers/resolve-screen-animation-target";
|
|
5
|
+
import type { ScreenAnimationTarget } from "./types";
|
|
2
6
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
export type { ScreenAnimationTarget } from "./types";
|
|
8
|
+
|
|
9
|
+
export function useScreenAnimation(
|
|
10
|
+
target?: ScreenAnimationTarget,
|
|
11
|
+
): DerivedValue<ScreenInterpolationProps> {
|
|
12
|
+
const { screenAnimation, ancestorScreenAnimations } =
|
|
13
|
+
useScreenAnimationContext();
|
|
14
|
+
return resolveScreenAnimationTarget({
|
|
15
|
+
target,
|
|
16
|
+
self: screenAnimation,
|
|
17
|
+
ancestors: ancestorScreenAnimations,
|
|
18
|
+
});
|
|
6
19
|
}
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
DirectStackProps,
|
|
15
15
|
DirectStackScene,
|
|
16
16
|
} from "../../types/providers/direct-stack.types";
|
|
17
|
-
import {
|
|
17
|
+
import { isOverlayVisible } from "../../utils/overlay/visibility";
|
|
18
18
|
import { useStackCoreContext } from "./core.provider";
|
|
19
19
|
import { useStackDerived } from "./helpers/use-stack-derived";
|
|
20
20
|
|
|
@@ -64,10 +64,7 @@ function useDirectStackValue(
|
|
|
64
64
|
|
|
65
65
|
if (!shouldShowFloatOverlay && descriptor) {
|
|
66
66
|
const options = descriptor.options;
|
|
67
|
-
if (
|
|
68
|
-
options?.enableTransitions === true &&
|
|
69
|
-
isFloatOverlayVisible(options)
|
|
70
|
-
) {
|
|
67
|
+
if (options?.enableTransitions === true && isOverlayVisible(options)) {
|
|
71
68
|
shouldShowFloatOverlay = true;
|
|
72
69
|
}
|
|
73
70
|
}
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
BaseStackDescriptor,
|
|
8
8
|
BaseStackScene,
|
|
9
9
|
} from "../../../types/stack.types";
|
|
10
|
-
import {
|
|
10
|
+
import { isOverlayVisible } from "../../../utils/overlay/visibility";
|
|
11
11
|
|
|
12
12
|
export interface ProcessedRoutes<
|
|
13
13
|
TDescriptor extends BaseStackDescriptor = BaseStackDescriptor,
|
|
@@ -52,7 +52,7 @@ export function useProcessedRoutes<
|
|
|
52
52
|
animationMaps[i] = AnimationStore.getRouteAnimations(route.key);
|
|
53
53
|
|
|
54
54
|
if (!shouldShowFloatOverlay) {
|
|
55
|
-
shouldShowFloatOverlay =
|
|
55
|
+
shouldShowFloatOverlay = isOverlayVisible(options);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (!stopLimit) {
|
|
@@ -11,6 +11,8 @@ export type AnimationStoreMap = {
|
|
|
11
11
|
closing: SharedValue<number>;
|
|
12
12
|
entering: SharedValue<number>;
|
|
13
13
|
targetProgress: SharedValue<number>;
|
|
14
|
+
/** Resolved fraction (contentHeight / screenHeight) for the 'auto' snap point. -1 = not yet measured. */
|
|
15
|
+
autoSnapPoint: SharedValue<number>;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
const store: Record<ScreenKey, AnimationStoreMap> = {};
|
|
@@ -20,8 +22,9 @@ function createAnimationBag(): AnimationStoreMap {
|
|
|
20
22
|
progress: makeMutable(0),
|
|
21
23
|
closing: makeMutable(0),
|
|
22
24
|
animating: makeMutable(0),
|
|
23
|
-
entering: makeMutable(
|
|
25
|
+
entering: makeMutable(0),
|
|
24
26
|
targetProgress: makeMutable(1),
|
|
27
|
+
autoSnapPoint: makeMutable(-1),
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -47,6 +50,13 @@ function getRouteAnimation(
|
|
|
47
50
|
return ensure(routeKey)[type];
|
|
48
51
|
}
|
|
49
52
|
|
|
53
|
+
function getAnimation(
|
|
54
|
+
routeKey: ScreenKey,
|
|
55
|
+
type: keyof AnimationStoreMap,
|
|
56
|
+
): SharedValue<number> {
|
|
57
|
+
return getRouteAnimation(routeKey, type);
|
|
58
|
+
}
|
|
59
|
+
|
|
50
60
|
function getRouteAnimations(routeKey: ScreenKey): AnimationStoreMap {
|
|
51
61
|
return ensure(routeKey);
|
|
52
62
|
}
|
|
@@ -59,11 +69,13 @@ function clear(routeKey: ScreenKey) {
|
|
|
59
69
|
cancelAnimation(bag.closing);
|
|
60
70
|
cancelAnimation(bag.entering);
|
|
61
71
|
cancelAnimation(bag.targetProgress);
|
|
72
|
+
cancelAnimation(bag.autoSnapPoint);
|
|
62
73
|
}
|
|
63
74
|
delete store[routeKey];
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
export const AnimationStore = {
|
|
78
|
+
getAnimation,
|
|
67
79
|
peekRouteAnimations,
|
|
68
80
|
getRouteAnimation,
|
|
69
81
|
getRouteAnimations,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
|
|
1
2
|
import { matchesScreenKey } from "../helpers/matching";
|
|
2
3
|
import type {
|
|
3
4
|
ResolvedTransitionPair,
|
|
@@ -69,7 +70,11 @@ function findPendingLinkBySource(
|
|
|
69
70
|
function getSnapshotBoundsByPriority(
|
|
70
71
|
tag: TagID,
|
|
71
72
|
keys: (ScreenKey | undefined)[],
|
|
72
|
-
): {
|
|
73
|
+
): {
|
|
74
|
+
bounds: MeasuredDimensions;
|
|
75
|
+
styles: StyleProps;
|
|
76
|
+
screenKey: ScreenKey;
|
|
77
|
+
} | null {
|
|
73
78
|
"worklet";
|
|
74
79
|
for (let i = 0; i < keys.length; i++) {
|
|
75
80
|
const key = keys[i];
|
|
@@ -78,6 +83,7 @@ function getSnapshotBoundsByPriority(
|
|
|
78
83
|
if (!snapshot) continue;
|
|
79
84
|
return {
|
|
80
85
|
bounds: snapshot.bounds,
|
|
86
|
+
styles: snapshot.styles,
|
|
81
87
|
screenKey: key,
|
|
82
88
|
};
|
|
83
89
|
}
|
|
@@ -149,6 +155,8 @@ function resolveTransitionPair(
|
|
|
149
155
|
|
|
150
156
|
let sourceBounds = matchedLink?.source?.bounds ?? null;
|
|
151
157
|
let destinationBounds = matchedLink?.destination?.bounds ?? null;
|
|
158
|
+
let sourceStyles = matchedLink?.source?.styles ?? null;
|
|
159
|
+
let destinationStyles = matchedLink?.destination?.styles ?? null;
|
|
152
160
|
let sourceScreenKey = matchedLink?.source?.screenKey ?? null;
|
|
153
161
|
let destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
|
|
154
162
|
let usedSnapshotSource = false;
|
|
@@ -174,6 +182,7 @@ function resolveTransitionPair(
|
|
|
174
182
|
const sourceSnapshot = getSnapshotBoundsByPriority(tag, sourceFallbackKeys);
|
|
175
183
|
if (sourceSnapshot) {
|
|
176
184
|
sourceBounds = sourceSnapshot.bounds;
|
|
185
|
+
sourceStyles = sourceSnapshot.styles;
|
|
177
186
|
sourceScreenKey = sourceSnapshot.screenKey;
|
|
178
187
|
usedSnapshotSource = true;
|
|
179
188
|
}
|
|
@@ -186,6 +195,7 @@ function resolveTransitionPair(
|
|
|
186
195
|
);
|
|
187
196
|
if (destinationSnapshot) {
|
|
188
197
|
destinationBounds = destinationSnapshot.bounds;
|
|
198
|
+
destinationStyles = destinationSnapshot.styles;
|
|
189
199
|
destinationScreenKey = destinationSnapshot.screenKey;
|
|
190
200
|
usedSnapshotDestination = true;
|
|
191
201
|
}
|
|
@@ -202,6 +212,8 @@ function resolveTransitionPair(
|
|
|
202
212
|
return {
|
|
203
213
|
sourceBounds,
|
|
204
214
|
destinationBounds,
|
|
215
|
+
sourceStyles,
|
|
216
|
+
destinationStyles,
|
|
205
217
|
sourceScreenKey,
|
|
206
218
|
destinationScreenKey,
|
|
207
219
|
usedPending,
|
|
@@ -43,6 +43,8 @@ export type ResolveTransitionContext = {
|
|
|
43
43
|
export type ResolvedTransitionPair = {
|
|
44
44
|
sourceBounds: MeasuredDimensions | null;
|
|
45
45
|
destinationBounds: MeasuredDimensions | null;
|
|
46
|
+
sourceStyles: StyleProps | null;
|
|
47
|
+
destinationStyles: StyleProps | null;
|
|
46
48
|
sourceScreenKey: ScreenKey | null;
|
|
47
49
|
destinationScreenKey: ScreenKey | null;
|
|
48
50
|
usedPending: boolean;
|