react-native-screen-transitions 3.4.0-alpha.1 → 3.4.0-alpha.3
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 -1109
- 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/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 +23 -10
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +4 -4
- 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/screen-container/deferred-visibility-host.js +43 -0
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +60 -0
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container/index.js +7 -4
- package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +32 -48
- 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 +9 -20
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/commonjs/shared/configs/presets.js +6 -6
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/constants.js +10 -4
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +9 -34
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/index.js +4 -10
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +6 -7
- 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/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/helpers/pipeline.js +14 -7
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +36 -0
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles.provider.js +31 -10
- package/lib/commonjs/shared/providers/screen/styles.provider.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/stores/animation.store.js +3 -1
- 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/utils/bounds/helpers/compute-bounds-styles.js +16 -7
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js +0 -5
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +10 -0
- 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/build.js +34 -31
- package/lib/commonjs/shared/utils/bounds/zoom/build.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/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 +23 -10
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +4 -4
- 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/screen-container/deferred-visibility-host.js +38 -0
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +1 -0
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +56 -0
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- package/lib/module/shared/components/screen-container/index.js +7 -4
- package/lib/module/shared/components/screen-container/index.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +37 -53
- 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 +10 -21
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/module/shared/configs/presets.js +7 -7
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/constants.js +9 -3
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +10 -35
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/index.js +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +6 -7
- 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/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/helpers/pipeline.js +14 -7
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +31 -0
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -0
- package/lib/module/shared/providers/screen/styles.provider.js +30 -11
- package/lib/module/shared/providers/screen/styles.provider.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/stores/animation.store.js +3 -1
- 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/utils/bounds/helpers/compute-bounds-styles.js +17 -8
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js +0 -5
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +10 -0
- 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/build.js +35 -32
- package/lib/module/shared/utils/bounds/zoom/build.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/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-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/screen-container/deferred-visibility-host.d.ts +13 -0
- package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts.map +1 -0
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts +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/index.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 +3 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/configs/index.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +9 -3
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts +5 -11
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -2
- 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/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/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +10 -0
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts +4 -2
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -1
- package/lib/typescript/shared/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/stores/animation.store.d.ts +5 -3
- 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/types/animation.types.d.ts +13 -1
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +51 -22
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts +11 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.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/zoom/accessor.d.ts +4 -4
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +2 -2
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +3 -3
- package/lib/typescript/shared/utils/bounds/zoom/types.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 +2 -1
- 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/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 -7
- package/src/shared/components/create-boundary-component/types.ts +8 -4
- package/src/shared/components/create-transition-aware-component.tsx +5 -3
- package/src/shared/components/native-screen-container.tsx +11 -3
- package/src/shared/components/native-screen.tsx +65 -20
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +37 -0
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +82 -0
- package/src/shared/components/screen-container/index.tsx +5 -2
- package/src/shared/components/screen-container/layers/content.tsx +53 -80
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +12 -27
- package/src/shared/configs/presets.ts +10 -10
- package/src/shared/constants.ts +5 -3
- package/src/shared/hooks/animation/use-associated-style.ts +10 -54
- package/src/shared/index.ts +2 -3
- package/src/shared/providers/gestures/handlers/use-handlers.ts +8 -5
- package/src/shared/providers/gestures/helpers/gesture-activation.ts +11 -6
- 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/helpers/pipeline.ts +24 -8
- package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +41 -0
- package/src/shared/providers/screen/styles.provider.tsx +95 -72
- package/src/shared/providers/stack/core.provider.tsx +27 -14
- package/src/shared/stores/animation.store.ts +11 -7
- package/src/shared/stores/bounds/internals/presence.ts +3 -1
- package/src/shared/types/animation.types.ts +13 -1
- package/src/shared/types/screen.types.ts +55 -22
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +17 -3
- package/src/shared/utils/bounds/helpers/resolve-bound-tag.ts +0 -6
- package/src/shared/utils/bounds/index.ts +16 -5
- package/src/shared/utils/bounds/types/frame-props.ts +5 -0
- package/src/shared/utils/bounds/zoom/accessor.ts +3 -3
- package/src/shared/utils/bounds/zoom/build.ts +46 -32
- package/src/shared/utils/bounds/zoom/types.ts +3 -3
- package/src/shared/utils/resolve-screen-transition-options.ts +37 -0
- package/lib/commonjs/shared/providers/viewport.provider.js +0 -33
- package/lib/commonjs/shared/providers/viewport.provider.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/typescript/shared/providers/viewport.provider.d.ts +0 -13
- package/lib/typescript/shared/providers/viewport.provider.d.ts.map +0 -1
- package/src/shared/providers/viewport.provider.tsx +0 -39
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useAnimatedStyle,
|
|
5
5
|
useSharedValue,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
|
-
import {
|
|
7
|
+
import { NO_PROPS, NO_STYLES } from "../../constants";
|
|
8
8
|
import { useDescriptorDerivations } from "../../providers/screen/descriptors";
|
|
9
9
|
import { useScreenStyles } from "../../providers/screen/styles.provider";
|
|
10
10
|
import { AnimationStore } from "../../stores/animation.store";
|
|
@@ -14,11 +14,9 @@ type Props = {
|
|
|
14
14
|
id?: string;
|
|
15
15
|
style?: StyleProps;
|
|
16
16
|
resetTransformOnUnset?: boolean;
|
|
17
|
-
waitForFirstResolvedStyle?: boolean;
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
const TRANSIENT_EMPTY_GRACE_FRAMES = 2;
|
|
21
|
-
const TRANSITION_PROGRESS_COMPLETE = 1 - EPSILON;
|
|
22
20
|
const IDENTITY_TRANSFORM = [
|
|
23
21
|
{ translateX: 0 },
|
|
24
22
|
{ translateY: 0 },
|
|
@@ -30,7 +28,7 @@ const ALWAYS_RESET_STYLE_VALUES = {
|
|
|
30
28
|
elevation: 0,
|
|
31
29
|
} as const;
|
|
32
30
|
|
|
33
|
-
type AssociatedStyleMode = "
|
|
31
|
+
type AssociatedStyleMode = "hold-last-style" | "live";
|
|
34
32
|
|
|
35
33
|
type GroupTagParts = {
|
|
36
34
|
group: string;
|
|
@@ -126,33 +124,27 @@ const buildUnsetPatch = ({
|
|
|
126
124
|
|
|
127
125
|
/**
|
|
128
126
|
* Resolves the animated style associated with an `id` (styleId/bound tag), while
|
|
129
|
-
* guarding against
|
|
127
|
+
* guarding against transient glitches during shared-boundary transitions.
|
|
130
128
|
*
|
|
131
129
|
* Why this exists:
|
|
132
130
|
* - During push/pop, links and style maps can be briefly out of sync.
|
|
133
|
-
* - Without guards, boundaries can
|
|
131
|
+
* - Without guards, boundaries can briefly drop back to raw local layout.
|
|
134
132
|
* - Cleanup must be deterministic so stale transform keys do not linger.
|
|
135
133
|
*
|
|
136
|
-
*
|
|
134
|
+
* Local style model (worklet state machine):
|
|
137
135
|
*
|
|
138
|
-
*
|
|
139
|
-
* expected transition + transient empty style map -> hold-last-style
|
|
136
|
+
* transient empty style map -> hold-last-style
|
|
140
137
|
* otherwise -> live
|
|
141
138
|
*
|
|
142
|
-
* - `waiting-first-style`: return `opacity: 0` until first resolved style arrives.
|
|
143
139
|
* - `hold-last-style`: reuse last resolved style through short empty-map gaps.
|
|
144
140
|
* - `live`: apply current resolved style directly.
|
|
145
141
|
*
|
|
146
142
|
* For grouped tags (`group:id`), previous-screen transition evidence is only
|
|
147
143
|
* considered for the group's active member to avoid hiding non-active siblings.
|
|
148
|
-
*
|
|
149
|
-
* Set `waitForFirstResolvedStyle` to `false` for generic shared-bound-tag usage
|
|
150
|
-
* where the transition can be driven by other style ids.
|
|
151
144
|
*/
|
|
152
145
|
export const useAssociatedStyles = ({
|
|
153
146
|
id,
|
|
154
147
|
resetTransformOnUnset = false,
|
|
155
|
-
waitForFirstResolvedStyle = true,
|
|
156
148
|
}: Props = {}) => {
|
|
157
149
|
const { stylesMap, ancestorStylesMaps } = useScreenStyles();
|
|
158
150
|
const { previousScreenKey, currentScreenKey, hasConfiguredInterpolator } =
|
|
@@ -161,10 +153,6 @@ export const useAssociatedStyles = ({
|
|
|
161
153
|
currentScreenKey,
|
|
162
154
|
"animating",
|
|
163
155
|
);
|
|
164
|
-
const progress = AnimationStore.getRouteAnimation(
|
|
165
|
-
currentScreenKey,
|
|
166
|
-
"progress",
|
|
167
|
-
);
|
|
168
156
|
const isClosing = AnimationStore.getRouteAnimation(
|
|
169
157
|
currentScreenKey,
|
|
170
158
|
"closing",
|
|
@@ -195,12 +183,7 @@ export const useAssociatedStyles = ({
|
|
|
195
183
|
);
|
|
196
184
|
|
|
197
185
|
const hasPreviousKeys = hasAnyKeys(previousAppliedKeys.value);
|
|
198
|
-
|
|
199
186
|
const isTransitioning = isAnimating.get() !== 0 || isClosing.get() !== 0;
|
|
200
|
-
const isTransitionProgressInFlight =
|
|
201
|
-
progress.get() < TRANSITION_PROGRESS_COMPLETE;
|
|
202
|
-
const isTransitionInFlight =
|
|
203
|
-
isTransitioning || isTransitionProgressInFlight;
|
|
204
187
|
|
|
205
188
|
const canUsePreviousTransitionEvidence =
|
|
206
189
|
resetTransformOnUnset && allowPreviousTransitionEvidence(id);
|
|
@@ -218,14 +201,6 @@ export const useAssociatedStyles = ({
|
|
|
218
201
|
(!!BoundStore.getSnapshot(id, previousScreenKey) ||
|
|
219
202
|
BoundStore.hasBoundaryPresence(id, previousScreenKey));
|
|
220
203
|
|
|
221
|
-
// Split intent:
|
|
222
|
-
// - incoming: strict signal for first-style hiding
|
|
223
|
-
// - in-flight: broad signal to keep existing styles from resetting
|
|
224
|
-
const shouldExpectIncomingStyle =
|
|
225
|
-
resetTransformOnUnset &&
|
|
226
|
-
((hasActiveLink && canUsePreviousTransitionEvidence) ||
|
|
227
|
-
hasPreviousTransitionEvidence);
|
|
228
|
-
|
|
229
204
|
const shouldProtectInFlightStyles =
|
|
230
205
|
resetTransformOnUnset && (hasActiveLink || hasPreviousTransitionEvidence);
|
|
231
206
|
|
|
@@ -234,7 +209,6 @@ export const useAssociatedStyles = ({
|
|
|
234
209
|
}
|
|
235
210
|
|
|
236
211
|
const hasPersistedResolvedStyle = !!lastResolvedBase.value;
|
|
237
|
-
const hasResolvedStyle = hasCurrentKeys || hasPersistedResolvedStyle;
|
|
238
212
|
|
|
239
213
|
const isTransientEmptyGap =
|
|
240
214
|
hasConfiguredInterpolator &&
|
|
@@ -255,32 +229,18 @@ export const useAssociatedStyles = ({
|
|
|
255
229
|
isTransientEmptyGap &&
|
|
256
230
|
emptyGraceFrameCount.value <= TRANSIENT_EMPTY_GRACE_FRAMES;
|
|
257
231
|
|
|
258
|
-
const
|
|
232
|
+
const shouldDelayUnset =
|
|
259
233
|
resetTransformOnUnset &&
|
|
260
234
|
shouldProtectInFlightStyles &&
|
|
261
235
|
(isTransitioning || isWithinGapGrace);
|
|
262
236
|
|
|
263
237
|
/**
|
|
264
238
|
* Associated-style state machine:
|
|
265
|
-
* - waiting-first-style: transition is expected but no style has resolved yet.
|
|
266
239
|
* - hold-last-style: transient empty frame; reuse last resolved style.
|
|
267
240
|
* - live: apply current resolved style normally.
|
|
268
241
|
*/
|
|
269
242
|
let mode: AssociatedStyleMode = "live";
|
|
270
|
-
if (
|
|
271
|
-
waitForFirstResolvedStyle &&
|
|
272
|
-
resetTransformOnUnset &&
|
|
273
|
-
hasConfiguredInterpolator &&
|
|
274
|
-
shouldExpectIncomingStyle &&
|
|
275
|
-
isTransitionInFlight &&
|
|
276
|
-
!hasResolvedStyle
|
|
277
|
-
) {
|
|
278
|
-
mode = "waiting-first-style";
|
|
279
|
-
} else if (
|
|
280
|
-
shouldDeferUnset &&
|
|
281
|
-
!hasCurrentKeys &&
|
|
282
|
-
hasPersistedResolvedStyle
|
|
283
|
-
) {
|
|
243
|
+
if (shouldDelayUnset && !hasCurrentKeys && hasPersistedResolvedStyle) {
|
|
284
244
|
mode = "hold-last-style";
|
|
285
245
|
}
|
|
286
246
|
|
|
@@ -292,11 +252,11 @@ export const useAssociatedStyles = ({
|
|
|
292
252
|
const unsetPatch = buildUnsetPatch({
|
|
293
253
|
previousKeys: previousAppliedKeys.value,
|
|
294
254
|
currentKeys,
|
|
295
|
-
shouldDeferUnset,
|
|
255
|
+
shouldDeferUnset: shouldDelayUnset,
|
|
296
256
|
resetTransformOnUnset,
|
|
297
257
|
});
|
|
298
258
|
|
|
299
|
-
if (
|
|
259
|
+
if (shouldDelayUnset) {
|
|
300
260
|
previousAppliedKeys.value = {
|
|
301
261
|
...previousAppliedKeys.value,
|
|
302
262
|
...currentKeys,
|
|
@@ -311,10 +271,6 @@ export const useAssociatedStyles = ({
|
|
|
311
271
|
}
|
|
312
272
|
}
|
|
313
273
|
|
|
314
|
-
if (mode === "waiting-first-style") {
|
|
315
|
-
return { ...unsetPatch, opacity: 0 };
|
|
316
|
-
}
|
|
317
|
-
|
|
318
274
|
const mergedBase = { ...unsetPatch, ...resolvedBase };
|
|
319
275
|
|
|
320
276
|
let opacity = 1;
|
package/src/shared/index.ts
CHANGED
|
@@ -26,9 +26,8 @@ export default {
|
|
|
26
26
|
|
|
27
27
|
export { snapTo } from "./animation/snap-to";
|
|
28
28
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
NAVIGATION_MASK_STYLE_ID,
|
|
29
|
+
NAVIGATION_MASK_CONTAINER_STYLE_ID,
|
|
30
|
+
NAVIGATION_MASK_ELEMENT_STYLE_ID,
|
|
32
31
|
} from "./constants";
|
|
33
32
|
export {
|
|
34
33
|
type ScreenGestureTarget,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
2
3
|
import type {
|
|
3
4
|
GestureStateChangeEvent,
|
|
4
5
|
GestureTouchEvent,
|
|
@@ -32,8 +33,8 @@ import type {
|
|
|
32
33
|
} from "../../../types/ownership.types";
|
|
33
34
|
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
34
35
|
import type { EffectiveSnapPointsResult } from "../../../utils/gesture/validate-snap-points";
|
|
36
|
+
import { resolveSheetScrollGestureBehavior } from "../../../utils/resolve-screen-transition-options";
|
|
35
37
|
import { useDescriptors } from "../../screen/descriptors";
|
|
36
|
-
import { useViewportContext } from "../../viewport.provider";
|
|
37
38
|
import {
|
|
38
39
|
applyOffsetRules,
|
|
39
40
|
checkScrollBoundary,
|
|
@@ -99,7 +100,7 @@ interface UseScreenGestureHandlersProps {
|
|
|
99
100
|
* - No → continue
|
|
100
101
|
* 5. OFFSET THRESHOLD: Wait for sufficient touch movement
|
|
101
102
|
* 6. SCROLLVIEW CHECK: If touch is on ScrollView, is it at boundary?
|
|
102
|
-
* 7. EXPAND CHECK (snap sheets): If expanding
|
|
103
|
+
* 7. EXPAND CHECK (snap sheets): If expanding from nested scroll content, does sheetScrollGestureBehavior allow it?
|
|
103
104
|
* 8. ACTIVATE!
|
|
104
105
|
* ```
|
|
105
106
|
*
|
|
@@ -144,12 +145,14 @@ export const useHandlers = ({
|
|
|
144
145
|
gestureReleaseVelocityMax = DEFAULT_GESTURE_RELEASE_VELOCITY_MAX,
|
|
145
146
|
gestureActivationArea = DEFAULT_GESTURE_ACTIVATION_AREA,
|
|
146
147
|
gestureSnapLocked = DEFAULT_GESTURE_SNAP_LOCKED,
|
|
147
|
-
expandViaScrollView = true,
|
|
148
148
|
gestureResponseDistance,
|
|
149
149
|
transitionSpec,
|
|
150
150
|
} = current.options;
|
|
151
|
+
const sheetScrollGestureBehavior = resolveSheetScrollGestureBehavior(
|
|
152
|
+
current.options,
|
|
153
|
+
);
|
|
151
154
|
|
|
152
|
-
const
|
|
155
|
+
const dimensions = useWindowDimensions();
|
|
153
156
|
const routeKey = current.route.key;
|
|
154
157
|
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
155
158
|
const gestureAnimationValues = GestureStore.getRouteGestures(routeKey);
|
|
@@ -296,7 +299,7 @@ export const useHandlers = ({
|
|
|
296
299
|
directions.snapAxisInverted ?? false,
|
|
297
300
|
)
|
|
298
301
|
) {
|
|
299
|
-
if (
|
|
302
|
+
if (sheetScrollGestureBehavior === "collapse-only") {
|
|
300
303
|
manager.fail();
|
|
301
304
|
return;
|
|
302
305
|
}
|
|
@@ -67,6 +67,7 @@ const GESTURE_FAIL_TOLERANCE_Y = 20;
|
|
|
67
67
|
const DEFAULT_EDGE_DISTANCE_HORIZONTAL = 50;
|
|
68
68
|
const DEFAULT_EDGE_DISTANCE_VERTICAL = 135;
|
|
69
69
|
const DEFAULT_ACTIVATION_AREA = "screen" as const;
|
|
70
|
+
const SCROLL_EPILSON = 1;
|
|
70
71
|
|
|
71
72
|
export function normalizeSides(area?: GestureActivationArea): NormalizedSides {
|
|
72
73
|
"worklet";
|
|
@@ -352,6 +353,10 @@ export function checkScrollBoundary(
|
|
|
352
353
|
// Calculate max scroll values
|
|
353
354
|
const maxScrollX = Math.max(0, contentWidth - layoutWidth);
|
|
354
355
|
const maxScrollY = Math.max(0, contentHeight - layoutHeight);
|
|
356
|
+
const atTop = scrollY <= SCROLL_EPILSON;
|
|
357
|
+
const atBottom = scrollY >= maxScrollY - SCROLL_EPILSON;
|
|
358
|
+
const atLeft = scrollX <= SCROLL_EPILSON;
|
|
359
|
+
const atRight = scrollX >= maxScrollX - SCROLL_EPILSON;
|
|
355
360
|
|
|
356
361
|
// For snap point sheets (snapAxisInverted is defined), boundary depends on sheet origin
|
|
357
362
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
@@ -362,12 +367,12 @@ export function checkScrollBoundary(
|
|
|
362
367
|
if (isVerticalDirection) {
|
|
363
368
|
// Bottom sheet (not inverted): boundary at scroll top
|
|
364
369
|
// Top sheet (inverted): boundary at scroll bottom
|
|
365
|
-
return snapAxisInverted ?
|
|
370
|
+
return snapAxisInverted ? atBottom : atTop;
|
|
366
371
|
}
|
|
367
372
|
// Horizontal direction
|
|
368
373
|
// Right drawer (not inverted): boundary at scroll left
|
|
369
374
|
// Left drawer (inverted): boundary at scroll right
|
|
370
|
-
return snapAxisInverted ?
|
|
375
|
+
return snapAxisInverted ? atRight : atLeft;
|
|
371
376
|
}
|
|
372
377
|
|
|
373
378
|
// Non-sheet screens: each direction has its own boundary
|
|
@@ -375,22 +380,22 @@ export function checkScrollBoundary(
|
|
|
375
380
|
case "vertical":
|
|
376
381
|
// Swipe down - check if at top of vertical scroll
|
|
377
382
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
378
|
-
return
|
|
383
|
+
return atTop;
|
|
379
384
|
|
|
380
385
|
case "vertical-inverted":
|
|
381
386
|
// Swipe up - check if at bottom of vertical scroll
|
|
382
387
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
383
|
-
return
|
|
388
|
+
return atBottom;
|
|
384
389
|
|
|
385
390
|
case "horizontal":
|
|
386
391
|
// Swipe right - check if at left of horizontal scroll
|
|
387
392
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
388
|
-
return
|
|
393
|
+
return atLeft;
|
|
389
394
|
|
|
390
395
|
case "horizontal-inverted":
|
|
391
396
|
// Swipe left - check if at right of horizontal scroll
|
|
392
397
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
393
|
-
return
|
|
398
|
+
return atRight;
|
|
394
399
|
|
|
395
400
|
default:
|
|
396
401
|
return true;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { type ReactNode, useCallback, useMemo } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { useWindowDimensions, type View } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
type AnimatedRef,
|
|
5
5
|
type MeasuredDimensions,
|
|
6
6
|
measure,
|
|
7
7
|
} from "react-native-reanimated";
|
|
8
8
|
import createProvider from "../utils/create-provider";
|
|
9
|
-
import { useViewportContext } from "./viewport.provider";
|
|
10
9
|
|
|
11
10
|
interface LayoutAnchorProviderProps {
|
|
12
11
|
anchorRef: AnimatedRef<View>;
|
|
@@ -48,9 +47,7 @@ const { LayoutAnchorProvider, useLayoutAnchorContext } = createProvider(
|
|
|
48
47
|
{ guarded: false },
|
|
49
48
|
)<LayoutAnchorProviderProps, LayoutAnchorContextValue>(
|
|
50
49
|
({ anchorRef, children }) => {
|
|
51
|
-
const {
|
|
52
|
-
dimensions: { width: screenWidth, height: screenHeight },
|
|
53
|
-
} = useViewportContext();
|
|
50
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
54
51
|
|
|
55
52
|
const correctMeasurement = useCallback(
|
|
56
53
|
(measured: MeasuredDimensions): MeasuredDimensions => {
|
|
@@ -207,7 +207,7 @@ const useParentSyncReaction = (params: {
|
|
|
207
207
|
const CloseRemeasureReactionEffect = (params: {
|
|
208
208
|
sharedBoundTag: string;
|
|
209
209
|
remeasureOnFocus: boolean;
|
|
210
|
-
nextClosing:
|
|
210
|
+
nextClosing: SharedValue<number>;
|
|
211
211
|
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
212
212
|
}) => {
|
|
213
213
|
const {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
2
3
|
import {
|
|
3
4
|
type DerivedValue,
|
|
4
5
|
type SharedValue,
|
|
5
6
|
useDerivedValue,
|
|
6
7
|
useSharedValue,
|
|
7
8
|
} from "react-native-reanimated";
|
|
9
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
10
|
import type { NativeStackScreenTransitionConfig } from "../../../../../native-stack/types";
|
|
9
11
|
import {
|
|
10
12
|
createScreenTransitionState,
|
|
@@ -25,7 +27,8 @@ import type { BoundsAccessor } from "../../../../types/bounds.types";
|
|
|
25
27
|
import type { ScreenTransitionConfig } from "../../../../types/screen.types";
|
|
26
28
|
import type { BaseStackRoute } from "../../../../types/stack.types";
|
|
27
29
|
import { createBoundsAccessor } from "../../../../utils/bounds";
|
|
28
|
-
import {
|
|
30
|
+
import type { BoundsFrameProps } from "../../../../utils/bounds/types/frame-props";
|
|
31
|
+
import { resolveNavigationMaskEnabled } from "../../../../utils/resolve-screen-transition-options";
|
|
29
32
|
import { type BaseDescriptor, useDescriptors } from "../../descriptors";
|
|
30
33
|
import { derivations } from "./derivations";
|
|
31
34
|
import { toPlainRoute, toPlainValue } from "./worklet";
|
|
@@ -153,7 +156,8 @@ const hasTransitionsEnabled = (
|
|
|
153
156
|
|
|
154
157
|
export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
155
158
|
const { flags, stackProgress: rootStackProgress, routeKeys } = useStack();
|
|
156
|
-
const
|
|
159
|
+
const dimensions = useWindowDimensions();
|
|
160
|
+
const insets = useSafeAreaInsets();
|
|
157
161
|
const transitionsAlwaysOn = flags.TRANSITIONS_ALWAYS_ON;
|
|
158
162
|
|
|
159
163
|
const {
|
|
@@ -192,15 +196,20 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
192
196
|
currentRouteKey ?? "_",
|
|
193
197
|
"autoSnapPoint",
|
|
194
198
|
);
|
|
199
|
+
const contentLayoutValue = AnimationStore.getAnimation(
|
|
200
|
+
currentRouteKey ?? "_",
|
|
201
|
+
"contentLayout",
|
|
202
|
+
);
|
|
195
203
|
|
|
196
204
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
197
205
|
const nextHasTransitions =
|
|
198
206
|
!!nextRouteKey &&
|
|
199
207
|
hasTransitionsEnabled(nextDescriptor?.options, transitionsAlwaysOn);
|
|
208
|
+
const currentNavigationMaskEnabled = resolveNavigationMaskEnabled(
|
|
209
|
+
currentDescriptor?.options ?? {},
|
|
210
|
+
);
|
|
200
211
|
|
|
201
|
-
const framePropsMutable = useSharedValue<
|
|
202
|
-
Omit<ScreenInterpolationProps, "bounds">
|
|
203
|
-
>({
|
|
212
|
+
const framePropsMutable = useSharedValue<BoundsFrameProps>({
|
|
204
213
|
layouts: { screen: dimensions },
|
|
205
214
|
insets,
|
|
206
215
|
previous: undefined,
|
|
@@ -209,6 +218,7 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
209
218
|
progress: 0,
|
|
210
219
|
stackProgress: 0,
|
|
211
220
|
snapIndex: -1,
|
|
221
|
+
navigationMaskEnabled: false,
|
|
212
222
|
focused: true,
|
|
213
223
|
active: DEFAULT_SCREEN_TRANSITION_STATE,
|
|
214
224
|
inactive: undefined,
|
|
@@ -261,8 +271,11 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
261
271
|
|
|
262
272
|
const snapIndex = computeSnapIndex(current.progress, resolvedSnapPoints);
|
|
263
273
|
|
|
264
|
-
const nextProps = {
|
|
265
|
-
layouts: {
|
|
274
|
+
const nextProps: Omit<ScreenInterpolationProps, "bounds"> = {
|
|
275
|
+
layouts: {
|
|
276
|
+
screen: dimensions,
|
|
277
|
+
content: contentLayoutValue.value ?? undefined,
|
|
278
|
+
},
|
|
266
279
|
insets,
|
|
267
280
|
previous,
|
|
268
281
|
current,
|
|
@@ -273,7 +286,10 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
273
286
|
...helpers,
|
|
274
287
|
};
|
|
275
288
|
|
|
276
|
-
framePropsMutable.value =
|
|
289
|
+
framePropsMutable.value = {
|
|
290
|
+
...nextProps,
|
|
291
|
+
navigationMaskEnabled: currentNavigationMaskEnabled,
|
|
292
|
+
};
|
|
277
293
|
return nextProps;
|
|
278
294
|
});
|
|
279
295
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { NormalizedTransitionInterpolatedStyle } from "../../../types/animation.types";
|
|
2
|
+
import { normalizeInterpolatedStyle } from "../../../utils/normalize-interpolated-style";
|
|
3
|
+
|
|
4
|
+
export type ScreenStyleResolutionMode = "pass-through" | "deferred" | "live";
|
|
5
|
+
|
|
6
|
+
export type ResolvedInterpolatedStyleOutput = {
|
|
7
|
+
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
8
|
+
resolutionMode: ScreenStyleResolutionMode;
|
|
9
|
+
wasLegacy: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const EMPTY_STYLES = {} as NormalizedTransitionInterpolatedStyle;
|
|
13
|
+
|
|
14
|
+
export const PASS_THROUGH_STYLE_OUTPUT: ResolvedInterpolatedStyleOutput = {
|
|
15
|
+
stylesMap: EMPTY_STYLES,
|
|
16
|
+
resolutionMode: "pass-through",
|
|
17
|
+
wasLegacy: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const resolveInterpolatedStyleOutput = (
|
|
21
|
+
raw: Record<string, any> | null | undefined,
|
|
22
|
+
): ResolvedInterpolatedStyleOutput => {
|
|
23
|
+
"worklet";
|
|
24
|
+
|
|
25
|
+
// If raw is null, the user is intentionally asking to defer.
|
|
26
|
+
if (raw === null) {
|
|
27
|
+
return {
|
|
28
|
+
stylesMap: EMPTY_STYLES,
|
|
29
|
+
resolutionMode: "deferred",
|
|
30
|
+
wasLegacy: false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { result, wasLegacy } = normalizeInterpolatedStyle(raw ?? EMPTY_STYLES);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
stylesMap: result,
|
|
38
|
+
resolutionMode: "live",
|
|
39
|
+
wasLegacy,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -8,8 +8,12 @@ import { NO_STYLES } from "../../constants";
|
|
|
8
8
|
import type { NormalizedTransitionInterpolatedStyle } from "../../types/animation.types";
|
|
9
9
|
import createProvider from "../../utils/create-provider";
|
|
10
10
|
import { logger } from "../../utils/logger";
|
|
11
|
-
import { normalizeInterpolatedStyle } from "../../utils/normalize-interpolated-style";
|
|
12
11
|
import { useScreenAnimationContext } from "./animation";
|
|
12
|
+
import {
|
|
13
|
+
PASS_THROUGH_STYLE_OUTPUT,
|
|
14
|
+
resolveInterpolatedStyleOutput,
|
|
15
|
+
type ScreenStyleResolutionMode,
|
|
16
|
+
} from "./helpers/resolve-interpolated-style-output";
|
|
13
17
|
|
|
14
18
|
type Props = {
|
|
15
19
|
children: ReactNode;
|
|
@@ -18,9 +22,10 @@ type Props = {
|
|
|
18
22
|
type ScreenStylesContextValue = {
|
|
19
23
|
stylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
20
24
|
ancestorStylesMaps: SharedValue<NormalizedTransitionInterpolatedStyle>[];
|
|
25
|
+
resolutionMode: SharedValue<ScreenStyleResolutionMode>;
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
const {
|
|
28
|
+
export const {
|
|
24
29
|
ScreenStylesProvider,
|
|
25
30
|
ScreenStylesContext,
|
|
26
31
|
useScreenStylesContext: useScreenStyles,
|
|
@@ -44,80 +49,99 @@ const {
|
|
|
44
49
|
const isGesturingDuringCloseAnimation = useSharedValue(false);
|
|
45
50
|
const hasWarnedLegacy = useSharedValue(false);
|
|
46
51
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
52
|
+
const styleResolution = useDerivedValue<{
|
|
53
|
+
stylesMap: NormalizedTransitionInterpolatedStyle;
|
|
54
|
+
resolutionMode: ScreenStyleResolutionMode;
|
|
55
|
+
}>(() => {
|
|
56
|
+
"worklet";
|
|
57
|
+
const props = screenInterpolatorProps.value;
|
|
58
|
+
const { current, next, progress } = props;
|
|
59
|
+
const isDragging = current.gesture.dragging;
|
|
60
|
+
const isNextClosing = !!next?.closing;
|
|
61
|
+
|
|
62
|
+
if (isDragging && isNextClosing) {
|
|
63
|
+
isGesturingDuringCloseAnimation.value = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!isDragging && !isNextClosing) {
|
|
67
|
+
isGesturingDuringCloseAnimation.value = false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const isInGestureMode =
|
|
71
|
+
isDragging || isGesturingDuringCloseAnimation.value;
|
|
72
|
+
|
|
73
|
+
// Select interpolator
|
|
74
|
+
// - If in gesture mode, use current screen's interpolator since we're driving
|
|
75
|
+
// the animation from this screen (dragging back to dismiss next).
|
|
76
|
+
const interpolator = isInGestureMode
|
|
77
|
+
? currentInterpolator
|
|
78
|
+
: (nextInterpolator ?? currentInterpolator);
|
|
79
|
+
|
|
80
|
+
if (!interpolator) {
|
|
81
|
+
return PASS_THROUGH_STYLE_OUTPUT;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Build effective props with corrected progress
|
|
85
|
+
// - Gesture mode: use current.progress only (avoids jumps during drag)
|
|
86
|
+
// - Normal: use derived progress as-is
|
|
87
|
+
|
|
88
|
+
let effectiveProgress = progress;
|
|
89
|
+
let effectiveNext = next;
|
|
90
|
+
|
|
91
|
+
if (isInGestureMode) {
|
|
92
|
+
effectiveProgress = current.progress;
|
|
93
|
+
effectiveNext = undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const raw = interpolator({
|
|
98
|
+
...props,
|
|
99
|
+
progress: effectiveProgress,
|
|
100
|
+
next: effectiveNext,
|
|
101
|
+
bounds: boundsAccessor,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const { stylesMap, resolutionMode, wasLegacy } =
|
|
105
|
+
resolveInterpolatedStyleOutput(raw);
|
|
106
|
+
|
|
107
|
+
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
108
|
+
hasWarnedLegacy.value = true;
|
|
109
|
+
logger.warn(
|
|
110
|
+
"Flat interpolator return shape (contentStyle/backdropStyle) is deprecated. " +
|
|
111
|
+
"Use the nested format instead: { content: { style }, backdrop: { style } }.",
|
|
112
|
+
);
|
|
86
113
|
}
|
|
87
114
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
raw as Record<string, any>,
|
|
115
|
+
return {
|
|
116
|
+
stylesMap,
|
|
117
|
+
resolutionMode,
|
|
118
|
+
};
|
|
119
|
+
} catch (err) {
|
|
120
|
+
if (__DEV__) {
|
|
121
|
+
console.warn(
|
|
122
|
+
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
123
|
+
err,
|
|
98
124
|
);
|
|
99
|
-
|
|
100
|
-
if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
|
|
101
|
-
hasWarnedLegacy.value = true;
|
|
102
|
-
logger.warn(
|
|
103
|
-
"Flat interpolator return shape (contentStyle/backdropStyle) is deprecated. " +
|
|
104
|
-
"Use the nested format instead: { content: { style }, backdrop: { style } }.",
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return result;
|
|
109
|
-
} catch (err) {
|
|
110
|
-
if (__DEV__) {
|
|
111
|
-
console.warn(
|
|
112
|
-
"[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
|
|
113
|
-
err,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
return NO_STYLES as NormalizedTransitionInterpolatedStyle;
|
|
117
125
|
}
|
|
126
|
+
return {
|
|
127
|
+
stylesMap: NO_STYLES as NormalizedTransitionInterpolatedStyle,
|
|
128
|
+
resolutionMode: "live" as const,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const stylesMap = useDerivedValue<NormalizedTransitionInterpolatedStyle>(
|
|
134
|
+
() => {
|
|
135
|
+
"worklet";
|
|
136
|
+
return styleResolution.value.stylesMap;
|
|
118
137
|
},
|
|
119
138
|
);
|
|
120
139
|
|
|
140
|
+
const resolutionMode = useDerivedValue<ScreenStyleResolutionMode>(() => {
|
|
141
|
+
"worklet";
|
|
142
|
+
return styleResolution.value.resolutionMode;
|
|
143
|
+
});
|
|
144
|
+
|
|
121
145
|
const value = useMemo<ScreenStylesContextValue>(() => {
|
|
122
146
|
// Build ancestor chain: [parent, grandparent, great-grandparent, ...]
|
|
123
147
|
const ancestorStylesMaps = parentCtx
|
|
@@ -127,11 +151,10 @@ const {
|
|
|
127
151
|
return {
|
|
128
152
|
stylesMap,
|
|
129
153
|
ancestorStylesMaps,
|
|
154
|
+
resolutionMode,
|
|
130
155
|
};
|
|
131
|
-
}, [stylesMap, parentCtx]);
|
|
156
|
+
}, [resolutionMode, stylesMap, parentCtx]);
|
|
132
157
|
|
|
133
158
|
return { value, children };
|
|
134
159
|
},
|
|
135
160
|
);
|
|
136
|
-
|
|
137
|
-
export { ScreenStylesProvider, useScreenStyles };
|