react-native-screen-transitions 3.4.0-alpha.0 → 3.4.0-alpha.2
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 +11 -1046
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +69 -2
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +9 -0
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js.map +1 -1
- 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/hooks/helpers/measurement-rules.js +195 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -14
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +19 -18
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +54 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +40 -8
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +72 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +16 -7
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +7 -4
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +14 -15
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +27 -9
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/index.js +22 -8
- package/lib/commonjs/shared/components/create-boundary-component/index.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/create-transition-aware-component.js +3 -2
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen-container.js +12 -6
- package/lib/commonjs/shared/components/native-screen-container.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen.js +35 -8
- package/lib/commonjs/shared/components/native-screen.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/hooks/use-content-layout.js +60 -0
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- 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 +16 -56
- 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 +86 -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 +61 -25
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-activation.js +11 -6
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-activation.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/layout-anchor.provider.js +4 -6
- package/lib/commonjs/shared/providers/layout-anchor.provider.js.map +1 -1
- 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 +25 -13
- 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/core.provider.js +14 -21
- package/lib/commonjs/shared/providers/stack/core.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +10 -2
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/presence.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 +33 -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 +4 -8
- 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 +13 -3
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js +6 -0
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js.map +1 -0
- 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 +548 -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/commonjs/shared/utils/resolve-screen-transition-options.js +25 -0
- package/lib/commonjs/shared/utils/resolve-screen-transition-options.js.map +1 -0
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +69 -3
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +9 -0
- package/lib/module/component-stack/navigators/create-component-stack-navigator.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/hooks/helpers/measurement-rules.js +182 -0
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -14
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +19 -18
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +49 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +41 -8
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +67 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +16 -7
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +7 -4
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +14 -15
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +27 -9
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/index.js +22 -8
- package/lib/module/shared/components/create-boundary-component/index.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/create-transition-aware-component.js +3 -2
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/native-screen-container.js +12 -6
- package/lib/module/shared/components/native-screen-container.js.map +1 -1
- package/lib/module/shared/components/native-screen.js +35 -8
- package/lib/module/shared/components/native-screen.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/hooks/use-content-layout.js +56 -0
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- 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 +18 -58
- 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 +81 -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 +61 -25
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-activation.js +11 -6
- package/lib/module/shared/providers/gestures/helpers/gesture-activation.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/layout-anchor.provider.js +4 -6
- package/lib/module/shared/providers/layout-anchor.provider.js.map +1 -1
- 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 +25 -13
- 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/core.provider.js +14 -21
- package/lib/module/shared/providers/stack/core.provider.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 +10 -2
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/presence.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 +33 -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 +4 -8
- 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 +13 -3
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/types/frame-props.js +4 -0
- package/lib/module/shared/utils/bounds/types/frame-props.js.map +1 -0
- 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 +543 -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/module/shared/utils/resolve-screen-transition-options.js +19 -0
- package/lib/module/shared/utils/resolve-screen-transition-options.js.map +1 -0
- package/lib/typescript/blank-stack/index.d.ts +1 -1
- package/lib/typescript/blank-stack/index.d.ts.map +1 -1
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +29 -4
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +33 -4
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +8 -0
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +81 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +2 -3
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +11 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +11 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +3 -3
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +5 -3
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts +2 -4
- package/lib/typescript/shared/components/create-boundary-component/types.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/create-transition-aware-component.d.ts +1 -0
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen.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/hooks/use-content-layout.d.ts +3 -0
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -0
- 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 +9 -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 -18
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/helpers/gesture-activation.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/layout-anchor.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts.map +1 -1
- 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/core.provider.d.ts +2 -0
- package/lib/typescript/shared/providers/stack/core.provider.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 +8 -2
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/presence.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 +33 -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 +62 -37
- 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 +2 -2
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts +5 -0
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts.map +1 -0
- 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/lib/typescript/shared/utils/resolve-screen-transition-options.d.ts +5 -0
- package/lib/typescript/shared/utils/resolve-screen-transition-options.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/blank-stack/index.ts +1 -0
- package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +138 -19
- package/src/blank-stack/types.ts +33 -5
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +8 -0
- package/src/shared/animation/snap-to.ts +12 -1
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +258 -0
- package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +7 -17
- package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +38 -28
- package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +58 -0
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +41 -10
- package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +82 -0
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +24 -12
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +11 -9
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +29 -26
- package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +26 -17
- package/src/shared/components/create-boundary-component/index.tsx +25 -6
- package/src/shared/components/create-boundary-component/types.ts +8 -4
- package/src/shared/components/create-boundary-component/utils/build-boundary-match-key.ts +2 -14
- package/src/shared/components/create-transition-aware-component.tsx +5 -2
- package/src/shared/components/native-screen-container.tsx +11 -3
- package/src/shared/components/native-screen.tsx +65 -20
- 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/hooks/use-content-layout.ts +82 -0
- package/src/shared/components/screen-container/layers/backdrop.tsx +25 -6
- package/src/shared/components/screen-container/layers/content.tsx +23 -82
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +101 -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 +75 -29
- package/src/shared/providers/gestures/helpers/gesture-activation.ts +11 -6
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +72 -0
- package/src/shared/providers/layout-anchor.provider.tsx +2 -5
- package/src/shared/providers/register-bounds.provider.tsx +1 -1
- 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 +51 -14
- 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/core.provider.tsx +27 -14
- 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 +21 -5
- package/src/shared/stores/bounds/internals/presence.ts +3 -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 +32 -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 +67 -38
- 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 +47 -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 +7 -10
- package/src/shared/utils/bounds/helpers/style-composers.ts +4 -3
- package/src/shared/utils/bounds/index.ts +22 -13
- package/src/shared/utils/bounds/types/frame-props.ts +5 -0
- 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 +715 -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/src/shared/utils/resolve-screen-transition-options.ts +37 -0
- 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/providers/viewport.provider.js +0 -33
- package/lib/commonjs/shared/providers/viewport.provider.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/providers/viewport.provider.js +0 -27
- package/lib/module/shared/providers/viewport.provider.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/providers/viewport.provider.d.ts +0 -13
- package/lib/typescript/shared/providers/viewport.provider.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/providers/viewport.provider.tsx +0 -39
- 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
package/README.md
CHANGED
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
# react-native-screen-transitions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gesture-driven screen transitions, shared bounds, presets, and custom animation hooks for React Native and Expo.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
| --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
-
| <video src="https://github.com/user-attachments/assets/c0d17b8f-7268-421c-9051-e242f8ddca76" width="300" height="600" controls></video> | <video src="https://github.com/user-attachments/assets/3f8d5fb1-96d2-4fe3-860d-62f6fb5a687e" width="300" controls></video> |
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- **Full Animation Control** – Define exactly how screens enter, exit, and respond to gestures
|
|
12
|
-
- **Shared Elements** – Smooth transitions between screens using `Transition.Boundary` and the Bounds API
|
|
13
|
-
- **Navigation Bounds** – SwiftUI-like zoom transitions with masked reveal effects via `bounds().navigation.zoom()`
|
|
14
|
-
- **Gesture Support** – Swipe-to-dismiss with edge or full-screen activation, configurable velocity
|
|
15
|
-
- **Animated Props** – Drive component-specific props (e.g., BlurView `intensity`) alongside styles
|
|
16
|
-
- **Custom Layers** – `surfaceComponent` and `backdropComponent` with animated styles and props
|
|
17
|
-
- **Stack Progress** – Track animation progress across the entire stack
|
|
18
|
-
- **Ready-Made Presets** – Instagram, Apple Music, X (Twitter), zoom navigation style transitions included
|
|
19
|
-
|
|
20
|
-
## When to Use This Library
|
|
21
|
-
|
|
22
|
-
| Use Case | This Library | Alternative |
|
|
23
|
-
|----------|--------------|-------------|
|
|
24
|
-
| Custom transitions (slide, zoom, fade variations) | Yes | `@react-navigation/stack` works too |
|
|
25
|
-
| Shared element transitions | **Yes** | Limited options elsewhere |
|
|
26
|
-
| Multi-stop sheets (bottom, top, side) with snap points | **Yes** | Dedicated sheet libraries |
|
|
27
|
-
| Gesture-driven animations (drag to dismiss, elastic) | **Yes** | Requires custom implementation |
|
|
28
|
-
| Instagram/Apple Music/Twitter-style transitions | **Yes** | Custom implementation |
|
|
29
|
-
| Simple push/pop with platform defaults | Overkill | `@react-navigation/native-stack` |
|
|
30
|
-
| Maximum raw performance on low-end devices | Not ideal | `@react-navigation/native-stack` |
|
|
31
|
-
|
|
32
|
-
**Choose this library when** you need custom animations, shared elements, or gesture-driven transitions that go beyond platform defaults.
|
|
33
|
-
|
|
34
|
-
**Choose native-stack when** you want platform-native transitions with zero configuration and maximum performance on low-end Android devices.
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
5
|
+
## Install
|
|
37
6
|
|
|
38
7
|
```bash
|
|
39
8
|
npm install react-native-screen-transitions
|
|
40
9
|
```
|
|
41
10
|
|
|
42
|
-
|
|
11
|
+
Peer dependencies:
|
|
43
12
|
|
|
44
13
|
```bash
|
|
45
14
|
npm install react-native-reanimated react-native-gesture-handler \
|
|
@@ -48,19 +17,15 @@ npm install react-native-reanimated react-native-gesture-handler \
|
|
|
48
17
|
react-native-safe-area-context
|
|
49
18
|
```
|
|
50
19
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Quick Start
|
|
54
|
-
|
|
55
|
-
### 1. Create a Stack
|
|
20
|
+
## Quickstart
|
|
56
21
|
|
|
57
22
|
```tsx
|
|
58
|
-
import { createBlankStackNavigator } from "react-native-screen-transitions/blank-stack";
|
|
59
23
|
import Transition from "react-native-screen-transitions";
|
|
24
|
+
import { createBlankStackNavigator } from "react-native-screen-transitions/blank-stack";
|
|
60
25
|
|
|
61
26
|
const Stack = createBlankStackNavigator();
|
|
62
27
|
|
|
63
|
-
function
|
|
28
|
+
export function AppStack() {
|
|
64
29
|
return (
|
|
65
30
|
<Stack.Navigator>
|
|
66
31
|
<Stack.Screen name="Home" component={HomeScreen} />
|
|
@@ -76,1009 +41,9 @@ function App() {
|
|
|
76
41
|
}
|
|
77
42
|
```
|
|
78
43
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```tsx
|
|
82
|
-
import { withLayoutContext } from "expo-router";
|
|
83
|
-
import {
|
|
84
|
-
createBlankStackNavigator,
|
|
85
|
-
type BlankStackNavigationOptions,
|
|
86
|
-
} from "react-native-screen-transitions/blank-stack";
|
|
87
|
-
|
|
88
|
-
const { Navigator } = createBlankStackNavigator();
|
|
89
|
-
|
|
90
|
-
export const Stack = withLayoutContext<
|
|
91
|
-
BlankStackNavigationOptions,
|
|
92
|
-
typeof Navigator
|
|
93
|
-
>(Navigator);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Presets
|
|
99
|
-
|
|
100
|
-
Use built-in presets for common transitions:
|
|
101
|
-
|
|
102
|
-
```tsx
|
|
103
|
-
<Stack.Screen
|
|
104
|
-
name="Detail"
|
|
105
|
-
options={{
|
|
106
|
-
...Transition.Presets.SlideFromBottom(),
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
| Preset | Description |
|
|
112
|
-
| -------------------------------------- | --------------------------------------- |
|
|
113
|
-
| `SlideFromTop()` | Slides in from top |
|
|
114
|
-
| `SlideFromBottom()` | Slides in from bottom (modal-style) |
|
|
115
|
-
| `ZoomIn()` | Scales in with fade |
|
|
116
|
-
| `DraggableCard()` | Multi-directional drag with scaling |
|
|
117
|
-
| `ElasticCard()` | Elastic drag with overlay |
|
|
118
|
-
| `SharedIGImage({ sharedBoundTag })` | Instagram-style shared image |
|
|
119
|
-
| `SharedAppleMusic({ sharedBoundTag })` | Apple Music-style shared element |
|
|
120
|
-
| `SharedXImage({ sharedBoundTag })` | X (Twitter)-style image transition |
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Custom Animations
|
|
125
|
-
|
|
126
|
-
### The Basics
|
|
127
|
-
|
|
128
|
-
Every screen has a `progress` value that goes from 0 → 1 → 2:
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
0 ─────────── 1 ─────────── 2
|
|
132
|
-
entering visible exiting
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
When navigating from A to B:
|
|
136
|
-
- **Screen B**: progress goes `0 → 1` (entering)
|
|
137
|
-
- **Screen A**: progress goes `1 → 2` (exiting)
|
|
138
|
-
|
|
139
|
-
### Simple Fade
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
options={{
|
|
143
|
-
screenStyleInterpolator: ({ progress }) => {
|
|
144
|
-
"worklet";
|
|
145
|
-
return {
|
|
146
|
-
content: {
|
|
147
|
-
style: {
|
|
148
|
-
opacity: interpolate(progress, [0, 1, 2], [0, 1, 0]),
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
}}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Slide from Right
|
|
157
|
-
|
|
158
|
-
```tsx
|
|
159
|
-
options={{
|
|
160
|
-
screenStyleInterpolator: ({ progress, layouts: { screen } }) => {
|
|
161
|
-
"worklet";
|
|
162
|
-
return {
|
|
163
|
-
content: {
|
|
164
|
-
style: {
|
|
165
|
-
transform: [{
|
|
166
|
-
translateX: interpolate(
|
|
167
|
-
progress,
|
|
168
|
-
[0, 1, 2],
|
|
169
|
-
[screen.width, 0, -screen.width * 0.3]
|
|
170
|
-
),
|
|
171
|
-
}],
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
},
|
|
176
|
-
}}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Slide from Bottom with Backdrop
|
|
180
|
-
|
|
181
|
-
```tsx
|
|
182
|
-
options={{
|
|
183
|
-
screenStyleInterpolator: ({ progress, layouts: { screen } }) => {
|
|
184
|
-
"worklet";
|
|
185
|
-
return {
|
|
186
|
-
content: {
|
|
187
|
-
style: {
|
|
188
|
-
transform: [{
|
|
189
|
-
translateY: interpolate(progress, [0, 1], [screen.height, 0]),
|
|
190
|
-
}],
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
backdrop: {
|
|
194
|
-
style: {
|
|
195
|
-
backgroundColor: "black",
|
|
196
|
-
opacity: interpolate(progress, [0, 1], [0, 0.5]),
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
},
|
|
201
|
-
}}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Return Format
|
|
205
|
-
|
|
206
|
-
Your interpolator returns a map of **slots**. The canonical format is explicit `{ style, props }`:
|
|
207
|
-
|
|
208
|
-
```tsx
|
|
209
|
-
return {
|
|
210
|
-
content: {
|
|
211
|
-
style: { opacity: 1 },
|
|
212
|
-
}, // Main screen content
|
|
213
|
-
backdrop: {
|
|
214
|
-
style: { opacity: 0.5 },
|
|
215
|
-
props: { intensity: 80 }, // for components like BlurView
|
|
216
|
-
}, // Backdrop layer between screens
|
|
217
|
-
surface: {
|
|
218
|
-
style: { transform: [{ scale: 0.98 }] },
|
|
219
|
-
}, // Surface component layer
|
|
220
|
-
["hero-image"]: {
|
|
221
|
-
style: { borderRadius: 24 },
|
|
222
|
-
}, // Specific element via styleId
|
|
223
|
-
};
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Shorthand styles are still supported and auto-wrapped as `{ style: value }`:
|
|
227
|
-
|
|
228
|
-
```tsx
|
|
229
|
-
// Shorthand
|
|
230
|
-
content: {
|
|
231
|
-
opacity: 0.5,
|
|
232
|
-
transform: [{ scale: 0.9 }],
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
// Explicit
|
|
236
|
-
content: {
|
|
237
|
-
style: { opacity: 0.5, transform: [{ scale: 0.9 }] },
|
|
238
|
-
props: { intensity: 80 }, // for useAnimatedProps (e.g., BlurView)
|
|
239
|
-
},
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
> **Legacy format**: The flat `contentStyle`/`backdropStyle` format is still supported but deprecated. It will be auto-converted with a one-time warning in development.
|
|
243
|
-
|
|
244
|
-
### Animation Specs
|
|
245
|
-
|
|
246
|
-
Control timing with spring configs:
|
|
247
|
-
|
|
248
|
-
```tsx
|
|
249
|
-
options={{
|
|
250
|
-
screenStyleInterpolator: myInterpolator,
|
|
251
|
-
transitionSpec: {
|
|
252
|
-
open: { stiffness: 1000, damping: 500, mass: 3 }, // Screen enters
|
|
253
|
-
close: { stiffness: 1000, damping: 500, mass: 3 }, // Screen exits
|
|
254
|
-
expand: { stiffness: 300, damping: 30 }, // Snap point increases
|
|
255
|
-
collapse: { stiffness: 300, damping: 30 }, // Snap point decreases
|
|
256
|
-
},
|
|
257
|
-
}}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Gestures
|
|
263
|
-
|
|
264
|
-
Enable swipe-to-dismiss:
|
|
265
|
-
|
|
266
|
-
```tsx
|
|
267
|
-
options={{
|
|
268
|
-
gestureEnabled: true,
|
|
269
|
-
gestureDirection: "vertical",
|
|
270
|
-
...Transition.Presets.SlideFromBottom(),
|
|
271
|
-
}}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Gesture Options
|
|
275
|
-
|
|
276
|
-
| Option | Description |
|
|
277
|
-
| ------------------------------- | ------------------------------------------------------------------------ |
|
|
278
|
-
| `gestureEnabled` | Enable swipe-to-dismiss (snap sheets: `false` blocks dismiss-to-0 only) |
|
|
279
|
-
| `gestureDirection` | Direction(s) for swipe gesture |
|
|
280
|
-
| `gestureActivationArea` | Where gesture can start |
|
|
281
|
-
| `gestureResponseDistance` | Pixel threshold for activation |
|
|
282
|
-
| `gestureVelocityImpact` | How much velocity affects dismissal (default: 0.3) |
|
|
283
|
-
| `gestureDrivesProgress` | Whether gesture controls animation progress (default: true) |
|
|
284
|
-
| `snapVelocityImpact` | How much velocity affects snap targeting (default: 0.1, lower = iOS-like)|
|
|
285
|
-
| `gestureReleaseVelocityScale` | Multiplier for post-release spring velocity (default: 1) |
|
|
286
|
-
| `gestureReleaseVelocityMax` | Cap on post-release spring velocity (default: 3.2) |
|
|
287
|
-
| `expandViaScrollView` | Allow expansion from ScrollView at boundary (default: true) |
|
|
288
|
-
| `gestureSnapLocked` | Lock gesture-based snap movement to current snap point |
|
|
289
|
-
| `backdropBehavior` | Touch handling for backdrop area |
|
|
290
|
-
| `backdropComponent` | Custom backdrop component, driven by interpolator `backdrop` slot |
|
|
291
|
-
| `surfaceComponent` | Custom surface component, driven by interpolator `surface` slot |
|
|
292
|
-
| `maskEnabled` | Pre-mount masked view wrapper for navigation bounds masking |
|
|
293
|
-
|
|
294
|
-
### Gesture Direction
|
|
295
|
-
|
|
296
|
-
```tsx
|
|
297
|
-
gestureDirection: "horizontal" // swipe left to dismiss
|
|
298
|
-
gestureDirection: "horizontal-inverted" // swipe right to dismiss
|
|
299
|
-
gestureDirection: "vertical" // swipe down to dismiss
|
|
300
|
-
gestureDirection: "vertical-inverted" // swipe up to dismiss
|
|
301
|
-
gestureDirection: "bidirectional" // any direction
|
|
302
|
-
|
|
303
|
-
// Or combine multiple:
|
|
304
|
-
gestureDirection: ["horizontal", "vertical"]
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Gesture Activation Area
|
|
308
|
-
|
|
309
|
-
```tsx
|
|
310
|
-
// Simple - same for all edges
|
|
311
|
-
gestureActivationArea: "edge" // only from screen edges
|
|
312
|
-
gestureActivationArea: "screen" // anywhere on screen
|
|
313
|
-
|
|
314
|
-
// Per-side configuration
|
|
315
|
-
gestureActivationArea: {
|
|
316
|
-
left: "edge",
|
|
317
|
-
right: "screen",
|
|
318
|
-
top: "edge",
|
|
319
|
-
bottom: "screen",
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### With ScrollViews
|
|
324
|
-
|
|
325
|
-
Use transition-aware scrollables so gestures work correctly:
|
|
326
|
-
|
|
327
|
-
```tsx
|
|
328
|
-
<Transition.ScrollView>
|
|
329
|
-
{/* content */}
|
|
330
|
-
</Transition.ScrollView>
|
|
331
|
-
|
|
332
|
-
<Transition.FlatList data={items} renderItem={...} />
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Gesture rules with scrollables:
|
|
336
|
-
- **vertical** – only activates when scrolled to top
|
|
337
|
-
- **vertical-inverted** – only activates when scrolled to bottom
|
|
338
|
-
- **horizontal** – only activates at left/right scroll edges
|
|
339
|
-
|
|
340
|
-
`Transition.ScrollView` and `Transition.FlatList` also emit a settled signal (on momentum end, or drag end with no momentum). Grouped boundaries listen for that signal and re-measure source bounds while idle, which keeps list/detail shared transitions accurate after focus-change auto-scrolling.
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## Snap Points
|
|
345
|
-
|
|
346
|
-
Create multi-stop sheets that snap to defined positions. Works with any gesture direction (bottom sheets, top sheets, side sheets):
|
|
347
|
-
|
|
348
|
-
### Basic Configuration
|
|
349
|
-
|
|
350
|
-
```tsx
|
|
351
|
-
// Bottom sheet (most common)
|
|
352
|
-
<Stack.Screen
|
|
353
|
-
name="Sheet"
|
|
354
|
-
options={{
|
|
355
|
-
gestureEnabled: true,
|
|
356
|
-
gestureDirection: "vertical",
|
|
357
|
-
snapPoints: [0.5, 1], // 50% and 100% of screen
|
|
358
|
-
initialSnapIndex: 0, // Start at 50%
|
|
359
|
-
backdropBehavior: "dismiss", // Tap backdrop to dismiss
|
|
360
|
-
...Transition.Presets.SlideFromBottom(),
|
|
361
|
-
}}
|
|
362
|
-
/>
|
|
363
|
-
|
|
364
|
-
// Side sheet (same API, different direction)
|
|
365
|
-
<Stack.Screen
|
|
366
|
-
name="SidePanel"
|
|
367
|
-
options={{
|
|
368
|
-
gestureEnabled: true,
|
|
369
|
-
gestureDirection: "horizontal",
|
|
370
|
-
snapPoints: [0.3, 0.7, 1], // 30%, 70%, 100% of screen width
|
|
371
|
-
initialSnapIndex: 1,
|
|
372
|
-
// Add a horizontal screenStyleInterpolator for drawer-style motion
|
|
373
|
-
}}
|
|
374
|
-
/>
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Options
|
|
378
|
-
|
|
379
|
-
| Option | Description |
|
|
380
|
-
| ------------------ | -------------------------------------------------------------------- |
|
|
381
|
-
| `snapPoints` | Array of fractions (0-1) where sheet can rest |
|
|
382
|
-
| `initialSnapIndex` | Index of initial snap point (default: 0) |
|
|
383
|
-
| `gestureSnapLocked` | Locks gesture snapping to current point (programmatic `snapTo` still works) |
|
|
384
|
-
| `backdropBehavior` | Touch handling: `"block"`, `"passthrough"`, `"dismiss"`, `"collapse"`|
|
|
385
|
-
| `backdropComponent` | Custom backdrop component, driven by interpolator `backdrop` slot |
|
|
386
|
-
|
|
387
|
-
#### backdropBehavior Values
|
|
388
|
-
|
|
389
|
-
| Value | Description |
|
|
390
|
-
| --------------- | ---------------------------------------------------------------- |
|
|
391
|
-
| `"block"` | Backdrop catches all touches (default) |
|
|
392
|
-
| `"passthrough"` | Touches pass through to content behind |
|
|
393
|
-
| `"dismiss"` | Tapping backdrop dismisses the screen |
|
|
394
|
-
| `"collapse"` | Tapping backdrop collapses to next lower snap point, then dismisses |
|
|
395
|
-
|
|
396
|
-
#### Custom Backdrop Component
|
|
397
|
-
|
|
398
|
-
Use `backdropComponent` to provide a custom component for the backdrop layer between screens (e.g., a `BlurView`).
|
|
399
|
-
|
|
400
|
-
- The library wraps your component with `Animated.createAnimatedComponent` internally
|
|
401
|
-
- Animated styles and props are driven by the `backdrop` slot in your interpolator
|
|
402
|
-
- `backdropBehavior` still controls the wrapping `Pressable` for dismiss/collapse handling
|
|
403
|
-
|
|
404
|
-
```tsx
|
|
405
|
-
import { BlurView } from "expo-blur";
|
|
406
|
-
|
|
407
|
-
<Stack.Screen
|
|
408
|
-
name="Sheet"
|
|
409
|
-
options={{
|
|
410
|
-
snapPoints: [0.5, 1],
|
|
411
|
-
backdropBehavior: "dismiss",
|
|
412
|
-
backdropComponent: BlurView,
|
|
413
|
-
screenStyleInterpolator: ({ progress }) => {
|
|
414
|
-
"worklet";
|
|
415
|
-
return {
|
|
416
|
-
backdrop: {
|
|
417
|
-
style: { opacity: interpolate(progress, [0, 1], [0, 1]) },
|
|
418
|
-
props: { intensity: interpolate(progress, [0, 1], [0, 80]) },
|
|
419
|
-
},
|
|
420
|
-
content: {
|
|
421
|
-
style: {
|
|
422
|
-
transform: [{ translateY: interpolate(progress, [0, 1], [800, 0]) }],
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
};
|
|
426
|
-
},
|
|
427
|
-
}}
|
|
428
|
-
/>
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
The `props` bucket is applied via `useAnimatedProps`, letting you animate component-specific properties like `BlurView`'s `intensity` or `SquircleView`'s `cornerRadius`.
|
|
432
|
-
|
|
433
|
-
#### Custom Surface Component
|
|
434
|
-
|
|
435
|
-
Use `surfaceComponent` to render a custom surface inside the animated content wrapper (e.g., a `SquircleView` for smooth rounded corners).
|
|
436
|
-
|
|
437
|
-
- `content` drives container-level transitions (position/scale/opacity)
|
|
438
|
-
- `surface` drives custom surface styles/props
|
|
439
|
-
- Animated props are driven by the `surface` slot in your interpolator
|
|
440
|
-
|
|
441
|
-
```tsx
|
|
442
|
-
import { SquircleView } from "react-native-figma-squircle";
|
|
443
|
-
|
|
444
|
-
<Stack.Screen
|
|
445
|
-
name="Card"
|
|
446
|
-
options={{
|
|
447
|
-
surfaceComponent: SquircleView,
|
|
448
|
-
screenStyleInterpolator: ({ progress }) => {
|
|
449
|
-
"worklet";
|
|
450
|
-
return {
|
|
451
|
-
content: {
|
|
452
|
-
style: {
|
|
453
|
-
transform: [{ scale: interpolate(progress, [0, 1], [0.8, 1]) }],
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
surface: {
|
|
457
|
-
props: { cornerRadius: 24, cornerSmoothing: 0.7 },
|
|
458
|
-
},
|
|
459
|
-
};
|
|
460
|
-
},
|
|
461
|
-
}}
|
|
462
|
-
/>
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
### Programmatic Control
|
|
466
|
-
|
|
467
|
-
Control snap points from anywhere in your app:
|
|
468
|
-
|
|
469
|
-
```tsx
|
|
470
|
-
import { snapTo } from "react-native-screen-transitions";
|
|
471
|
-
|
|
472
|
-
function BottomSheet() {
|
|
473
|
-
// Expand to full height (index 1)
|
|
474
|
-
const expand = () => snapTo(1);
|
|
475
|
-
|
|
476
|
-
// Collapse to half height (index 0)
|
|
477
|
-
const collapse = () => snapTo(0);
|
|
478
|
-
|
|
479
|
-
return (
|
|
480
|
-
<View>
|
|
481
|
-
<Button title="Expand" onPress={expand} />
|
|
482
|
-
<Button title="Collapse" onPress={collapse} />
|
|
483
|
-
</View>
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
The animated `snapIndex` is available in screen interpolators via `ScreenInterpolationProps`:
|
|
489
|
-
|
|
490
|
-
```tsx
|
|
491
|
-
screenStyleInterpolator: ({ snapIndex }) => {
|
|
492
|
-
// snapIndex interpolates between snap point indices
|
|
493
|
-
// e.g., 0.5 means halfway between snap point 0 and 1
|
|
494
|
-
return {
|
|
495
|
-
content: {
|
|
496
|
-
style: {
|
|
497
|
-
opacity: interpolate(snapIndex, [0, 1], [0.5, 1]),
|
|
498
|
-
},
|
|
499
|
-
},
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### ScrollView Behavior
|
|
505
|
-
|
|
506
|
-
With `Transition.ScrollView` inside a snap-enabled sheet:
|
|
507
|
-
- **`expandViaScrollView: true`**: At boundary, swipe up expands and swipe down collapses (or dismisses at min if enabled)
|
|
508
|
-
- **`expandViaScrollView: false`**: Expand works only via deadspace; collapse/dismiss via scroll still works at boundary
|
|
509
|
-
- **Scrolled into content**: Normal scroll behavior
|
|
510
|
-
|
|
511
|
-
### Snap Animation Specs
|
|
512
|
-
|
|
513
|
-
Customize snap animations separately from enter/exit:
|
|
514
|
-
|
|
515
|
-
```tsx
|
|
516
|
-
transitionSpec: {
|
|
517
|
-
open: { stiffness: 1000, damping: 500, mass: 3 }, // Screen enter
|
|
518
|
-
close: { stiffness: 1000, damping: 500, mass: 3 }, // Screen exit
|
|
519
|
-
expand: { stiffness: 300, damping: 30 }, // Snap up
|
|
520
|
-
collapse: { stiffness: 300, damping: 30 }, // Snap down
|
|
521
|
-
}
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
---
|
|
525
|
-
|
|
526
|
-
## Shared Elements (Bounds API)
|
|
527
|
-
|
|
528
|
-
Animate elements between screens by tagging them. There are two approaches: the `Transition.Boundary` namespace for declarative shared element transitions, and `sharedBoundTag` on `Transition.View`/`Transition.Pressable` for inline usage.
|
|
529
|
-
|
|
530
|
-
### Transition.Boundary
|
|
531
|
-
|
|
532
|
-
The recommended setup. `Transition.Boundary` is a namespace with prebuilt variants:
|
|
533
|
-
- `Transition.Boundary.Pressable` for source elements that trigger navigation
|
|
534
|
-
- `Transition.Boundary.View` for passive source/destination elements
|
|
535
|
-
|
|
536
|
-
```tsx
|
|
537
|
-
// Source screen — list item
|
|
538
|
-
<Transition.Boundary.Pressable
|
|
539
|
-
id="album-art"
|
|
540
|
-
group="albums" // Optional: list/collection grouping
|
|
541
|
-
onPress={() => router.push("/details")}
|
|
542
|
-
>
|
|
543
|
-
<Image source={album} style={{ width: 100, height: 100 }} />
|
|
544
|
-
</Transition.Boundary.Pressable>
|
|
545
|
-
|
|
546
|
-
// Destination screen
|
|
547
|
-
<Transition.Boundary.View id="album-art">
|
|
548
|
-
<Image source={album} style={{ width: 300, height: 300 }} />
|
|
549
|
-
</Transition.Boundary.View>
|
|
550
|
-
```
|
|
551
|
-
|
|
552
|
-
#### Boundary Props
|
|
553
|
-
|
|
554
|
-
| Prop | Description |
|
|
555
|
-
| ----------- | ------------------------------------------------------------------ |
|
|
556
|
-
| `id` | Unique identifier for matching across screens |
|
|
557
|
-
| `group` | Group name for list/collection scenarios (tag becomes `group:id`) |
|
|
558
|
-
| `enabled` | Whether this boundary participates in matching (default: true) |
|
|
559
|
-
| `method` | `"transform"` `"size"` `"content"` — how to animate |
|
|
560
|
-
| `anchor` | Alignment anchor point |
|
|
561
|
-
| `scaleMode` | `"match"` `"none"` `"uniform"` — aspect ratio handling |
|
|
562
|
-
| `target` | Target for size calculations (for example `"fullscreen"`) |
|
|
563
|
-
|
|
564
|
-
#### Groups
|
|
565
|
-
|
|
566
|
-
For list/collection scenarios where multiple items share the same transition:
|
|
567
|
-
|
|
568
|
-
```tsx
|
|
569
|
-
{items.map((item) => (
|
|
570
|
-
<Transition.Boundary.Pressable
|
|
571
|
-
key={item.id}
|
|
572
|
-
id={item.id}
|
|
573
|
-
group="photos"
|
|
574
|
-
onPress={() => router.push(`/photo/${item.id}`)}
|
|
575
|
-
>
|
|
576
|
-
<Image source={item.src} />
|
|
577
|
-
</Transition.Boundary.Pressable>
|
|
578
|
-
))}
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
Only the tapped item transitions. The library tracks the active member for each group, and transition-aware scrollables emit settled signals so grouped boundaries can re-measure after focus-change auto-scrolling.
|
|
582
|
-
|
|
583
|
-
### Custom Boundary Components
|
|
584
|
-
|
|
585
|
-
Use the boundary factory when you want a custom wrapped component (for example `Image`, `BlurView`, or design-system primitives):
|
|
586
|
-
|
|
587
|
-
```tsx
|
|
588
|
-
import { Image } from "react-native";
|
|
589
|
-
import Transition from "react-native-screen-transitions";
|
|
590
|
-
|
|
591
|
-
const BoundaryImage = Transition.createBoundaryComponent(Image);
|
|
592
|
-
|
|
593
|
-
<BoundaryImage id="cover-art" group="albums" source={cover} />
|
|
594
|
-
```
|
|
595
|
-
|
|
596
|
-
### Inline Shared Elements
|
|
597
|
-
|
|
598
|
-
For simpler legacy cases, use `sharedBoundTag` directly on `Transition.View` or `Transition.Pressable`:
|
|
599
|
-
|
|
600
|
-
```tsx
|
|
601
|
-
// Source
|
|
602
|
-
<Transition.Pressable
|
|
603
|
-
sharedBoundTag="avatar"
|
|
604
|
-
onPress={() => navigation.navigate("Profile")}
|
|
605
|
-
>
|
|
606
|
-
<Image source={avatar} style={{ width: 50, height: 50 }} />
|
|
607
|
-
</Transition.Pressable>
|
|
608
|
-
|
|
609
|
-
// Destination
|
|
610
|
-
<Transition.View sharedBoundTag="avatar">
|
|
611
|
-
<Image source={avatar} style={{ width: 200, height: 200 }} />
|
|
612
|
-
</Transition.View>
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
> `sharedBoundTag` on `Transition.Pressable` is planned for deprecation in the next major version. Prefer `Transition.Boundary.Pressable` and `Transition.Boundary.View`.
|
|
616
|
-
|
|
617
|
-
### Using Bounds in Interpolators
|
|
618
|
-
|
|
619
|
-
```tsx
|
|
620
|
-
screenStyleInterpolator: ({ bounds }) => {
|
|
621
|
-
"worklet";
|
|
622
|
-
return {
|
|
623
|
-
"avatar": bounds({ id: "avatar", method: "transform" }),
|
|
624
|
-
};
|
|
625
|
-
};
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
### Navigation Bounds (Zoom Transitions)
|
|
629
|
-
|
|
630
|
-
For SwiftUI-like navigation zoom transitions where content expands from a source element with a masked reveal:
|
|
631
|
-
|
|
632
|
-
```tsx
|
|
633
|
-
<Stack.Screen
|
|
634
|
-
name="Detail"
|
|
635
|
-
options={{
|
|
636
|
-
maskEnabled: true, // Required for masked reveal
|
|
637
|
-
screenStyleInterpolator: ({ bounds, progress, focused }) => {
|
|
638
|
-
"worklet";
|
|
639
|
-
if (!focused) return {};
|
|
640
|
-
|
|
641
|
-
return bounds({
|
|
642
|
-
id: "album-art",
|
|
643
|
-
}).navigation.zoom();
|
|
644
|
-
},
|
|
645
|
-
transitionSpec: {
|
|
646
|
-
open: { stiffness: 1000, damping: 500, mass: 3, overshootClamping: true },
|
|
647
|
-
close: { stiffness: 1000, damping: 500, mass: 3, overshootClamping: true },
|
|
648
|
-
},
|
|
649
|
-
}}
|
|
650
|
-
/>
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
`bounds().navigation.zoom()` returns a complete interpolator result with content, mask, and container styles. Set `maskEnabled: true` to pre-mount the masked view wrapper so it's ready from the first frame.
|
|
654
|
-
|
|
655
|
-
`navigation.zoom()` does not accept options.
|
|
656
|
-
|
|
657
|
-
Configuration guidance:
|
|
658
|
-
- Preferred: define transition configuration on boundary components (`anchor`, `scaleMode`, `target`, `method`) via `Transition.Boundary.View` / `Transition.Boundary.Pressable`.
|
|
659
|
-
- Supported but secondary: pass options through `bounds({ ... })` when needed.
|
|
660
|
-
|
|
661
|
-
> **Note**: Navigation bounds masking requires `@react-native-masked-view/masked-view` to be installed.
|
|
662
|
-
|
|
663
|
-
### Bounds Options
|
|
664
|
-
|
|
665
|
-
`bounds({ ... })` options are supported. For shared boundary flows, prefer setting configuration on boundary components and keep `bounds({ id })` minimal.
|
|
666
|
-
|
|
667
|
-
| Option | Values | Description |
|
|
668
|
-
| ----------- | ---------------------------------- | ----------------------------- |
|
|
669
|
-
| `id` | string | The boundary id to match |
|
|
670
|
-
| `method` | `"transform"` `"size"` `"content"` | How to animate |
|
|
671
|
-
| `space` | `"relative"` `"absolute"` | Coordinate space |
|
|
672
|
-
| `scaleMode` | `"match"` `"none"` `"uniform"` | Aspect ratio handling |
|
|
673
|
-
| `anchor` | string | Alignment anchor point |
|
|
674
|
-
| `target` | `"fullscreen"` etc. | Target for size calculations |
|
|
675
|
-
| `raw` | boolean | Return raw values |
|
|
676
|
-
|
|
677
|
-
---
|
|
678
|
-
|
|
679
|
-
## Overlays
|
|
680
|
-
|
|
681
|
-
Persistent UI that animates with the stack:
|
|
682
|
-
|
|
683
|
-
```tsx
|
|
684
|
-
const TabBar = ({ focusedIndex, progress }) => {
|
|
685
|
-
const style = useAnimatedStyle(() => ({
|
|
686
|
-
transform: [{ translateY: interpolate(progress.value, [0, 1], [100, 0]) }],
|
|
687
|
-
}));
|
|
688
|
-
return <Animated.View style={[styles.tabBar, style]} />;
|
|
689
|
-
};
|
|
690
|
-
|
|
691
|
-
<Stack.Screen
|
|
692
|
-
name="Home"
|
|
693
|
-
options={{
|
|
694
|
-
overlay: TabBar,
|
|
695
|
-
overlayShown: true,
|
|
696
|
-
}}
|
|
697
|
-
/>
|
|
698
|
-
```
|
|
699
|
-
|
|
700
|
-
### Overlay Props
|
|
701
|
-
|
|
702
|
-
| Prop | Description |
|
|
703
|
-
| -------------- | ------------------------------ |
|
|
704
|
-
| `focusedRoute` | Currently focused route |
|
|
705
|
-
| `focusedIndex` | Index of focused screen |
|
|
706
|
-
| `routes` | All routes in the stack |
|
|
707
|
-
| `progress` | Stack progress (derived value) |
|
|
708
|
-
| `navigation` | Navigation prop |
|
|
709
|
-
| `meta` | Custom metadata from options |
|
|
710
|
-
|
|
711
|
-
---
|
|
712
|
-
|
|
713
|
-
## Transition Components
|
|
714
|
-
|
|
715
|
-
| Component | Description |
|
|
716
|
-
| ------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
717
|
-
| `Transition.Boundary` | Namespace for shared-boundary helpers |
|
|
718
|
-
| `Transition.Boundary.View` | Passive boundary wrapper for shared elements |
|
|
719
|
-
| `Transition.Boundary.Pressable` | Pressable boundary wrapper with press-priority source measurement |
|
|
720
|
-
| `Transition.createBoundaryComponent` | Factory for building boundary wrappers around custom components |
|
|
721
|
-
| `Transition.View` | Animated view with `sharedBoundTag` or `styleId` |
|
|
722
|
-
| `Transition.Pressable` | Pressable wrapper. `sharedBoundTag` usage is legacy and planned for next-major deprecation |
|
|
723
|
-
| `Transition.ScrollView` | ScrollView with gesture coordination + scroll-settled signaling |
|
|
724
|
-
| `Transition.FlatList` | FlatList with gesture coordination + scroll-settled signaling |
|
|
725
|
-
| `Transition.MaskedView` | Deprecated legacy masking wrapper. Prefer `maskEnabled` on screen options |
|
|
726
|
-
|
|
727
|
-
---
|
|
728
|
-
|
|
729
|
-
## Hooks
|
|
730
|
-
|
|
731
|
-
### useScreenAnimation
|
|
732
|
-
|
|
733
|
-
Access animation state inside a screen:
|
|
734
|
-
|
|
735
|
-
```tsx
|
|
736
|
-
import { useScreenAnimation } from "react-native-screen-transitions";
|
|
737
|
-
|
|
738
|
-
function DetailScreen() {
|
|
739
|
-
const animation = useScreenAnimation();
|
|
740
|
-
|
|
741
|
-
const style = useAnimatedStyle(() => ({
|
|
742
|
-
opacity: animation.value.current.progress,
|
|
743
|
-
}));
|
|
744
|
-
|
|
745
|
-
return <Animated.View style={style}>...</Animated.View>;
|
|
746
|
-
}
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
### useScreenState
|
|
750
|
-
|
|
751
|
-
Get navigation state without animation values:
|
|
752
|
-
|
|
753
|
-
```tsx
|
|
754
|
-
import { useScreenState } from "react-native-screen-transitions";
|
|
755
|
-
|
|
756
|
-
function DetailScreen() {
|
|
757
|
-
const { index, focusedRoute, routes, navigation } = useScreenState();
|
|
758
|
-
// ...
|
|
759
|
-
}
|
|
760
|
-
```
|
|
761
|
-
|
|
762
|
-
### useHistory
|
|
763
|
-
|
|
764
|
-
Access navigation history across the app:
|
|
765
|
-
|
|
766
|
-
```tsx
|
|
767
|
-
import { useHistory } from "react-native-screen-transitions";
|
|
768
|
-
|
|
769
|
-
function MyComponent() {
|
|
770
|
-
const { getRecent, getPath } = useHistory();
|
|
771
|
-
|
|
772
|
-
const recentScreens = getRecent(5); // Last 5 screens
|
|
773
|
-
const path = getPath(fromKey, toKey); // Path between screens
|
|
774
|
-
}
|
|
775
|
-
```
|
|
776
|
-
|
|
777
|
-
### useScreenGesture
|
|
778
|
-
|
|
779
|
-
Coordinate your own pan gestures with the navigation gesture:
|
|
780
|
-
|
|
781
|
-
```tsx
|
|
782
|
-
import { useScreenGesture } from "react-native-screen-transitions";
|
|
783
|
-
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
784
|
-
|
|
785
|
-
function MyScreen() {
|
|
786
|
-
const screenGesture = useScreenGesture();
|
|
787
|
-
|
|
788
|
-
const myPanGesture = Gesture.Pan()
|
|
789
|
-
.simultaneousWithExternalGesture(screenGesture)
|
|
790
|
-
.onUpdate((e) => {
|
|
791
|
-
// Your gesture logic
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
return (
|
|
795
|
-
<GestureDetector gesture={myPanGesture}>
|
|
796
|
-
<View />
|
|
797
|
-
</GestureDetector>
|
|
798
|
-
);
|
|
799
|
-
}
|
|
800
|
-
```
|
|
801
|
-
|
|
802
|
-
Use this when you have custom pan gestures that need to work alongside screen dismiss gestures.
|
|
803
|
-
|
|
804
|
-
---
|
|
805
|
-
|
|
806
|
-
## Advanced Animation Props
|
|
807
|
-
|
|
808
|
-
The full `screenStyleInterpolator` receives these props:
|
|
809
|
-
|
|
810
|
-
| Prop | Description |
|
|
811
|
-
| ---------------- | -------------------------------------------------------- |
|
|
812
|
-
| `progress` | Combined progress (0-2) |
|
|
813
|
-
| `stackProgress` | Accumulated progress across entire stack |
|
|
814
|
-
| `snapIndex` | Animated snap point index (-1 if no snap points) |
|
|
815
|
-
| `focused` | Whether this screen is the topmost in the stack |
|
|
816
|
-
| `current` | Current screen state |
|
|
817
|
-
| `previous` | Previous screen state |
|
|
818
|
-
| `next` | Next screen state |
|
|
819
|
-
| `active` | Screen driving the transition |
|
|
820
|
-
| `inactive` | Screen NOT driving the transition |
|
|
821
|
-
| `layouts.screen` | Screen dimensions |
|
|
822
|
-
| `insets` | Safe area insets |
|
|
823
|
-
| `bounds` | Shared element bounds function |
|
|
824
|
-
|
|
825
|
-
### Screen State Properties
|
|
826
|
-
|
|
827
|
-
Each screen state (`current`, `previous`, `next`, `active`, `inactive`) contains:
|
|
828
|
-
|
|
829
|
-
| Property | Description |
|
|
830
|
-
| ----------- | ---------------------------------------- |
|
|
831
|
-
| `progress` | Animation progress (0 or 1) |
|
|
832
|
-
| `closing` | Whether closing (0 or 1) |
|
|
833
|
-
| `entering` | Whether entering (0 or 1) |
|
|
834
|
-
| `animating` | Whether animating (0 or 1) |
|
|
835
|
-
| `gesture` | Gesture values (x, y, normalized values) |
|
|
836
|
-
| `meta` | Custom metadata from options |
|
|
837
|
-
|
|
838
|
-
### Using `meta` for Conditional Logic
|
|
839
|
-
|
|
840
|
-
Pass custom data between screens:
|
|
841
|
-
|
|
842
|
-
```tsx
|
|
843
|
-
// Screen A
|
|
844
|
-
options={{ meta: { hideTabBar: true } }}
|
|
845
|
-
|
|
846
|
-
// Screen B reads it
|
|
847
|
-
screenStyleInterpolator: (props) => {
|
|
848
|
-
"worklet";
|
|
849
|
-
const hideTabBar = props.inactive?.meta?.hideTabBar;
|
|
850
|
-
// ...
|
|
851
|
-
};
|
|
852
|
-
```
|
|
853
|
-
|
|
854
|
-
### Animate Individual Elements
|
|
855
|
-
|
|
856
|
-
Use `styleId` to target specific elements:
|
|
857
|
-
|
|
858
|
-
```tsx
|
|
859
|
-
// In options
|
|
860
|
-
screenStyleInterpolator: ({ progress }) => {
|
|
861
|
-
"worklet";
|
|
862
|
-
return {
|
|
863
|
-
"hero-image": {
|
|
864
|
-
style: {
|
|
865
|
-
opacity: interpolate(progress, [0, 1], [0, 1]),
|
|
866
|
-
transform: [{ scale: interpolate(progress, [0, 1], [0.8, 1]) }],
|
|
867
|
-
},
|
|
868
|
-
},
|
|
869
|
-
};
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
// In component
|
|
873
|
-
<Transition.View styleId="hero-image">
|
|
874
|
-
<Image source={...} />
|
|
875
|
-
</Transition.View>
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
---
|
|
879
|
-
|
|
880
|
-
## Stack Types
|
|
881
|
-
|
|
882
|
-
All three stacks share the same animation API. Choose based on your needs:
|
|
883
|
-
|
|
884
|
-
| Stack | Best For |
|
|
885
|
-
| ------------------- | --------------------------------------------------------- |
|
|
886
|
-
| **Blank Stack** | Most apps. Full control, all features. |
|
|
887
|
-
| **Native Stack** | When you need native screen primitives. |
|
|
888
|
-
| **Component Stack** | Embedded flows, isolated from React Navigation. *(Experimental)* |
|
|
889
|
-
|
|
890
|
-
### Blank Stack
|
|
891
|
-
|
|
892
|
-
The default choice. Uses `react-native-screens` for native screen containers, with animations powered by Reanimated worklets running on the UI thread (not the JS thread).
|
|
893
|
-
|
|
894
|
-
```tsx
|
|
895
|
-
import { createBlankStackNavigator } from "react-native-screen-transitions/blank-stack";
|
|
896
|
-
```
|
|
897
|
-
|
|
898
|
-
### Native Stack
|
|
899
|
-
|
|
900
|
-
Extends `@react-navigation/native-stack`. Requires `enableTransitions: true`.
|
|
901
|
-
|
|
902
|
-
```tsx
|
|
903
|
-
import { createNativeStackNavigator } from "react-native-screen-transitions/native-stack";
|
|
904
|
-
|
|
905
|
-
<Stack.Screen
|
|
906
|
-
name="Detail"
|
|
907
|
-
options={{
|
|
908
|
-
enableTransitions: true,
|
|
909
|
-
...Transition.Presets.SlideFromBottom(),
|
|
910
|
-
}}
|
|
911
|
-
/>
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
### Component Stack (Experimental)
|
|
915
|
-
|
|
916
|
-
> **Note:** This API is experimental and may change based on community feedback.
|
|
917
|
-
|
|
918
|
-
Standalone navigator, not connected to React Navigation. Ideal for embedded flows.
|
|
919
|
-
|
|
920
|
-
```tsx
|
|
921
|
-
import { createComponentStackNavigator } from "react-native-screen-transitions/component-stack";
|
|
922
|
-
|
|
923
|
-
const Stack = createComponentStackNavigator();
|
|
924
|
-
|
|
925
|
-
<Stack.Navigator initialRouteName="step1">
|
|
926
|
-
<Stack.Screen name="step1" component={Step1} />
|
|
927
|
-
<Stack.Screen name="step2" component={Step2} />
|
|
928
|
-
</Stack.Navigator>
|
|
929
|
-
```
|
|
930
|
-
|
|
931
|
-
---
|
|
932
|
-
|
|
933
|
-
## Caveats & Trade-offs
|
|
934
|
-
|
|
935
|
-
### Native Stack
|
|
936
|
-
|
|
937
|
-
The Native Stack uses transparent modal presentation to intercept transitions. This has trade-offs:
|
|
938
|
-
|
|
939
|
-
- **Delayed touch events** – Exiting screens may have briefly delayed touch response
|
|
940
|
-
- **beforeRemove listeners** – Relies on navigation lifecycle events
|
|
941
|
-
- **Rapid navigation** – Some edge cases with very fast navigation sequences
|
|
942
|
-
|
|
943
|
-
For most apps, Blank Stack avoids these issues entirely.
|
|
944
|
-
|
|
945
|
-
### Component Stack (Experimental)
|
|
946
|
-
|
|
947
|
-
- **No deep linking** – Routes aren't part of your URL structure
|
|
948
|
-
- **Isolated state** – Doesn't affect parent navigation
|
|
949
|
-
- **Touch pass-through** – Uses `pointerEvents="box-none"` by default
|
|
950
|
-
|
|
951
|
-
---
|
|
952
|
-
|
|
953
|
-
## Experimental Features
|
|
954
|
-
|
|
955
|
-
### High Refresh Rate
|
|
956
|
-
|
|
957
|
-
Force maximum refresh rate during transitions (for 90Hz/120Hz displays):
|
|
958
|
-
|
|
959
|
-
```tsx
|
|
960
|
-
options={{
|
|
961
|
-
experimental_enableHighRefreshRate: true,
|
|
962
|
-
}}
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
---
|
|
966
|
-
|
|
967
|
-
## Masked View Setup (`maskEnabled` Recommended)
|
|
968
|
-
|
|
969
|
-
Required for `SharedIGImage`, `SharedAppleMusic` presets, and `bounds().navigation.zoom()` transitions. For new code, prefer `maskEnabled: true` on screen options.
|
|
970
|
-
|
|
971
|
-
> **Note**: Requires native code. Will not work in Expo Go.
|
|
972
|
-
|
|
973
|
-
### Installation
|
|
974
|
-
|
|
975
|
-
```bash
|
|
976
|
-
# Expo
|
|
977
|
-
npx expo install @react-native-masked-view/masked-view
|
|
978
|
-
|
|
979
|
-
# Bare React Native
|
|
980
|
-
npm install @react-native-masked-view/masked-view
|
|
981
|
-
cd ios && pod install
|
|
982
|
-
```
|
|
983
|
-
|
|
984
|
-
### Recommended Flow (`maskEnabled`)
|
|
985
|
-
|
|
986
|
-
**1. Source Screen** – use a boundary pressable:
|
|
987
|
-
|
|
988
|
-
```tsx
|
|
989
|
-
// app/index.tsx
|
|
990
|
-
import { router } from "expo-router";
|
|
991
|
-
import Transition from "react-native-screen-transitions";
|
|
992
|
-
|
|
993
|
-
export default function HomeScreen() {
|
|
994
|
-
return (
|
|
995
|
-
<Transition.Boundary.Pressable
|
|
996
|
-
id="album-art"
|
|
997
|
-
style={{
|
|
998
|
-
width: 200,
|
|
999
|
-
height: 200,
|
|
1000
|
-
backgroundColor: "#1DB954",
|
|
1001
|
-
borderRadius: 12,
|
|
1002
|
-
}}
|
|
1003
|
-
onPress={() => router.push("/details")}
|
|
1004
|
-
/>
|
|
1005
|
-
);
|
|
1006
|
-
}
|
|
1007
|
-
```
|
|
1008
|
-
|
|
1009
|
-
**2. Destination Screen** – render the matching boundary:
|
|
1010
|
-
|
|
1011
|
-
```tsx
|
|
1012
|
-
// app/details.tsx
|
|
1013
|
-
import Transition from "react-native-screen-transitions";
|
|
1014
|
-
|
|
1015
|
-
export default function DetailsScreen() {
|
|
1016
|
-
return (
|
|
1017
|
-
<Transition.Boundary.View
|
|
1018
|
-
id="album-art"
|
|
1019
|
-
style={{
|
|
1020
|
-
backgroundColor: "#1DB954",
|
|
1021
|
-
width: 400,
|
|
1022
|
-
height: 400,
|
|
1023
|
-
alignSelf: "center",
|
|
1024
|
-
borderRadius: 12,
|
|
1025
|
-
}}
|
|
1026
|
-
/>
|
|
1027
|
-
);
|
|
1028
|
-
}
|
|
1029
|
-
```
|
|
1030
|
-
|
|
1031
|
-
**3. Layout** – enable `maskEnabled` and use `bounds().navigation.zoom()`:
|
|
1032
|
-
|
|
1033
|
-
```tsx
|
|
1034
|
-
// app/_layout.tsx
|
|
1035
|
-
import { Stack } from "./stack";
|
|
1036
|
-
|
|
1037
|
-
export default function RootLayout() {
|
|
1038
|
-
return (
|
|
1039
|
-
<Stack>
|
|
1040
|
-
<Stack.Screen name="index" />
|
|
1041
|
-
<Stack.Screen
|
|
1042
|
-
name="details"
|
|
1043
|
-
options={{
|
|
1044
|
-
maskEnabled: true,
|
|
1045
|
-
screenStyleInterpolator: ({ bounds, focused }) => {
|
|
1046
|
-
"worklet";
|
|
1047
|
-
if (!focused) return {};
|
|
1048
|
-
return bounds({ id: "album-art" }).navigation.zoom();
|
|
1049
|
-
},
|
|
1050
|
-
}}
|
|
1051
|
-
/>
|
|
1052
|
-
</Stack>
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
```
|
|
1056
|
-
|
|
1057
|
-
### Legacy Fallback (Deprecated): `Transition.MaskedView`
|
|
1058
|
-
|
|
1059
|
-
`Transition.MaskedView` remains available for legacy/manual masking flows, but new implementations should use `maskEnabled`.
|
|
1060
|
-
|
|
1061
|
-
```tsx
|
|
1062
|
-
<Transition.MaskedView style={{ flex: 1 }}>
|
|
1063
|
-
<Transition.View sharedBoundTag="album-art" />
|
|
1064
|
-
</Transition.MaskedView>
|
|
1065
|
-
```
|
|
1066
|
-
|
|
1067
|
-
### How It Works
|
|
1068
|
-
|
|
1069
|
-
1. `Transition.Boundary.Pressable` measures and stores source bounds (legacy fallback: `Transition.Pressable` with `sharedBoundTag`, planned for next-major deprecation).
|
|
1070
|
-
2. `Transition.Boundary.View` (or `Transition.View`) on the destination registers the matching target.
|
|
1071
|
-
3. `maskEnabled: true` pre-mounts the masked wrapper for zoom/reveal transitions (legacy fallback: `Transition.MaskedView`).
|
|
1072
|
-
4. The zoom preset interpolates position, size, and mask for a seamless expand/collapse effect.
|
|
1073
|
-
|
|
1074
|
-
---
|
|
1075
|
-
|
|
1076
|
-
## Support
|
|
1077
|
-
|
|
1078
|
-
This package is developed in my spare time.
|
|
1079
|
-
|
|
1080
|
-
If you'd like to fuel the next release, [buy me a coffee](https://buymeacoffee.com/trpfsu)
|
|
1081
|
-
|
|
1082
|
-
## License
|
|
44
|
+
## Docs
|
|
1083
45
|
|
|
1084
|
-
|
|
46
|
+
- Docs site: `https://eds2002.github.io/react-native-screen-transitions/`
|
|
47
|
+
- Stable docs line: `3.x`
|
|
48
|
+
- Unreleased docs line: `Next`
|
|
49
|
+
- Repository: `https://github.com/eds2002/react-native-screen-transitions`
|