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
|
@@ -1,47 +1,52 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/noNonNullAssertion: <Screen gesture is under the gesture context, so this will always exist.> */
|
|
2
|
-
import { memo,
|
|
3
|
-
import {
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import {
|
|
4
|
+
type LayoutChangeEvent,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
useWindowDimensions,
|
|
7
|
+
View,
|
|
8
|
+
} from "react-native";
|
|
4
9
|
import { GestureDetector } from "react-native-gesture-handler";
|
|
5
10
|
import Animated, {
|
|
11
|
+
runOnUI,
|
|
6
12
|
useAnimatedProps,
|
|
7
13
|
useAnimatedStyle,
|
|
8
14
|
} from "react-native-reanimated";
|
|
9
|
-
import {
|
|
10
|
-
NAVIGATION_CONTAINER_STYLE_ID,
|
|
11
|
-
NAVIGATION_MASK_STYLE_ID,
|
|
12
|
-
NO_PROPS,
|
|
13
|
-
NO_STYLES,
|
|
14
|
-
} from "../../../constants";
|
|
15
|
+
import { NO_PROPS, NO_STYLES } from "../../../constants";
|
|
15
16
|
import { useGestureContext } from "../../../providers/gestures";
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
useDescriptorDerivations,
|
|
19
|
+
useDescriptors,
|
|
20
|
+
} from "../../../providers/screen/descriptors";
|
|
17
21
|
import { useScreenStyles } from "../../../providers/screen/styles.provider";
|
|
18
|
-
import {
|
|
22
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
23
|
+
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
19
24
|
import { useBackdropPointerEvents } from "../hooks/use-backdrop-pointer-events";
|
|
25
|
+
import { MaybeMaskedNavigationContainer } from "./maybe-masked-navigation-container";
|
|
20
26
|
import { SurfaceContainer } from "./surface-container";
|
|
21
27
|
|
|
22
28
|
type Props = {
|
|
23
29
|
children: React.ReactNode;
|
|
24
30
|
};
|
|
25
31
|
|
|
26
|
-
let LazyMaskedView = View;
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
LazyMaskedView = require("@react-native-masked-view/masked-view").default;
|
|
30
|
-
} catch (_) {
|
|
31
|
-
// optional peer dependency
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let hasWarnedMissingMaskedView = false;
|
|
35
|
-
|
|
36
32
|
export const ContentLayer = memo(({ children }: Props) => {
|
|
37
33
|
const { stylesMap } = useScreenStyles();
|
|
38
34
|
const { current } = useDescriptors();
|
|
35
|
+
const { isFirstKey } = useDescriptorDerivations();
|
|
39
36
|
const { pointerEvents, isBackdropActive } = useBackdropPointerEvents();
|
|
40
37
|
const gestureContext = useGestureContext();
|
|
38
|
+
const { height: screenHeight } = useWindowDimensions();
|
|
41
39
|
const isNavigationMaskEnabled = !!current.options.maskEnabled;
|
|
42
40
|
const contentPointerEvents = isBackdropActive ? "box-none" : pointerEvents;
|
|
41
|
+
const routeKey = current.route.key;
|
|
42
|
+
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
43
|
+
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
44
|
+
routeKey,
|
|
45
|
+
"autoSnapPoint",
|
|
46
|
+
);
|
|
47
|
+
const hasAutoSnapPoint =
|
|
48
|
+
current.options.snapPoints?.includes("auto") ?? false;
|
|
43
49
|
|
|
44
|
-
// ── Content ──
|
|
45
50
|
const animatedContentStyle = useAnimatedStyle(() => {
|
|
46
51
|
"worklet";
|
|
47
52
|
return stylesMap.value.content?.style || NO_STYLES;
|
|
@@ -52,54 +57,53 @@ export const ContentLayer = memo(({ children }: Props) => {
|
|
|
52
57
|
return stylesMap.value.content?.props ?? NO_PROPS;
|
|
53
58
|
});
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
+
const handleContentLayout = useCallback(
|
|
61
|
+
(event: LayoutChangeEvent) => {
|
|
62
|
+
const contentHeight = event.nativeEvent.layout.height;
|
|
63
|
+
if (contentHeight <= 0) return;
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return stylesMap.value[NAVIGATION_MASK_STYLE_ID]?.style || NO_STYLES;
|
|
64
|
-
});
|
|
65
|
+
const fraction = Math.min(contentHeight / screenHeight, 1);
|
|
66
|
+
const transitionSpec = current.options.transitionSpec;
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
runOnUI(
|
|
69
|
+
(
|
|
70
|
+
nextFraction: number,
|
|
71
|
+
isInitialScreen: boolean,
|
|
72
|
+
spec: typeof transitionSpec,
|
|
73
|
+
) => {
|
|
74
|
+
"worklet";
|
|
75
|
+
const isFirstMeasurement = autoSnapPointValue.value <= 0;
|
|
76
|
+
autoSnapPointValue.value = nextFraction;
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
if (
|
|
79
|
+
!isFirstMeasurement ||
|
|
80
|
+
animations.progress.value !== 0 ||
|
|
81
|
+
animations.animating.value !== 0
|
|
82
|
+
) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
76
85
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{children}
|
|
99
|
-
</Animated.View>
|
|
100
|
-
)
|
|
101
|
-
) : (
|
|
102
|
-
children
|
|
86
|
+
if (isInitialScreen) {
|
|
87
|
+
animations.targetProgress.value = nextFraction;
|
|
88
|
+
animations.progress.value = nextFraction;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
animateToProgress({
|
|
93
|
+
target: nextFraction,
|
|
94
|
+
spec,
|
|
95
|
+
animations,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
)(fraction, isFirstKey, transitionSpec);
|
|
99
|
+
},
|
|
100
|
+
[
|
|
101
|
+
animations,
|
|
102
|
+
autoSnapPointValue,
|
|
103
|
+
current.options.transitionSpec,
|
|
104
|
+
isFirstKey,
|
|
105
|
+
screenHeight,
|
|
106
|
+
],
|
|
103
107
|
);
|
|
104
108
|
|
|
105
109
|
return (
|
|
@@ -109,9 +113,17 @@ export const ContentLayer = memo(({ children }: Props) => {
|
|
|
109
113
|
animatedProps={animatedContentProps}
|
|
110
114
|
pointerEvents={contentPointerEvents}
|
|
111
115
|
>
|
|
112
|
-
<
|
|
113
|
-
{
|
|
114
|
-
|
|
116
|
+
<MaybeMaskedNavigationContainer enabled={isNavigationMaskEnabled}>
|
|
117
|
+
<SurfaceContainer pointerEvents={contentPointerEvents}>
|
|
118
|
+
{hasAutoSnapPoint ? (
|
|
119
|
+
<View collapsable={false} onLayout={handleContentLayout}>
|
|
120
|
+
{children}
|
|
121
|
+
</View>
|
|
122
|
+
) : (
|
|
123
|
+
children
|
|
124
|
+
)}
|
|
125
|
+
</SurfaceContainer>
|
|
126
|
+
</MaybeMaskedNavigationContainer>
|
|
115
127
|
</Animated.View>
|
|
116
128
|
</GestureDetector>
|
|
117
129
|
);
|
|
@@ -121,13 +133,4 @@ const styles = StyleSheet.create({
|
|
|
121
133
|
content: {
|
|
122
134
|
flex: 1,
|
|
123
135
|
},
|
|
124
|
-
navigationMaskedRoot: {
|
|
125
|
-
flex: 1,
|
|
126
|
-
},
|
|
127
|
-
navigationMaskElement: {
|
|
128
|
-
backgroundColor: "white",
|
|
129
|
-
},
|
|
130
|
-
navigationContainer: {
|
|
131
|
-
flex: 1,
|
|
132
|
-
},
|
|
133
136
|
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { memo, useEffect } from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
+
import {
|
|
5
|
+
NAVIGATION_CONTAINER_STYLE_ID,
|
|
6
|
+
NAVIGATION_MASK_STYLE_ID,
|
|
7
|
+
NO_STYLES,
|
|
8
|
+
} from "../../../constants";
|
|
9
|
+
import { useScreenStyles } from "../../../providers/screen/styles.provider";
|
|
10
|
+
import { logger } from "../../../utils/logger";
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let LazyMaskedView = View;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
LazyMaskedView = require("@react-native-masked-view/masked-view").default;
|
|
21
|
+
} catch (_) {
|
|
22
|
+
// optional peer dependency
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let hasWarnedMissingMaskedView = false;
|
|
26
|
+
|
|
27
|
+
export const MaybeMaskedNavigationContainer = memo(
|
|
28
|
+
({ enabled, children }: Props) => {
|
|
29
|
+
const { stylesMap } = useScreenStyles();
|
|
30
|
+
const animatedNavigationContainerStyle = useAnimatedStyle(() => {
|
|
31
|
+
"worklet";
|
|
32
|
+
return stylesMap.value[NAVIGATION_CONTAINER_STYLE_ID]?.style || NO_STYLES;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const animatedNavigationMaskStyle = useAnimatedStyle(() => {
|
|
36
|
+
"worklet";
|
|
37
|
+
return stylesMap.value[NAVIGATION_MASK_STYLE_ID]?.style || NO_STYLES;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!enabled) return;
|
|
42
|
+
if (LazyMaskedView !== View) return;
|
|
43
|
+
if (hasWarnedMissingMaskedView) return;
|
|
44
|
+
|
|
45
|
+
hasWarnedMissingMaskedView = true;
|
|
46
|
+
logger.warn(
|
|
47
|
+
"maskEnabled requires @react-native-masked-view/masked-view. Install it to enable navigation bounds masking.",
|
|
48
|
+
);
|
|
49
|
+
}, [enabled]);
|
|
50
|
+
|
|
51
|
+
if (!enabled) return children;
|
|
52
|
+
|
|
53
|
+
if (LazyMaskedView === View) {
|
|
54
|
+
return (
|
|
55
|
+
<Animated.View
|
|
56
|
+
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</Animated.View>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<LazyMaskedView
|
|
65
|
+
style={styles.navigationMaskedRoot}
|
|
66
|
+
// @ts-expect-error masked-view package types are too strict here
|
|
67
|
+
maskElement={
|
|
68
|
+
<Animated.View
|
|
69
|
+
style={[styles.navigationMaskElement, animatedNavigationMaskStyle]}
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<Animated.View
|
|
74
|
+
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</Animated.View>
|
|
78
|
+
</LazyMaskedView>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
navigationMaskedRoot: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
},
|
|
87
|
+
navigationMaskElement: {
|
|
88
|
+
backgroundColor: "white",
|
|
89
|
+
},
|
|
90
|
+
navigationContainer: {
|
|
91
|
+
flex: 1,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { useLayoutEffect } from "react";
|
|
2
2
|
import type { BaseDescriptor } from "../../../providers/screen/descriptors";
|
|
3
3
|
import type { AnimationStoreMap } from "../../../stores/animation.store";
|
|
4
|
+
import type { SnapPoint } from "../../../types/screen.types";
|
|
4
5
|
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
5
6
|
import { useHighRefreshRate } from "./use-high-refresh-rate";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Calculates the initial progress value based on snap points configuration.
|
|
10
|
+
* Returns `'auto'` if the initial snap point is the `'auto'` keyword
|
|
11
|
+
* (meaning the animation must be deferred until content is measured).
|
|
9
12
|
*/
|
|
10
13
|
function getInitialProgress({
|
|
11
14
|
snapPoints,
|
|
12
15
|
initialSnapIndex,
|
|
13
16
|
}: {
|
|
14
|
-
snapPoints?:
|
|
17
|
+
snapPoints?: SnapPoint[];
|
|
15
18
|
initialSnapIndex: number;
|
|
16
|
-
}): number | undefined {
|
|
19
|
+
}): number | "auto" | undefined {
|
|
17
20
|
if (!snapPoints) {
|
|
18
21
|
return undefined;
|
|
19
22
|
}
|
|
@@ -41,14 +44,25 @@ export function useOpenTransition(
|
|
|
41
44
|
useLayoutEffect(() => {
|
|
42
45
|
const { snapPoints, initialSnapIndex = 0 } = current.options;
|
|
43
46
|
const targetProgress = getInitialProgress({ snapPoints, initialSnapIndex });
|
|
44
|
-
const target = targetProgress ?? 1;
|
|
45
47
|
|
|
46
48
|
if (isFirstKey) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
if (targetProgress === "auto") {
|
|
50
|
+
animations.targetProgress.set(0);
|
|
51
|
+
animations.progress.set(0);
|
|
52
|
+
} else {
|
|
53
|
+
const target = targetProgress ?? 1;
|
|
54
|
+
animations.targetProgress.set(target);
|
|
55
|
+
animations.progress.set(target);
|
|
56
|
+
}
|
|
49
57
|
animations.animating.set(0);
|
|
50
58
|
animations.closing.set(0);
|
|
51
|
-
animations.entering.set(
|
|
59
|
+
animations.entering.set(0);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// When the initial snap point is 'auto', defer the opening animation until
|
|
64
|
+
// ScreenContainer has measured the content and set autoSnapPoint.
|
|
65
|
+
if (targetProgress === "auto") {
|
|
52
66
|
return;
|
|
53
67
|
}
|
|
54
68
|
|
package/src/shared/constants.ts
CHANGED
|
@@ -11,6 +11,10 @@ import type { BaseStackRoute } from "./types/stack.types";
|
|
|
11
11
|
*/
|
|
12
12
|
export const MASK_STYLE_ID = "_ROOT_MASKED";
|
|
13
13
|
export const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Navigation mask integration
|
|
17
|
+
*/
|
|
14
18
|
export const NAVIGATION_MASK_HOST_FLAG_STYLE_ID = "_NAVIGATION_MASK_HOST";
|
|
15
19
|
export const NAVIGATION_MASK_STYLE_ID = "_NAVIGATION_ROOT_MASK";
|
|
16
20
|
export const NAVIGATION_CONTAINER_STYLE_ID = "_NAVIGATION_ROOT_CONTAINER";
|
|
@@ -51,7 +55,7 @@ export const createScreenTransitionState = (
|
|
|
51
55
|
closing: 0,
|
|
52
56
|
animating: 0,
|
|
53
57
|
settled: 1,
|
|
54
|
-
entering:
|
|
58
|
+
entering: 0,
|
|
55
59
|
gesture: { ...DEFAULT_GESTURE_VALUES },
|
|
56
60
|
route,
|
|
57
61
|
meta,
|
|
@@ -66,7 +70,7 @@ export const DEFAULT_SCREEN_TRANSITION_STATE: ScreenTransitionState =
|
|
|
66
70
|
closing: 0,
|
|
67
71
|
animating: 0,
|
|
68
72
|
settled: 1,
|
|
69
|
-
entering:
|
|
73
|
+
entering: 0,
|
|
70
74
|
gesture: DEFAULT_GESTURE_VALUES,
|
|
71
75
|
route: {} as RouteProp<ParamListBase>,
|
|
72
76
|
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { GestureContextType } from "../../providers/gestures";
|
|
2
|
+
import type { ScreenGestureTarget } from "./types";
|
|
3
|
+
|
|
4
|
+
type ScreenGestureRef = GestureContextType["panGestureRef"] | null;
|
|
5
|
+
|
|
6
|
+
type Params = {
|
|
7
|
+
target: ScreenGestureTarget | undefined;
|
|
8
|
+
self: GestureContextType | null | undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const isAncestorTarget = (
|
|
12
|
+
target: ScreenGestureTarget,
|
|
13
|
+
): target is { ancestor: number } => {
|
|
14
|
+
return typeof target === "object" && target !== null && "ancestor" in target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function getGestureAncestors(self: GestureContextType): GestureContextType[] {
|
|
18
|
+
const ancestors: GestureContextType[] = [];
|
|
19
|
+
const startIsolated = self.isIsolated;
|
|
20
|
+
let current = self.ancestorContext;
|
|
21
|
+
|
|
22
|
+
while (current) {
|
|
23
|
+
if (current.isIsolated !== startIsolated) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ancestors.push(current);
|
|
28
|
+
current = current.ancestorContext;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return ancestors;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function resolveScreenGestureTarget({
|
|
35
|
+
target,
|
|
36
|
+
self,
|
|
37
|
+
}: Params): ScreenGestureRef {
|
|
38
|
+
if (!self) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!target || target === "self") {
|
|
43
|
+
return self.panGestureRef ?? null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const ancestors = getGestureAncestors(self);
|
|
47
|
+
|
|
48
|
+
if (target === "parent") {
|
|
49
|
+
return ancestors[0]?.panGestureRef ?? null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (target === "root") {
|
|
53
|
+
return ancestors[ancestors.length - 1]?.panGestureRef ?? null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!isAncestorTarget(target)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const depth = target.ancestor;
|
|
61
|
+
if (!Number.isInteger(depth) || depth < 1) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return ancestors[depth - 1]?.panGestureRef ?? null;
|
|
66
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useGestureContext } from "../../providers/gestures";
|
|
2
|
+
import { resolveScreenGestureTarget } from "./resolve-screen-gesture-target";
|
|
3
|
+
import type { ScreenGestureTarget } from "./types";
|
|
4
|
+
|
|
5
|
+
export type { ScreenGestureTarget } from "./types";
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
|
-
* Returns a ref to
|
|
8
|
+
* Returns a ref to a screen navigation pan gesture.
|
|
5
9
|
* Use this to coordinate child gestures with the navigation gesture.
|
|
6
10
|
*
|
|
7
11
|
* @example
|
|
@@ -13,7 +17,10 @@ import { useGestureContext } from "../../providers/gestures";
|
|
|
13
17
|
* .onUpdate(...);
|
|
14
18
|
* ```
|
|
15
19
|
*/
|
|
16
|
-
export const useScreenGesture = () => {
|
|
20
|
+
export const useScreenGesture = (target?: ScreenGestureTarget) => {
|
|
17
21
|
const ctx = useGestureContext();
|
|
18
|
-
return
|
|
22
|
+
return resolveScreenGestureTarget({
|
|
23
|
+
target,
|
|
24
|
+
self: ctx,
|
|
25
|
+
});
|
|
19
26
|
};
|
|
@@ -2,7 +2,7 @@ import type { Route } from "@react-navigation/native";
|
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
import type { DerivedValue } from "react-native-reanimated";
|
|
4
4
|
import type { StackCoreContextValue } from "../../providers/stack/core.provider";
|
|
5
|
-
import type {
|
|
5
|
+
import type { OverlayProps } from "../../types/overlay.types";
|
|
6
6
|
import type {
|
|
7
7
|
BaseStackDescriptor,
|
|
8
8
|
BaseStackNavigation,
|
|
@@ -16,7 +16,6 @@ export interface StackDescriptor<
|
|
|
16
16
|
> extends BaseStackDescriptor<TRoute, TNavigation> {
|
|
17
17
|
options: BaseStackDescriptor["options"] & {
|
|
18
18
|
overlay?: (props: OverlayProps) => React.ReactNode;
|
|
19
|
-
overlayMode?: OverlayMode;
|
|
20
19
|
overlayShown?: boolean;
|
|
21
20
|
meta?: Record<string, unknown>;
|
|
22
21
|
enableTransitions?: boolean;
|
package/src/shared/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Boundary,
|
|
4
4
|
createBoundaryComponent,
|
|
5
5
|
} from "./components/create-boundary-component";
|
|
6
|
-
import { buildBoundaryMatchKey } from "./components/create-boundary-component/utils/build-boundary-match-key";
|
|
7
6
|
import { createTransitionAwareComponent } from "./components/create-transition-aware-component";
|
|
8
7
|
import MaskedView from "./components/integrations/masked-view";
|
|
9
8
|
import { Presets, Specs } from "./configs";
|
|
@@ -26,36 +25,35 @@ export default {
|
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
export { snapTo } from "./animation/snap-to";
|
|
29
|
-
export {
|
|
28
|
+
export {
|
|
29
|
+
NAVIGATION_CONTAINER_STYLE_ID,
|
|
30
|
+
NAVIGATION_MASK_HOST_FLAG_STYLE_ID,
|
|
31
|
+
NAVIGATION_MASK_STYLE_ID,
|
|
32
|
+
} from "./constants";
|
|
33
|
+
export {
|
|
34
|
+
type ScreenGestureTarget,
|
|
35
|
+
useScreenGesture,
|
|
36
|
+
} from "./hooks/gestures/use-screen-gesture";
|
|
30
37
|
export { useHistory } from "./hooks/navigation/use-history";
|
|
31
38
|
export {
|
|
32
39
|
type ScreenState,
|
|
33
40
|
useScreenState,
|
|
34
41
|
} from "./hooks/navigation/use-screen-state";
|
|
35
|
-
export {
|
|
36
|
-
|
|
42
|
+
export {
|
|
43
|
+
type ScreenAnimationTarget,
|
|
44
|
+
useScreenAnimation,
|
|
45
|
+
} from "./providers/screen/animation";
|
|
37
46
|
|
|
38
47
|
export type {
|
|
39
48
|
AnimatedViewStyle,
|
|
40
49
|
AnimationConfig,
|
|
41
|
-
BoundEntry,
|
|
42
|
-
BoundsLink,
|
|
43
50
|
BoundsNavigationAccessor,
|
|
44
|
-
|
|
45
|
-
BoundsNavigationPreset,
|
|
46
|
-
BoundsStyleOptions,
|
|
47
|
-
LegacyTransitionInterpolatedStyle,
|
|
48
|
-
NewTransitionInterpolatedStyle,
|
|
49
|
-
NormalizedTransitionInterpolatedStyle,
|
|
50
|
-
NormalizedTransitionSlotStyle,
|
|
51
|
-
OverlayInterpolationProps,
|
|
52
|
-
OverlayMode,
|
|
51
|
+
BoundsNavigationZoomOptions,
|
|
53
52
|
OverlayProps,
|
|
54
53
|
ScreenInterpolationProps,
|
|
55
54
|
ScreenStyleInterpolator,
|
|
56
55
|
ScreenTransitionConfig,
|
|
57
56
|
TransitionInterpolatedStyle,
|
|
58
|
-
TransitionSlotExplicit,
|
|
59
57
|
TransitionSlotStyle,
|
|
60
58
|
TransitionSpec,
|
|
61
59
|
} from "./types";
|