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
|
@@ -52,42 +52,74 @@ export const NativeScreen = ({
|
|
|
52
52
|
const { activeScreensLimit, backdropBehaviors } = useManagedStackContext();
|
|
53
53
|
|
|
54
54
|
const routesLength = routes.length;
|
|
55
|
+
const topIndex = routesLength - 1;
|
|
56
|
+
const topRouteKey = routes[topIndex]?.key ?? routeKey;
|
|
55
57
|
const screenRef = useAnimatedRef<View>();
|
|
56
58
|
|
|
57
|
-
const sceneProgress = AnimationStore.getRouteAnimation(routeKey, "progress");
|
|
58
59
|
const sceneClosing = AnimationStore.getRouteAnimation(routeKey, "closing");
|
|
60
|
+
const topSceneProgress = AnimationStore.getRouteAnimation(
|
|
61
|
+
topRouteKey,
|
|
62
|
+
"progress",
|
|
63
|
+
);
|
|
64
|
+
const topSceneClosing = AnimationStore.getRouteAnimation(
|
|
65
|
+
topRouteKey,
|
|
66
|
+
"closing",
|
|
67
|
+
);
|
|
59
68
|
const screenActivity = useSharedValue<ScreenActivity>(
|
|
60
69
|
ScreenActivity.TRANSITIONING_OR_BELOW_TOP,
|
|
61
70
|
);
|
|
62
71
|
|
|
63
72
|
useDerivedValue(() => {
|
|
64
|
-
if (!
|
|
73
|
+
if (!topSceneProgress) {
|
|
65
74
|
screenActivity.set(ScreenActivity.TRANSITIONING_OR_BELOW_TOP);
|
|
66
75
|
return;
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
if (index < routesLength - activeScreensLimit - 1 || isPreloaded) {
|
|
70
79
|
screenActivity.set(ScreenActivity.INACTIVE);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const focusedIndex = optimisticFocusedIndex.value;
|
|
84
|
+
const topIsClosing =
|
|
85
|
+
topSceneClosing.get() > 0 && focusedIndex >= 0 && focusedIndex < topIndex;
|
|
86
|
+
|
|
87
|
+
if (topIsClosing) {
|
|
88
|
+
const postCloseActiveStart = Math.max(
|
|
89
|
+
0,
|
|
90
|
+
focusedIndex - activeScreensLimit + 1,
|
|
91
|
+
);
|
|
92
|
+
const next =
|
|
93
|
+
index === topIndex
|
|
74
94
|
? ScreenActivity.ON_TOP
|
|
75
|
-
: index
|
|
95
|
+
: index > focusedIndex || index >= postCloseActiveStart
|
|
76
96
|
? ScreenActivity.TRANSITIONING_OR_BELOW_TOP
|
|
77
97
|
: ScreenActivity.INACTIVE;
|
|
78
98
|
|
|
79
|
-
const v = interpolate(
|
|
80
|
-
sceneProgress.get(),
|
|
81
|
-
[0, 1 - EPSILON, 1],
|
|
82
|
-
[1, 1, outputValue],
|
|
83
|
-
Extrapolation.CLAMP,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const next = Math.trunc(v) ?? ScreenActivity.TRANSITIONING_OR_BELOW_TOP;
|
|
87
|
-
|
|
88
99
|
if (next !== screenActivity.get()) {
|
|
89
100
|
screenActivity.set(next);
|
|
90
101
|
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const outputValue =
|
|
106
|
+
index === topIndex
|
|
107
|
+
? ScreenActivity.ON_TOP
|
|
108
|
+
: index >= routesLength - activeScreensLimit
|
|
109
|
+
? ScreenActivity.TRANSITIONING_OR_BELOW_TOP
|
|
110
|
+
: ScreenActivity.INACTIVE;
|
|
111
|
+
|
|
112
|
+
const v = interpolate(
|
|
113
|
+
topSceneProgress.get(),
|
|
114
|
+
[0, 1 - EPSILON, 1],
|
|
115
|
+
[1, 1, outputValue],
|
|
116
|
+
Extrapolation.CLAMP,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const next = Math.trunc(v) ?? ScreenActivity.TRANSITIONING_OR_BELOW_TOP;
|
|
120
|
+
|
|
121
|
+
if (next !== screenActivity.get()) {
|
|
122
|
+
screenActivity.set(next);
|
|
91
123
|
}
|
|
92
124
|
});
|
|
93
125
|
|
|
@@ -126,12 +158,25 @@ export const NativeScreen = ({
|
|
|
126
158
|
};
|
|
127
159
|
});
|
|
128
160
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
if (DISABLE_NATIVE_SCREENS) {
|
|
162
|
+
return (
|
|
163
|
+
<Animated.View
|
|
164
|
+
ref={screenRef}
|
|
165
|
+
// Keep a native boundary per screen when falling back to plain views.
|
|
166
|
+
// Android release builds can otherwise flatten sibling screens together.
|
|
167
|
+
collapsable={false}
|
|
168
|
+
style={StyleSheet.absoluteFill}
|
|
169
|
+
animatedProps={animatedProps}
|
|
170
|
+
>
|
|
171
|
+
<LayoutAnchorProvider anchorRef={screenRef}>
|
|
172
|
+
{children}
|
|
173
|
+
</LayoutAnchorProvider>
|
|
174
|
+
</Animated.View>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
132
177
|
|
|
133
178
|
return (
|
|
134
|
-
<
|
|
179
|
+
<AnimatedNativeScreen
|
|
135
180
|
enabled
|
|
136
181
|
ref={screenRef}
|
|
137
182
|
style={StyleSheet.absoluteFill}
|
|
@@ -141,6 +186,6 @@ export const NativeScreen = ({
|
|
|
141
186
|
<LayoutAnchorProvider anchorRef={screenRef}>
|
|
142
187
|
{children}
|
|
143
188
|
</LayoutAnchorProvider>
|
|
144
|
-
</
|
|
189
|
+
</AnimatedNativeScreen>
|
|
145
190
|
);
|
|
146
191
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
+
import { HIDDEN_STYLE, NO_STYLES } from "../../constants";
|
|
5
|
+
import { useScreenStyles } from "../../providers/screen/styles.provider";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Hides the full screen visual subtree while an interpolator explicitly reports
|
|
13
|
+
* that it is not safe to reveal yet.
|
|
14
|
+
*
|
|
15
|
+
* This sits above backdrop/content/mask/surface so a deferred transition does
|
|
16
|
+
* not leak raw first-paint UI from nested layers.
|
|
17
|
+
*/
|
|
18
|
+
export const DeferredVisibilityHost = memo(({ children }: Props) => {
|
|
19
|
+
const { resolutionMode } = useScreenStyles();
|
|
20
|
+
|
|
21
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
22
|
+
"worklet";
|
|
23
|
+
return resolutionMode.value === "deferred" ? HIDDEN_STYLE : NO_STYLES;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Animated.View collapsable={false} style={[styles.host, animatedStyle]}>
|
|
28
|
+
{children}
|
|
29
|
+
</Animated.View>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
host: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { type LayoutChangeEvent, useWindowDimensions } from "react-native";
|
|
3
|
+
import { runOnUI } from "react-native-reanimated";
|
|
4
|
+
import {
|
|
5
|
+
useDescriptorDerivations,
|
|
6
|
+
useDescriptors,
|
|
7
|
+
} from "../../../providers/screen/descriptors";
|
|
8
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
9
|
+
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
10
|
+
|
|
11
|
+
export function useContentLayout() {
|
|
12
|
+
const { current } = useDescriptors();
|
|
13
|
+
const { isFirstKey } = useDescriptorDerivations();
|
|
14
|
+
const { height: screenHeight } = useWindowDimensions();
|
|
15
|
+
const routeKey = current.route.key;
|
|
16
|
+
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
17
|
+
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
18
|
+
routeKey,
|
|
19
|
+
"autoSnapPoint",
|
|
20
|
+
);
|
|
21
|
+
const contentLayoutValue = AnimationStore.getAnimation(
|
|
22
|
+
routeKey,
|
|
23
|
+
"contentLayout",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return useCallback(
|
|
27
|
+
(event: LayoutChangeEvent) => {
|
|
28
|
+
const { width, height } = event.nativeEvent.layout;
|
|
29
|
+
if (width <= 0 || height <= 0) return;
|
|
30
|
+
|
|
31
|
+
const fraction = Math.min(height / screenHeight, 1);
|
|
32
|
+
const transitionSpec = current.options.transitionSpec;
|
|
33
|
+
|
|
34
|
+
runOnUI(
|
|
35
|
+
(
|
|
36
|
+
nextWidth: number,
|
|
37
|
+
nextHeight: number,
|
|
38
|
+
nextFraction: number,
|
|
39
|
+
isInitialScreen: boolean,
|
|
40
|
+
spec: typeof transitionSpec,
|
|
41
|
+
) => {
|
|
42
|
+
"worklet";
|
|
43
|
+
contentLayoutValue.value = {
|
|
44
|
+
width: nextWidth,
|
|
45
|
+
height: nextHeight,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const isFirstMeasurement = autoSnapPointValue.value <= 0;
|
|
49
|
+
autoSnapPointValue.value = nextFraction;
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
!isFirstMeasurement ||
|
|
53
|
+
animations.progress.value !== 0 ||
|
|
54
|
+
animations.animating.value !== 0
|
|
55
|
+
) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (isInitialScreen) {
|
|
60
|
+
animations.targetProgress.value = nextFraction;
|
|
61
|
+
animations.progress.value = nextFraction;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
animateToProgress({
|
|
66
|
+
target: nextFraction,
|
|
67
|
+
spec,
|
|
68
|
+
animations,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
)(width, height, fraction, isFirstKey, transitionSpec);
|
|
72
|
+
},
|
|
73
|
+
[
|
|
74
|
+
animations,
|
|
75
|
+
autoSnapPointValue,
|
|
76
|
+
contentLayoutValue,
|
|
77
|
+
current.options.transitionSpec,
|
|
78
|
+
isFirstKey,
|
|
79
|
+
screenHeight,
|
|
80
|
+
],
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { DeferredVisibilityHost } from "./deferred-visibility-host";
|
|
3
4
|
import { useBackdropPointerEvents } from "./hooks/use-backdrop-pointer-events";
|
|
4
5
|
import { BackdropLayer } from "./layers/backdrop";
|
|
5
6
|
import { ContentLayer } from "./layers/content";
|
|
@@ -13,8 +14,10 @@ export const ScreenContainer = memo(({ children }: Props) => {
|
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
16
|
<View style={styles.container} pointerEvents={pointerEvents}>
|
|
16
|
-
<
|
|
17
|
-
|
|
17
|
+
<DeferredVisibilityHost>
|
|
18
|
+
<BackdropLayer />
|
|
19
|
+
<ContentLayer>{children}</ContentLayer>
|
|
20
|
+
</DeferredVisibilityHost>
|
|
18
21
|
</View>
|
|
19
22
|
);
|
|
20
23
|
});
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/noNonNullAssertion: <Screen gesture is under the gesture context, so this will always exist.> */
|
|
2
|
-
import { memo
|
|
3
|
-
import {
|
|
4
|
-
type LayoutChangeEvent,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
useWindowDimensions,
|
|
7
|
-
View,
|
|
8
|
-
} from "react-native";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
9
4
|
import { GestureDetector } from "react-native-gesture-handler";
|
|
10
5
|
import Animated, {
|
|
11
|
-
runOnUI,
|
|
12
6
|
useAnimatedProps,
|
|
13
7
|
useAnimatedStyle,
|
|
14
8
|
} from "react-native-reanimated";
|
|
15
|
-
import { NO_PROPS, NO_STYLES } from "../../../constants";
|
|
16
|
-
import { useGestureContext } from "../../../providers/gestures";
|
|
17
9
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
NAVIGATION_MASK_CONTAINER_STYLE_ID,
|
|
11
|
+
NO_PROPS,
|
|
12
|
+
NO_STYLES,
|
|
13
|
+
} from "../../../constants";
|
|
14
|
+
import { useGestureContext } from "../../../providers/gestures";
|
|
15
|
+
import { useDescriptors } from "../../../providers/screen/descriptors";
|
|
21
16
|
import { useScreenStyles } from "../../../providers/screen/styles.provider";
|
|
22
|
-
import {
|
|
23
|
-
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
17
|
+
import { resolveNavigationMaskEnabled } from "../../../utils/resolve-screen-transition-options";
|
|
24
18
|
import { useBackdropPointerEvents } from "../hooks/use-backdrop-pointer-events";
|
|
19
|
+
import { useContentLayout } from "../hooks/use-content-layout";
|
|
25
20
|
import { MaybeMaskedNavigationContainer } from "./maybe-masked-navigation-container";
|
|
26
21
|
import { SurfaceContainer } from "./surface-container";
|
|
27
22
|
|
|
@@ -32,78 +27,63 @@ type Props = {
|
|
|
32
27
|
export const ContentLayer = memo(({ children }: Props) => {
|
|
33
28
|
const { stylesMap } = useScreenStyles();
|
|
34
29
|
const { current } = useDescriptors();
|
|
35
|
-
const { isFirstKey } = useDescriptorDerivations();
|
|
36
30
|
const { pointerEvents, isBackdropActive } = useBackdropPointerEvents();
|
|
37
31
|
const gestureContext = useGestureContext();
|
|
38
|
-
const
|
|
39
|
-
const isNavigationMaskEnabled = !!current.options.maskEnabled;
|
|
32
|
+
const isNavigationMaskEnabled = resolveNavigationMaskEnabled(current.options);
|
|
40
33
|
const contentPointerEvents = isBackdropActive ? "box-none" : pointerEvents;
|
|
41
|
-
const routeKey = current.route.key;
|
|
42
|
-
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
43
|
-
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
44
|
-
routeKey,
|
|
45
|
-
"autoSnapPoint",
|
|
46
|
-
);
|
|
47
34
|
const hasAutoSnapPoint =
|
|
48
35
|
current.options.snapPoints?.includes("auto") ?? false;
|
|
49
36
|
|
|
37
|
+
const handleContentLayout = useContentLayout();
|
|
38
|
+
|
|
50
39
|
const animatedContentStyle = useAnimatedStyle(() => {
|
|
51
40
|
"worklet";
|
|
52
41
|
return stylesMap.value.content?.style || NO_STYLES;
|
|
53
42
|
});
|
|
54
43
|
|
|
44
|
+
const animatedNavigationContainerStyle = useAnimatedStyle(() => {
|
|
45
|
+
"worklet";
|
|
46
|
+
return (
|
|
47
|
+
stylesMap.value[NAVIGATION_MASK_CONTAINER_STYLE_ID]?.style || NO_STYLES
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
55
51
|
const animatedContentProps = useAnimatedProps(() => {
|
|
56
52
|
"worklet";
|
|
57
53
|
return stylesMap.value.content?.props ?? NO_PROPS;
|
|
58
54
|
});
|
|
59
55
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
isInitialScreen: boolean,
|
|
72
|
-
spec: typeof transitionSpec,
|
|
73
|
-
) => {
|
|
74
|
-
"worklet";
|
|
75
|
-
const isFirstMeasurement = autoSnapPointValue.value <= 0;
|
|
76
|
-
autoSnapPointValue.value = nextFraction;
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
!isFirstMeasurement ||
|
|
80
|
-
animations.progress.value !== 0 ||
|
|
81
|
-
animations.animating.value !== 0
|
|
82
|
-
) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
56
|
+
const surfaceChildren = (
|
|
57
|
+
<SurfaceContainer pointerEvents={contentPointerEvents}>
|
|
58
|
+
{hasAutoSnapPoint ? (
|
|
59
|
+
<View collapsable={false} onLayout={handleContentLayout}>
|
|
60
|
+
{children}
|
|
61
|
+
</View>
|
|
62
|
+
) : (
|
|
63
|
+
children
|
|
64
|
+
)}
|
|
65
|
+
</SurfaceContainer>
|
|
66
|
+
);
|
|
85
67
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
const navigationContainer = (
|
|
69
|
+
<Animated.View
|
|
70
|
+
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
71
|
+
pointerEvents={contentPointerEvents}
|
|
72
|
+
collapsable={false}
|
|
73
|
+
>
|
|
74
|
+
{surfaceChildren}
|
|
75
|
+
</Animated.View>
|
|
76
|
+
);
|
|
91
77
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
animations,
|
|
102
|
-
autoSnapPointValue,
|
|
103
|
-
current.options.transitionSpec,
|
|
104
|
-
isFirstKey,
|
|
105
|
-
screenHeight,
|
|
106
|
-
],
|
|
78
|
+
const navigationScopedChildren = isNavigationMaskEnabled ? (
|
|
79
|
+
<MaybeMaskedNavigationContainer
|
|
80
|
+
pointerEvents={contentPointerEvents}
|
|
81
|
+
enabled={isNavigationMaskEnabled}
|
|
82
|
+
>
|
|
83
|
+
{navigationContainer}
|
|
84
|
+
</MaybeMaskedNavigationContainer>
|
|
85
|
+
) : (
|
|
86
|
+
navigationContainer
|
|
107
87
|
);
|
|
108
88
|
|
|
109
89
|
return (
|
|
@@ -113,17 +93,7 @@ export const ContentLayer = memo(({ children }: Props) => {
|
|
|
113
93
|
animatedProps={animatedContentProps}
|
|
114
94
|
pointerEvents={contentPointerEvents}
|
|
115
95
|
>
|
|
116
|
-
|
|
117
|
-
<SurfaceContainer pointerEvents={contentPointerEvents}>
|
|
118
|
-
{hasAutoSnapPoint ? (
|
|
119
|
-
<View collapsable={false} onLayout={handleContentLayout}>
|
|
120
|
-
{children}
|
|
121
|
-
</View>
|
|
122
|
-
) : (
|
|
123
|
-
children
|
|
124
|
-
)}
|
|
125
|
-
</SurfaceContainer>
|
|
126
|
-
</MaybeMaskedNavigationContainer>
|
|
96
|
+
{navigationScopedChildren}
|
|
127
97
|
</Animated.View>
|
|
128
98
|
</GestureDetector>
|
|
129
99
|
);
|
|
@@ -133,4 +103,7 @@ const styles = StyleSheet.create({
|
|
|
133
103
|
content: {
|
|
134
104
|
flex: 1,
|
|
135
105
|
},
|
|
106
|
+
navigationContainer: {
|
|
107
|
+
flex: 1,
|
|
108
|
+
},
|
|
136
109
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { memo, useEffect } from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
2
|
+
import { StyleSheet, View, type ViewProps } from "react-native";
|
|
3
3
|
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
NAVIGATION_MASK_STYLE_ID,
|
|
5
|
+
NAVIGATION_MASK_ELEMENT_STYLE_ID,
|
|
7
6
|
NO_STYLES,
|
|
8
7
|
} from "../../../constants";
|
|
9
8
|
import { useScreenStyles } from "../../../providers/screen/styles.provider";
|
|
@@ -12,6 +11,7 @@ import { logger } from "../../../utils/logger";
|
|
|
12
11
|
type Props = {
|
|
13
12
|
enabled: boolean;
|
|
14
13
|
children: React.ReactNode;
|
|
14
|
+
pointerEvents: ViewProps["pointerEvents"];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
let LazyMaskedView = View;
|
|
@@ -25,16 +25,13 @@ try {
|
|
|
25
25
|
let hasWarnedMissingMaskedView = false;
|
|
26
26
|
|
|
27
27
|
export const MaybeMaskedNavigationContainer = memo(
|
|
28
|
-
({ enabled, children }: Props) => {
|
|
28
|
+
({ enabled, children, pointerEvents }: Props) => {
|
|
29
29
|
const { stylesMap } = useScreenStyles();
|
|
30
|
-
const animatedNavigationContainerStyle = useAnimatedStyle(() => {
|
|
31
|
-
"worklet";
|
|
32
|
-
return stylesMap.value[NAVIGATION_CONTAINER_STYLE_ID]?.style || NO_STYLES;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
30
|
const animatedNavigationMaskStyle = useAnimatedStyle(() => {
|
|
36
31
|
"worklet";
|
|
37
|
-
return
|
|
32
|
+
return (
|
|
33
|
+
stylesMap.value[NAVIGATION_MASK_ELEMENT_STYLE_ID]?.style || NO_STYLES
|
|
34
|
+
);
|
|
38
35
|
});
|
|
39
36
|
|
|
40
37
|
useEffect(() => {
|
|
@@ -44,20 +41,13 @@ export const MaybeMaskedNavigationContainer = memo(
|
|
|
44
41
|
|
|
45
42
|
hasWarnedMissingMaskedView = true;
|
|
46
43
|
logger.warn(
|
|
47
|
-
"
|
|
44
|
+
"navigationMaskEnabled requires @react-native-masked-view/masked-view. Install it to enable navigation bounds masking.",
|
|
48
45
|
);
|
|
49
46
|
}, [enabled]);
|
|
50
|
-
|
|
51
47
|
if (!enabled) return children;
|
|
52
48
|
|
|
53
49
|
if (LazyMaskedView === View) {
|
|
54
|
-
return
|
|
55
|
-
<Animated.View
|
|
56
|
-
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
57
|
-
>
|
|
58
|
-
{children}
|
|
59
|
-
</Animated.View>
|
|
60
|
-
);
|
|
50
|
+
return children;
|
|
61
51
|
}
|
|
62
52
|
|
|
63
53
|
return (
|
|
@@ -67,14 +57,12 @@ export const MaybeMaskedNavigationContainer = memo(
|
|
|
67
57
|
maskElement={
|
|
68
58
|
<Animated.View
|
|
69
59
|
style={[styles.navigationMaskElement, animatedNavigationMaskStyle]}
|
|
60
|
+
pointerEvents="none"
|
|
70
61
|
/>
|
|
71
62
|
}
|
|
63
|
+
pointerEvents={pointerEvents}
|
|
72
64
|
>
|
|
73
|
-
|
|
74
|
-
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</Animated.View>
|
|
65
|
+
{children}
|
|
78
66
|
</LazyMaskedView>
|
|
79
67
|
);
|
|
80
68
|
},
|
|
@@ -87,7 +75,4 @@ const styles = StyleSheet.create({
|
|
|
87
75
|
navigationMaskElement: {
|
|
88
76
|
backgroundColor: "white",
|
|
89
77
|
},
|
|
90
|
-
navigationContainer: {
|
|
91
|
-
flex: 1,
|
|
92
|
-
},
|
|
93
78
|
});
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
interpolateColor,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
NAVIGATION_MASK_CONTAINER_STYLE_ID,
|
|
9
|
+
NAVIGATION_MASK_ELEMENT_STYLE_ID,
|
|
10
10
|
} from "../constants";
|
|
11
11
|
import type { ScreenTransitionConfig } from "../types/screen.types";
|
|
12
12
|
import { normalizeInterpolatedStyle } from "../utils/normalize-interpolated-style";
|
|
@@ -286,10 +286,10 @@ export const SharedIGImage = ({
|
|
|
286
286
|
const sourceStyle = navigationStyles[sharedBoundTag] as
|
|
287
287
|
| Record<string, unknown>
|
|
288
288
|
| undefined;
|
|
289
|
-
const containerStyle = navigationStyles[
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const maskStyle = navigationStyles[
|
|
289
|
+
const containerStyle = navigationStyles[
|
|
290
|
+
NAVIGATION_MASK_CONTAINER_STYLE_ID
|
|
291
|
+
] as Record<string, unknown> | undefined;
|
|
292
|
+
const maskStyle = navigationStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] as
|
|
293
293
|
| Record<string, unknown>
|
|
294
294
|
| undefined;
|
|
295
295
|
|
|
@@ -317,7 +317,7 @@ export const SharedIGImage = ({
|
|
|
317
317
|
],
|
|
318
318
|
},
|
|
319
319
|
},
|
|
320
|
-
[
|
|
320
|
+
[NAVIGATION_MASK_CONTAINER_STYLE_ID]: containerStyle
|
|
321
321
|
? {
|
|
322
322
|
style: {
|
|
323
323
|
...containerStyle,
|
|
@@ -329,7 +329,7 @@ export const SharedIGImage = ({
|
|
|
329
329
|
},
|
|
330
330
|
}
|
|
331
331
|
: undefined,
|
|
332
|
-
[
|
|
332
|
+
[NAVIGATION_MASK_ELEMENT_STYLE_ID]: maskStyle
|
|
333
333
|
? {
|
|
334
334
|
style: {
|
|
335
335
|
...maskStyle,
|
|
@@ -623,7 +623,7 @@ export const SharedXImage = ({
|
|
|
623
623
|
const navigationStyles = bounds({
|
|
624
624
|
id: sharedBoundTag,
|
|
625
625
|
}).navigation.zoom();
|
|
626
|
-
const maskStyle = navigationStyles[
|
|
626
|
+
const maskStyle = navigationStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] as
|
|
627
627
|
| Record<string, unknown>
|
|
628
628
|
| undefined;
|
|
629
629
|
|
|
@@ -654,7 +654,7 @@ export const SharedXImage = ({
|
|
|
654
654
|
|
|
655
655
|
return {
|
|
656
656
|
...normalizedNav,
|
|
657
|
-
[
|
|
657
|
+
[NAVIGATION_MASK_ELEMENT_STYLE_ID]: maskStyle
|
|
658
658
|
? {
|
|
659
659
|
style: {
|
|
660
660
|
...maskStyle,
|
package/src/shared/constants.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { BaseStackRoute } from "./types/stack.types";
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Masked view integration
|
|
11
|
+
* @deprecated No longer in use. Use {@link NAVIGATION_MASK_ELEMENT_STYLE_ID} and {@link NAVIGATION_MASK_CONTAINER_STYLE_ID} instead.
|
|
11
12
|
*/
|
|
12
13
|
export const MASK_STYLE_ID = "_ROOT_MASKED";
|
|
13
14
|
export const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
@@ -15,14 +16,15 @@ export const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
|
|
|
15
16
|
/**
|
|
16
17
|
* Navigation mask integration
|
|
17
18
|
*/
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const NAVIGATION_CONTAINER_STYLE_ID = "_NAVIGATION_ROOT_CONTAINER";
|
|
19
|
+
export const NAVIGATION_MASK_ELEMENT_STYLE_ID = "_NAVIGATION_ROOT_MASK";
|
|
20
|
+
export const NAVIGATION_MASK_CONTAINER_STYLE_ID = "_NAVIGATION_ROOT_CONTAINER";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Styles
|
|
24
24
|
*/
|
|
25
25
|
export const NO_STYLES = Object.freeze({});
|
|
26
|
+
export const HIDDEN_STYLE = Object.freeze({ opacity: 0 });
|
|
27
|
+
export const VISIBLE_STYLE = Object.freeze({ opacity: 1 });
|
|
26
28
|
export const NO_PROPS = Object.freeze({});
|
|
27
29
|
|
|
28
30
|
/**
|