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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
|
+
NavigationContainer,
|
|
4
|
+
NavigationIndependentTree,
|
|
3
5
|
type NavigatorTypeBagBase,
|
|
4
6
|
type ParamListBase,
|
|
5
7
|
type StackActionHelpers,
|
|
@@ -10,16 +12,26 @@ import {
|
|
|
10
12
|
type TypedNavigator,
|
|
11
13
|
useNavigationBuilder,
|
|
12
14
|
} from "@react-navigation/native";
|
|
15
|
+
import * as React from "react";
|
|
13
16
|
import { useTabPressReset } from "../../shared/hooks/navigation/use-tab-press-reset";
|
|
14
17
|
import { StackView } from "../components/stack-view";
|
|
15
18
|
import type {
|
|
19
|
+
BlankStackFactoryOptions,
|
|
16
20
|
BlankStackNavigationEventMap,
|
|
17
21
|
BlankStackNavigationOptions,
|
|
18
22
|
BlankStackNavigationProp,
|
|
19
23
|
BlankStackNavigatorProps,
|
|
20
24
|
} from "../types";
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
type BlankStackNavigatorInnerProps = BlankStackNavigatorProps & {
|
|
27
|
+
DISABLE_NATIVE_SCREENS?: boolean;
|
|
28
|
+
DISABLE_NATIVE_SCREEN_CONTAINER?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const BlankStackContext = React.createContext<boolean>(false);
|
|
32
|
+
BlankStackContext.displayName = "BlankStackContext";
|
|
33
|
+
|
|
34
|
+
function BlankStackNavigatorInner({
|
|
23
35
|
id,
|
|
24
36
|
initialRouteName,
|
|
25
37
|
children,
|
|
@@ -27,8 +39,10 @@ function BlankStackNavigator({
|
|
|
27
39
|
screenListeners,
|
|
28
40
|
screenOptions,
|
|
29
41
|
screenLayout,
|
|
42
|
+
DISABLE_NATIVE_SCREENS,
|
|
43
|
+
DISABLE_NATIVE_SCREEN_CONTAINER,
|
|
30
44
|
...rest
|
|
31
|
-
}:
|
|
45
|
+
}: BlankStackNavigatorInnerProps) {
|
|
32
46
|
const { state, describe, descriptors, navigation, NavigationContent } =
|
|
33
47
|
useNavigationBuilder<
|
|
34
48
|
StackNavigationState<ParamListBase>,
|
|
@@ -52,6 +66,8 @@ function BlankStackNavigator({
|
|
|
52
66
|
<NavigationContent>
|
|
53
67
|
<StackView
|
|
54
68
|
{...rest}
|
|
69
|
+
DISABLE_NATIVE_SCREENS={DISABLE_NATIVE_SCREENS}
|
|
70
|
+
DISABLE_NATIVE_SCREEN_CONTAINER={DISABLE_NATIVE_SCREEN_CONTAINER}
|
|
55
71
|
state={state}
|
|
56
72
|
navigation={navigation}
|
|
57
73
|
descriptors={descriptors}
|
|
@@ -61,25 +77,128 @@ function BlankStackNavigator({
|
|
|
61
77
|
);
|
|
62
78
|
}
|
|
63
79
|
|
|
80
|
+
function createBlankStackNavigatorComponent({
|
|
81
|
+
independent,
|
|
82
|
+
enableNativeScreens,
|
|
83
|
+
}: Required<BlankStackFactoryOptions>) {
|
|
84
|
+
function BlankStackNavigator(props: BlankStackNavigatorProps) {
|
|
85
|
+
const isNested = React.useContext(BlankStackContext);
|
|
86
|
+
|
|
87
|
+
const navigator = (
|
|
88
|
+
<BlankStackNavigatorInner
|
|
89
|
+
{...props}
|
|
90
|
+
{...(!enableNativeScreens && {
|
|
91
|
+
DISABLE_NATIVE_SCREENS: true,
|
|
92
|
+
})}
|
|
93
|
+
DISABLE_NATIVE_SCREEN_CONTAINER={independent}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
if (!independent || isNested) {
|
|
98
|
+
return navigator;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<NavigationIndependentTree>
|
|
103
|
+
<NavigationContainer>
|
|
104
|
+
<BlankStackContext.Provider value={true}>
|
|
105
|
+
{navigator}
|
|
106
|
+
</BlankStackContext.Provider>
|
|
107
|
+
</NavigationContainer>
|
|
108
|
+
</NavigationIndependentTree>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
BlankStackNavigator.displayName = independent
|
|
113
|
+
? "IndependentBlankStackNavigator"
|
|
114
|
+
: "BlankStackNavigator";
|
|
115
|
+
|
|
116
|
+
return BlankStackNavigator;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const BlankStackNavigator = createBlankStackNavigatorComponent({
|
|
120
|
+
independent: false,
|
|
121
|
+
enableNativeScreens: true,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
type BlankStackTypeBag<
|
|
125
|
+
ParamList extends ParamListBase,
|
|
126
|
+
NavigatorID extends string | undefined,
|
|
127
|
+
> = {
|
|
128
|
+
ParamList: ParamList;
|
|
129
|
+
NavigatorID: NavigatorID;
|
|
130
|
+
State: StackNavigationState<ParamList>;
|
|
131
|
+
ScreenOptions: BlankStackNavigationOptions;
|
|
132
|
+
EventMap: BlankStackNavigationEventMap;
|
|
133
|
+
NavigationList: {
|
|
134
|
+
[RouteName in keyof ParamList]: BlankStackNavigationProp<
|
|
135
|
+
ParamList,
|
|
136
|
+
RouteName,
|
|
137
|
+
NavigatorID
|
|
138
|
+
>;
|
|
139
|
+
};
|
|
140
|
+
Navigator: typeof BlankStackNavigator;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Creates a blank stack navigator with gesture-driven transitions.
|
|
145
|
+
*
|
|
146
|
+
* By default, blank stack behaves like the existing top-level blank stack:
|
|
147
|
+
* it participates in the current navigation tree and uses native screen
|
|
148
|
+
* primitives on supported native platforms.
|
|
149
|
+
*
|
|
150
|
+
* Pass {@link BlankStackFactoryOptions} when you need embedded-flow behavior:
|
|
151
|
+
* - `independent: true` creates an isolated navigator for nested flows
|
|
152
|
+
* - `enableNativeScreens: false` renders the stack with regular views instead
|
|
153
|
+
* of `react-native-screens`
|
|
154
|
+
*
|
|
155
|
+
* These options are factory-only. Use screen options for per-screen transition
|
|
156
|
+
* behavior, and use factory options when you need to change how the navigator
|
|
157
|
+
* itself is hosted.
|
|
158
|
+
*/
|
|
159
|
+
export function createBlankStackNavigator<
|
|
160
|
+
const ParamList extends ParamListBase,
|
|
161
|
+
const NavigatorID extends string | undefined = undefined,
|
|
162
|
+
const TypeBag extends NavigatorTypeBagBase = BlankStackTypeBag<
|
|
163
|
+
ParamList,
|
|
164
|
+
NavigatorID
|
|
165
|
+
>,
|
|
166
|
+
>(): TypedNavigator<TypeBag, StaticConfig<TypeBag>>;
|
|
167
|
+
export function createBlankStackNavigator<
|
|
168
|
+
const ParamList extends ParamListBase,
|
|
169
|
+
const NavigatorID extends string | undefined = undefined,
|
|
170
|
+
const TypeBag extends NavigatorTypeBagBase = BlankStackTypeBag<
|
|
171
|
+
ParamList,
|
|
172
|
+
NavigatorID
|
|
173
|
+
>,
|
|
174
|
+
>(
|
|
175
|
+
/**
|
|
176
|
+
* Factory-level hosting options for the blank stack.
|
|
177
|
+
*/
|
|
178
|
+
options: BlankStackFactoryOptions,
|
|
179
|
+
): TypedNavigator<TypeBag, StaticConfig<TypeBag>>;
|
|
64
180
|
export function createBlankStackNavigator<
|
|
65
181
|
const ParamList extends ParamListBase,
|
|
66
182
|
const NavigatorID extends string | undefined = undefined,
|
|
67
|
-
const TypeBag extends NavigatorTypeBagBase =
|
|
68
|
-
ParamList
|
|
69
|
-
NavigatorID
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
NavigationList: {
|
|
74
|
-
[RouteName in keyof ParamList]: BlankStackNavigationProp<
|
|
75
|
-
ParamList,
|
|
76
|
-
RouteName,
|
|
77
|
-
NavigatorID
|
|
78
|
-
>;
|
|
79
|
-
};
|
|
80
|
-
Navigator: typeof BlankStackNavigator;
|
|
81
|
-
},
|
|
82
|
-
const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
|
|
183
|
+
const TypeBag extends NavigatorTypeBagBase = BlankStackTypeBag<
|
|
184
|
+
ParamList,
|
|
185
|
+
NavigatorID
|
|
186
|
+
>,
|
|
187
|
+
const Config extends StaticConfig<TypeBag> &
|
|
188
|
+
BlankStackFactoryOptions = StaticConfig<TypeBag> & BlankStackFactoryOptions,
|
|
83
189
|
>(config?: Config): TypedNavigator<TypeBag, Config> {
|
|
84
|
-
|
|
190
|
+
const {
|
|
191
|
+
independent = false,
|
|
192
|
+
enableNativeScreens = true,
|
|
193
|
+
...staticConfig
|
|
194
|
+
} = (config ?? {}) as StaticConfig<TypeBag> & BlankStackFactoryOptions;
|
|
195
|
+
|
|
196
|
+
const Navigator = createBlankStackNavigatorComponent({
|
|
197
|
+
independent,
|
|
198
|
+
enableNativeScreens,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return createNavigatorFactory(Navigator)(
|
|
202
|
+
(config ? (staticConfig as StaticConfig<TypeBag>) : undefined) as Config,
|
|
203
|
+
);
|
|
85
204
|
}
|
package/src/blank-stack/types.ts
CHANGED
|
@@ -51,9 +51,38 @@ export type BlankStackNavigationHelpers = NavigationHelpers<
|
|
|
51
51
|
BlankStackNavigationEventMap
|
|
52
52
|
>;
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Factory-only options for `createBlankStackNavigator`.
|
|
56
|
+
*
|
|
57
|
+
* Use these when you need to change how the blank stack itself is hosted,
|
|
58
|
+
* not how individual screens transition.
|
|
59
|
+
*/
|
|
60
|
+
export interface BlankStackFactoryOptions {
|
|
61
|
+
/**
|
|
62
|
+
* Creates an isolated navigation tree for embedded flows.
|
|
63
|
+
*
|
|
64
|
+
* Use this when the blank stack needs to live inside another screen or host
|
|
65
|
+
* application without joining the parent React Navigation tree.
|
|
66
|
+
*
|
|
67
|
+
* When enabled, the navigator:
|
|
68
|
+
* - wraps itself in `NavigationIndependentTree` + `NavigationContainer`
|
|
69
|
+
* - skips the shared native `ScreenContainer`
|
|
70
|
+
*
|
|
71
|
+
* Leave this disabled for normal top-level app stacks.
|
|
72
|
+
*/
|
|
73
|
+
independent?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Enables native screen primitives on supported native platforms.
|
|
76
|
+
*
|
|
77
|
+
* Use this when you want the embedded blank stack to keep `react-native-screens`
|
|
78
|
+
* behavior such as native activity state and freezing.
|
|
79
|
+
*
|
|
80
|
+
* Set this to `false` when you want the blank stack to render with regular
|
|
81
|
+
* views instead of native screen primitives. This is useful for embedded
|
|
82
|
+
* flows where plain views are a better fit than native screen layering.
|
|
83
|
+
*/
|
|
84
|
+
enableNativeScreens?: boolean;
|
|
85
|
+
}
|
|
57
86
|
|
|
58
87
|
/**
|
|
59
88
|
* Props passed to overlay components in blank-stack.
|
|
@@ -91,8 +120,7 @@ export type BlankStackNavigatorProps = DefaultNavigatorOptions<
|
|
|
91
120
|
BlankStackNavigationEventMap,
|
|
92
121
|
BlankStackNavigationProp<ParamListBase>
|
|
93
122
|
> &
|
|
94
|
-
StackRouterOptions
|
|
95
|
-
BlankStackNavigationConfig;
|
|
123
|
+
StackRouterOptions;
|
|
96
124
|
|
|
97
125
|
export type BlankStackDescriptor = Descriptor<
|
|
98
126
|
BlankStackNavigationOptions,
|
|
@@ -95,6 +95,14 @@ function IsolatedComponentStackNavigator(props: ComponentStackNavigatorProps) {
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Component stack was originally introduced for independent,
|
|
100
|
+
* embedded navigation flows. Blank stack now supports that use case directly
|
|
101
|
+
* via `createBlankStackNavigator({ independent: true })`, with
|
|
102
|
+
* `enableNativeScreens` available when you need to switch between native
|
|
103
|
+
* screens and regular views. Prefer blank stack for new work; component stack
|
|
104
|
+
* will be removed in a future release.
|
|
105
|
+
*/
|
|
98
106
|
export function createComponentStackNavigator<
|
|
99
107
|
const ParamList extends ParamListBase,
|
|
100
108
|
const NavigatorID extends string | undefined = undefined,
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import type { MeasurementIntent } from "../../types";
|
|
2
|
+
|
|
3
|
+
type PresenceLikeEntry = {
|
|
4
|
+
count: number;
|
|
5
|
+
ancestorKeys?: string[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type MeasurementIntentFlags = {
|
|
9
|
+
captureSource: boolean;
|
|
10
|
+
completeDestination: boolean;
|
|
11
|
+
refreshSource: boolean;
|
|
12
|
+
refreshDestination: boolean;
|
|
13
|
+
snapshotOnly: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type MeasurementWritePlan = {
|
|
17
|
+
captureSource: boolean;
|
|
18
|
+
completeDestination: boolean;
|
|
19
|
+
refreshSource: boolean;
|
|
20
|
+
refreshDestination: boolean;
|
|
21
|
+
registerSnapshot: boolean;
|
|
22
|
+
writesAny: boolean;
|
|
23
|
+
wantsDestinationWrite: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type DeferredMeasurementAction =
|
|
27
|
+
| "clear-pending"
|
|
28
|
+
| "queue-or-flush"
|
|
29
|
+
| "noop";
|
|
30
|
+
|
|
31
|
+
export const getMeasurementIntentFlags = (
|
|
32
|
+
intent?: MeasurementIntent | readonly MeasurementIntent[],
|
|
33
|
+
): MeasurementIntentFlags => {
|
|
34
|
+
"worklet";
|
|
35
|
+
const flags: MeasurementIntentFlags = {
|
|
36
|
+
captureSource: false,
|
|
37
|
+
completeDestination: false,
|
|
38
|
+
refreshSource: false,
|
|
39
|
+
refreshDestination: false,
|
|
40
|
+
snapshotOnly: false,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (!intent) {
|
|
44
|
+
return flags;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const intents = Array.isArray(intent) ? intent : [intent];
|
|
48
|
+
|
|
49
|
+
for (let i = 0; i < intents.length; i++) {
|
|
50
|
+
switch (intents[i]) {
|
|
51
|
+
case "capture-source":
|
|
52
|
+
flags.captureSource = true;
|
|
53
|
+
break;
|
|
54
|
+
case "complete-destination":
|
|
55
|
+
flags.completeDestination = true;
|
|
56
|
+
break;
|
|
57
|
+
case "refresh-source":
|
|
58
|
+
flags.refreshSource = true;
|
|
59
|
+
break;
|
|
60
|
+
case "refresh-destination":
|
|
61
|
+
flags.refreshDestination = true;
|
|
62
|
+
break;
|
|
63
|
+
case "snapshot-only":
|
|
64
|
+
flags.snapshotOnly = true;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return flags;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const resolveMeasurementWritePlan = (params: {
|
|
73
|
+
intents: MeasurementIntentFlags;
|
|
74
|
+
hasPendingLink: boolean;
|
|
75
|
+
hasSourceLink: boolean;
|
|
76
|
+
hasDestinationLink: boolean;
|
|
77
|
+
}): MeasurementWritePlan => {
|
|
78
|
+
"worklet";
|
|
79
|
+
const { intents, hasPendingLink, hasSourceLink, hasDestinationLink } = params;
|
|
80
|
+
|
|
81
|
+
const captureSource = intents.captureSource;
|
|
82
|
+
const completeDestination = intents.completeDestination && hasPendingLink;
|
|
83
|
+
const refreshSource = intents.refreshSource && hasSourceLink;
|
|
84
|
+
const refreshDestination =
|
|
85
|
+
intents.refreshDestination && (hasDestinationLink || hasPendingLink);
|
|
86
|
+
const registerSnapshot = intents.snapshotOnly;
|
|
87
|
+
const writesAny =
|
|
88
|
+
registerSnapshot ||
|
|
89
|
+
captureSource ||
|
|
90
|
+
completeDestination ||
|
|
91
|
+
refreshSource ||
|
|
92
|
+
refreshDestination;
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
captureSource,
|
|
96
|
+
completeDestination,
|
|
97
|
+
refreshSource,
|
|
98
|
+
refreshDestination,
|
|
99
|
+
registerSnapshot,
|
|
100
|
+
writesAny,
|
|
101
|
+
wantsDestinationWrite: completeDestination || refreshDestination,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const resolveAutoSourceCaptureSignal = (params: {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
nextScreenKey?: string;
|
|
108
|
+
tagPresence?: Record<string, PresenceLikeEntry>;
|
|
109
|
+
}): string | 0 => {
|
|
110
|
+
"worklet";
|
|
111
|
+
const { enabled, nextScreenKey, tagPresence } = params;
|
|
112
|
+
if (!enabled) return 0;
|
|
113
|
+
if (!nextScreenKey) return 0;
|
|
114
|
+
if (!tagPresence) return 0;
|
|
115
|
+
|
|
116
|
+
const direct = tagPresence[nextScreenKey];
|
|
117
|
+
if (direct && direct.count > 0) return nextScreenKey;
|
|
118
|
+
|
|
119
|
+
for (const screenKey in tagPresence) {
|
|
120
|
+
const entry = tagPresence[screenKey];
|
|
121
|
+
if (entry.ancestorKeys?.includes(nextScreenKey)) {
|
|
122
|
+
return nextScreenKey;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return 0;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const resolvePendingDestinationCaptureSignal = (params: {
|
|
130
|
+
enabled: boolean;
|
|
131
|
+
resolvedSourceKey?: string | null;
|
|
132
|
+
hasPendingLinkFromSource: boolean;
|
|
133
|
+
}): string | 0 => {
|
|
134
|
+
"worklet";
|
|
135
|
+
const { enabled, resolvedSourceKey, hasPendingLinkFromSource } = params;
|
|
136
|
+
if (!enabled) return 0;
|
|
137
|
+
if (!resolvedSourceKey) return 0;
|
|
138
|
+
return hasPendingLinkFromSource ? resolvedSourceKey : 0;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const resolvePendingDestinationRetrySignal = (params: {
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
retryCount: number;
|
|
144
|
+
maxRetries: number;
|
|
145
|
+
isAnimating: boolean;
|
|
146
|
+
hasDestinationLink: boolean;
|
|
147
|
+
progress: number;
|
|
148
|
+
retryProgressMax: number;
|
|
149
|
+
retryProgressBuckets: number;
|
|
150
|
+
resolvedSourceKey?: string | null;
|
|
151
|
+
hasPendingLinkFromSource: boolean;
|
|
152
|
+
}): number => {
|
|
153
|
+
"worklet";
|
|
154
|
+
const {
|
|
155
|
+
enabled,
|
|
156
|
+
retryCount,
|
|
157
|
+
maxRetries,
|
|
158
|
+
isAnimating,
|
|
159
|
+
hasDestinationLink,
|
|
160
|
+
progress,
|
|
161
|
+
retryProgressMax,
|
|
162
|
+
retryProgressBuckets,
|
|
163
|
+
resolvedSourceKey,
|
|
164
|
+
hasPendingLinkFromSource,
|
|
165
|
+
} = params;
|
|
166
|
+
|
|
167
|
+
if (!enabled) return 0;
|
|
168
|
+
if (retryCount >= maxRetries) return 0;
|
|
169
|
+
if (!isAnimating) return 0;
|
|
170
|
+
if (hasDestinationLink) return 0;
|
|
171
|
+
if (progress <= 0 || progress >= retryProgressMax) return 0;
|
|
172
|
+
if (!resolvedSourceKey) return 0;
|
|
173
|
+
if (!hasPendingLinkFromSource) return 0;
|
|
174
|
+
|
|
175
|
+
return Math.floor(progress * retryProgressBuckets) + 1;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const resolveInitialLayoutMeasurementIntent = (params: {
|
|
179
|
+
enabled: boolean;
|
|
180
|
+
hasSharedBoundTag: boolean;
|
|
181
|
+
hasMeasuredOnLayout: boolean;
|
|
182
|
+
isAnyAnimating: boolean;
|
|
183
|
+
hasPendingLinkFromSource: boolean;
|
|
184
|
+
}): MeasurementIntent | readonly MeasurementIntent[] | null => {
|
|
185
|
+
"worklet";
|
|
186
|
+
const {
|
|
187
|
+
enabled,
|
|
188
|
+
hasSharedBoundTag,
|
|
189
|
+
hasMeasuredOnLayout,
|
|
190
|
+
isAnyAnimating,
|
|
191
|
+
hasPendingLinkFromSource,
|
|
192
|
+
} = params;
|
|
193
|
+
|
|
194
|
+
if (!enabled) return null;
|
|
195
|
+
if (!hasSharedBoundTag || hasMeasuredOnLayout) return null;
|
|
196
|
+
|
|
197
|
+
if (!isAnyAnimating) {
|
|
198
|
+
return "snapshot-only";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return hasPendingLinkFromSource
|
|
202
|
+
? ["snapshot-only", "complete-destination"]
|
|
203
|
+
: "snapshot-only";
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const resolveGroupActiveMeasurementAction = (params: {
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
isEligible: boolean;
|
|
209
|
+
memberId: string;
|
|
210
|
+
activeId: string | null;
|
|
211
|
+
previousActiveId: string | null;
|
|
212
|
+
}): DeferredMeasurementAction => {
|
|
213
|
+
"worklet";
|
|
214
|
+
const { enabled, isEligible, memberId, activeId, previousActiveId } = params;
|
|
215
|
+
|
|
216
|
+
if (!enabled || !isEligible) return "noop";
|
|
217
|
+
if (activeId !== memberId) return "clear-pending";
|
|
218
|
+
if (activeId === memberId && activeId !== previousActiveId) {
|
|
219
|
+
return "queue-or-flush";
|
|
220
|
+
}
|
|
221
|
+
return "noop";
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const canFlushGroupActiveMeasurement = (params: {
|
|
225
|
+
enabled: boolean;
|
|
226
|
+
isEligible: boolean;
|
|
227
|
+
memberId: string;
|
|
228
|
+
activeId: string | null;
|
|
229
|
+
}): boolean => {
|
|
230
|
+
"worklet";
|
|
231
|
+
const { enabled, isEligible, memberId, activeId } = params;
|
|
232
|
+
if (!enabled || !isEligible) return false;
|
|
233
|
+
return activeId === memberId;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const shouldTriggerScrollSettledRefresh = (params: {
|
|
237
|
+
enabled: boolean;
|
|
238
|
+
group: string | undefined;
|
|
239
|
+
hasNextScreen: boolean;
|
|
240
|
+
hasSettledSignal: boolean;
|
|
241
|
+
signal: number;
|
|
242
|
+
previousSignal: number | null;
|
|
243
|
+
}): boolean => {
|
|
244
|
+
"worklet";
|
|
245
|
+
const {
|
|
246
|
+
enabled,
|
|
247
|
+
group,
|
|
248
|
+
hasNextScreen,
|
|
249
|
+
hasSettledSignal,
|
|
250
|
+
signal,
|
|
251
|
+
previousSignal,
|
|
252
|
+
} = params;
|
|
253
|
+
|
|
254
|
+
if (!enabled) return false;
|
|
255
|
+
if (!group || !hasNextScreen || !hasSettledSignal) return false;
|
|
256
|
+
if (signal === 0 || signal === previousSignal) return false;
|
|
257
|
+
return true;
|
|
258
|
+
};
|
package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAnimatedReaction } from "react-native-reanimated";
|
|
2
2
|
import { BoundStore } from "../../../stores/bounds";
|
|
3
3
|
import type { MaybeMeasureAndStoreParams } from "../types";
|
|
4
|
+
import { resolveAutoSourceCaptureSignal } from "./helpers/measurement-rules";
|
|
4
5
|
|
|
5
6
|
export const useAutoSourceMeasurement = (params: {
|
|
6
7
|
enabled: boolean;
|
|
@@ -15,29 +16,18 @@ export const useAutoSourceMeasurement = (params: {
|
|
|
15
16
|
useAnimatedReaction(
|
|
16
17
|
() => {
|
|
17
18
|
"worklet";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const direct = tagPresence[nextScreenKey];
|
|
24
|
-
if (direct && direct.count > 0) return nextScreenKey;
|
|
25
|
-
|
|
26
|
-
for (const screenKey in tagPresence) {
|
|
27
|
-
const entry = tagPresence[screenKey];
|
|
28
|
-
if (entry.ancestorKeys?.includes(nextScreenKey)) {
|
|
29
|
-
return nextScreenKey;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return 0;
|
|
19
|
+
return resolveAutoSourceCaptureSignal({
|
|
20
|
+
enabled,
|
|
21
|
+
nextScreenKey,
|
|
22
|
+
tagPresence: boundaryPresence.value[sharedBoundTag],
|
|
23
|
+
});
|
|
34
24
|
},
|
|
35
25
|
(captureSignal, previousCaptureSignal) => {
|
|
36
26
|
"worklet";
|
|
37
27
|
if (!enabled) return;
|
|
38
28
|
if (!nextScreenKey) return;
|
|
39
29
|
if (!captureSignal || captureSignal === previousCaptureSignal) return;
|
|
40
|
-
maybeMeasureAndStore({
|
|
30
|
+
maybeMeasureAndStore({ intent: "capture-source" });
|
|
41
31
|
},
|
|
42
32
|
[
|
|
43
33
|
enabled,
|
package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts
CHANGED
|
@@ -3,14 +3,18 @@ import {
|
|
|
3
3
|
type AnimatedRef,
|
|
4
4
|
type MeasuredDimensions,
|
|
5
5
|
measure,
|
|
6
|
+
type SharedValue,
|
|
6
7
|
type StyleProps,
|
|
7
8
|
} from "react-native-reanimated";
|
|
8
9
|
import useStableCallbackValue from "../../../hooks/use-stable-callback-value";
|
|
9
|
-
import type { AnimationStore } from "../../../stores/animation.store";
|
|
10
10
|
import { BoundStore } from "../../../stores/bounds";
|
|
11
11
|
import { applyMeasuredBoundsWrites } from "../../../stores/bounds/helpers/apply-measured-bounds-writes";
|
|
12
12
|
import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
|
|
13
13
|
import type { MaybeMeasureAndStoreParams } from "../types";
|
|
14
|
+
import {
|
|
15
|
+
getMeasurementIntentFlags,
|
|
16
|
+
resolveMeasurementWritePlan,
|
|
17
|
+
} from "./helpers/measurement-rules";
|
|
14
18
|
|
|
15
19
|
type LayoutAnchor = {
|
|
16
20
|
correctMeasurement: (measured: MeasuredDimensions) => MeasuredDimensions;
|
|
@@ -43,7 +47,7 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
43
47
|
ancestorKeys: string[];
|
|
44
48
|
navigatorKey?: string;
|
|
45
49
|
ancestorNavigatorKeys?: string[];
|
|
46
|
-
isAnimating:
|
|
50
|
+
isAnimating: SharedValue<number>;
|
|
47
51
|
preparedStyles: StyleProps;
|
|
48
52
|
animatedRef: AnimatedRef<View>;
|
|
49
53
|
layoutAnchor: LayoutAnchor;
|
|
@@ -63,20 +67,17 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
63
67
|
} = params;
|
|
64
68
|
|
|
65
69
|
return useStableCallbackValue(
|
|
66
|
-
({
|
|
67
|
-
shouldSetSource,
|
|
68
|
-
shouldSetDestination,
|
|
69
|
-
shouldUpdateSource,
|
|
70
|
-
shouldUpdateDestination,
|
|
71
|
-
}: MaybeMeasureAndStoreParams = {}) => {
|
|
70
|
+
({ intent }: MaybeMeasureAndStoreParams = {}) => {
|
|
72
71
|
"worklet";
|
|
73
72
|
if (!enabled) return;
|
|
74
73
|
|
|
74
|
+
const intents = getMeasurementIntentFlags(intent);
|
|
75
|
+
|
|
75
76
|
const expectedSourceScreenKey: string | undefined =
|
|
76
77
|
resolvePendingSourceKey(sharedBoundTag, preferredSourceScreenKey) ||
|
|
77
78
|
undefined;
|
|
78
79
|
|
|
79
|
-
if (
|
|
80
|
+
if (intents.captureSource && isAnimating.get()) {
|
|
80
81
|
const existing = BoundStore.getSnapshot(
|
|
81
82
|
sharedBoundTag,
|
|
82
83
|
currentScreenKey,
|
|
@@ -115,18 +116,14 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
115
116
|
currentScreenKey,
|
|
116
117
|
);
|
|
117
118
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
const writePlan = resolveMeasurementWritePlan({
|
|
120
|
+
intents,
|
|
121
|
+
hasPendingLink,
|
|
122
|
+
hasSourceLink,
|
|
123
|
+
hasDestinationLink,
|
|
124
|
+
});
|
|
123
125
|
|
|
124
|
-
if (
|
|
125
|
-
!canSetSource &&
|
|
126
|
-
!canSetDestination &&
|
|
127
|
-
!canUpdateSource &&
|
|
128
|
-
!canUpdateDestination
|
|
129
|
-
) {
|
|
126
|
+
if (!writePlan.writesAny) {
|
|
130
127
|
return;
|
|
131
128
|
}
|
|
132
129
|
|
|
@@ -137,14 +134,17 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
137
134
|
? layoutAnchor.correctMeasurement(measured)
|
|
138
135
|
: measured;
|
|
139
136
|
|
|
140
|
-
const wantsDestinationWrite = canSetDestination || canUpdateDestination;
|
|
141
137
|
const destinationInViewport =
|
|
142
|
-
!wantsDestinationWrite ||
|
|
138
|
+
!writePlan.wantsDestinationWrite ||
|
|
143
139
|
!layoutAnchor ||
|
|
144
140
|
!layoutAnchor.isMeasurementInViewport ||
|
|
145
141
|
layoutAnchor.isMeasurementInViewport(correctedMeasured);
|
|
146
142
|
|
|
147
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
!destinationInViewport &&
|
|
145
|
+
!writePlan.captureSource &&
|
|
146
|
+
!writePlan.refreshSource
|
|
147
|
+
) {
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -155,6 +155,13 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
155
155
|
const hasSnapshotChanged =
|
|
156
156
|
!existingSnapshot ||
|
|
157
157
|
!areMeasurementsEqual(existingSnapshot.bounds, correctedMeasured);
|
|
158
|
+
const shouldWriteSnapshot =
|
|
159
|
+
hasSnapshotChanged &&
|
|
160
|
+
(writePlan.registerSnapshot ||
|
|
161
|
+
writePlan.captureSource ||
|
|
162
|
+
writePlan.completeDestination ||
|
|
163
|
+
writePlan.refreshSource ||
|
|
164
|
+
writePlan.refreshDestination);
|
|
158
165
|
|
|
159
166
|
applyMeasuredBoundsWrites({
|
|
160
167
|
sharedBoundTag,
|
|
@@ -165,12 +172,15 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
165
172
|
navigatorKey,
|
|
166
173
|
ancestorNavigatorKeys,
|
|
167
174
|
expectedSourceScreenKey,
|
|
168
|
-
shouldRegisterSnapshot:
|
|
169
|
-
shouldSetSource:
|
|
170
|
-
shouldUpdateSource:
|
|
175
|
+
shouldRegisterSnapshot: shouldWriteSnapshot,
|
|
176
|
+
shouldSetSource: writePlan.captureSource,
|
|
177
|
+
shouldUpdateSource: writePlan.refreshSource && hasSnapshotChanged,
|
|
171
178
|
shouldUpdateDestination:
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
writePlan.refreshDestination &&
|
|
180
|
+
destinationInViewport &&
|
|
181
|
+
hasSnapshotChanged,
|
|
182
|
+
shouldSetDestination:
|
|
183
|
+
writePlan.completeDestination && destinationInViewport,
|
|
174
184
|
});
|
|
175
185
|
},
|
|
176
186
|
);
|