react-native-screen-transitions 4.0.0-alpha.5 → 4.0.0-alpha.7
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/lib/commonjs/components/boundary/components/boundary-lifecycle.js +36 -0
- package/lib/commonjs/components/boundary/components/boundary-lifecycle.js.map +1 -0
- package/lib/commonjs/components/boundary/components/boundary-target.js +1 -0
- package/lib/commonjs/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/commonjs/components/boundary/create-boundary-component.js +1 -0
- package/lib/commonjs/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +1 -13
- package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js +9 -2
- package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js +3 -2
- package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/commonjs/components/boundary/hooks/use-measurer.js +9 -2
- package/lib/commonjs/components/boundary/hooks/use-measurer.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js +5 -12
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +25 -43
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +13 -0
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +8 -31
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +14 -19
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +19 -48
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js +6 -2
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/commonjs/components/boundary/providers/boundary-root.provider.js +19 -17
- package/lib/commonjs/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/commonjs/components/boundary/utils/refresh-signals.js +19 -5
- package/lib/commonjs/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/commonjs/components/screen-container/layers/backdrop.js +11 -7
- package/lib/commonjs/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/components/screen-lifecycle/hooks/helpers/close-interception-rules.js +32 -0
- package/lib/commonjs/components/screen-lifecycle/hooks/helpers/close-interception-rules.js.map +1 -0
- package/lib/commonjs/components/screen-lifecycle/hooks/use-close-completion.js +27 -0
- package/lib/commonjs/components/screen-lifecycle/hooks/use-close-completion.js.map +1 -0
- package/lib/commonjs/components/screen-lifecycle/hooks/use-close-transition-intent.js +61 -86
- package/lib/commonjs/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
- package/lib/commonjs/components/screen-lifecycle/hooks/use-transition-start-controller.js +1 -5
- package/lib/commonjs/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
- package/lib/commonjs/components/screen-lifecycle/index.js +9 -6
- package/lib/commonjs/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/hooks/navigation/use-navigation-helpers.js +30 -13
- package/lib/commonjs/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/commonjs/providers/helpers/measured-bounds-writes.js +1 -2
- package/lib/commonjs/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/hooks/use-screen-gesture-config.js +9 -2
- package/lib/commonjs/providers/screen/gestures/hooks/use-screen-gesture-config.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-lifecycle.js +4 -5
- package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pan/behavior/use-pan-behavior.js +2 -3
- package/lib/commonjs/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -5
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -3
- package/lib/commonjs/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
- package/lib/commonjs/providers/screen/gestures/shared/policy.js +9 -5
- package/lib/commonjs/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/commonjs/providers/screen/styles/helpers/create-interpolator-scope.js +40 -0
- package/lib/commonjs/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
- package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js +5 -10
- package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/commonjs/providers/stack/blank-stack-state/blank-stack-controller.js +7 -9
- package/lib/commonjs/providers/stack/blank-stack-state/blank-stack-controller.js.map +1 -1
- package/lib/commonjs/stores/bounds/internals/links.js +1 -1
- package/lib/commonjs/stores/bounds/internals/links.js.map +1 -1
- package/lib/commonjs/stores/system.store.js +1 -2
- package/lib/commonjs/stores/system.store.js.map +1 -1
- package/lib/commonjs/utils/animation/animate-to-progress.js +0 -22
- package/lib/commonjs/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/utils/navigation/close-action-replay.js +22 -0
- package/lib/commonjs/utils/navigation/close-action-replay.js.map +1 -0
- package/lib/module/components/boundary/components/boundary-lifecycle.js +32 -0
- package/lib/module/components/boundary/components/boundary-lifecycle.js.map +1 -0
- package/lib/module/components/boundary/components/boundary-target.js +1 -0
- package/lib/module/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/module/components/boundary/create-boundary-component.js +1 -0
- package/lib/module/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +1 -13
- package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js +9 -2
- package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/module/components/boundary/hooks/use-boundary-measurement.js +3 -2
- package/lib/module/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/module/components/boundary/hooks/use-measurer.js +9 -2
- package/lib/module/components/boundary/hooks/use-measurer.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js +5 -12
- package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +27 -45
- package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +8 -0
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +1 -0
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +8 -32
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +15 -20
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +19 -48
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/index.js +6 -2
- package/lib/module/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/module/components/boundary/providers/boundary-root.provider.js +20 -18
- package/lib/module/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/module/components/boundary/utils/refresh-signals.js +19 -5
- package/lib/module/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/module/components/screen-container/layers/backdrop.js +12 -8
- package/lib/module/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/components/screen-lifecycle/hooks/helpers/close-interception-rules.js +26 -0
- package/lib/module/components/screen-lifecycle/hooks/helpers/close-interception-rules.js.map +1 -0
- package/lib/module/components/screen-lifecycle/hooks/use-close-completion.js +22 -0
- package/lib/module/components/screen-lifecycle/hooks/use-close-completion.js.map +1 -0
- package/lib/module/components/screen-lifecycle/hooks/use-close-transition-intent.js +61 -85
- package/lib/module/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
- package/lib/module/components/screen-lifecycle/hooks/use-transition-start-controller.js +1 -5
- package/lib/module/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
- package/lib/module/components/screen-lifecycle/index.js +9 -6
- package/lib/module/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/hooks/navigation/use-navigation-helpers.js +30 -13
- package/lib/module/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/module/providers/helpers/measured-bounds-writes.js +1 -2
- package/lib/module/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/module/providers/screen/gestures/hooks/use-screen-gesture-config.js +9 -2
- package/lib/module/providers/screen/gestures/hooks/use-screen-gesture-config.js.map +1 -1
- package/lib/module/providers/screen/gestures/pan/behavior/pan-lifecycle.js +4 -5
- package/lib/module/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
- package/lib/module/providers/screen/gestures/pan/behavior/use-pan-behavior.js +2 -3
- package/lib/module/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
- package/lib/module/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -5
- package/lib/module/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/module/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -3
- package/lib/module/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
- package/lib/module/providers/screen/gestures/shared/policy.js +9 -5
- package/lib/module/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/module/providers/screen/styles/helpers/create-interpolator-scope.js +35 -0
- package/lib/module/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
- package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js +5 -10
- package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/providers/stack/blank-stack-state/blank-stack-controller.js +7 -9
- package/lib/module/providers/stack/blank-stack-state/blank-stack-controller.js.map +1 -1
- package/lib/module/stores/bounds/internals/links.js +1 -1
- package/lib/module/stores/bounds/internals/links.js.map +1 -1
- package/lib/module/stores/system.store.js +1 -2
- package/lib/module/stores/system.store.js.map +1 -1
- package/lib/module/utils/animation/animate-to-progress.js +0 -22
- package/lib/module/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/utils/navigation/close-action-replay.js +16 -0
- package/lib/module/utils/navigation/close-action-replay.js.map +1 -0
- package/lib/typescript/components/boundary/components/boundary-lifecycle.d.ts +18 -0
- package/lib/typescript/components/boundary/components/boundary-lifecycle.d.ts.map +1 -0
- package/lib/typescript/components/boundary/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts +1 -2
- package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
- package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts +3 -2
- package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
- package/lib/typescript/components/boundary/hooks/use-measurer.d.ts +3 -2
- package/lib/typescript/components/boundary/hooks/use-measurer.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts +5 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts +4 -0
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts +4 -17
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +3 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +3 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts +5 -9
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts +3 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +2 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
- package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts +2 -1
- package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
- package/lib/typescript/components/boundary/types.d.ts +6 -0
- package/lib/typescript/components/boundary/types.d.ts.map +1 -1
- package/lib/typescript/components/boundary/utils/refresh-signals.d.ts +1 -0
- package/lib/typescript/components/boundary/utils/refresh-signals.d.ts.map +1 -1
- package/lib/typescript/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/components/screen-lifecycle/hooks/helpers/close-interception-rules.d.ts +28 -0
- package/lib/typescript/components/screen-lifecycle/hooks/helpers/close-interception-rules.d.ts.map +1 -0
- package/lib/typescript/components/screen-lifecycle/hooks/use-close-completion.d.ts +7 -0
- package/lib/typescript/components/screen-lifecycle/hooks/use-close-completion.d.ts.map +1 -0
- package/lib/typescript/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts +2 -7
- package/lib/typescript/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts.map +1 -1
- package/lib/typescript/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts +1 -3
- package/lib/typescript/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts.map +1 -1
- package/lib/typescript/components/screen-lifecycle/index.d.ts.map +1 -1
- package/lib/typescript/hooks/navigation/use-navigation-helpers.d.ts +1 -0
- package/lib/typescript/hooks/navigation/use-navigation-helpers.d.ts.map +1 -1
- package/lib/typescript/navigators/react-navigation/index.d.ts +1 -1
- package/lib/typescript/providers/screen/gestures/hooks/use-screen-gesture-config.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts +1 -1
- package/lib/typescript/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts +1 -1
- package/lib/typescript/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/pinch/behavior/use-pinch-behavior.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/shared/policy.d.ts +2 -1
- package/lib/typescript/providers/screen/gestures/shared/policy.d.ts.map +1 -1
- package/lib/typescript/providers/screen/gestures/types.d.ts +2 -0
- package/lib/typescript/providers/screen/gestures/types.d.ts.map +1 -1
- package/lib/typescript/providers/screen/styles/helpers/create-interpolator-scope.d.ts +9 -0
- package/lib/typescript/providers/screen/styles/helpers/create-interpolator-scope.d.ts.map +1 -0
- package/lib/typescript/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/lib/typescript/providers/stack/blank-stack-state/blank-stack-controller.d.ts.map +1 -1
- package/lib/typescript/stores/system.store.d.ts +1 -2
- package/lib/typescript/stores/system.store.d.ts.map +1 -1
- package/lib/typescript/utils/animation/animate-to-progress.d.ts +1 -2
- package/lib/typescript/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/utils/navigation/close-action-replay.d.ts +4 -0
- package/lib/typescript/utils/navigation/close-action-replay.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/boundary/components/boundary-lifecycle.tsx +53 -0
- package/src/components/boundary/components/boundary-target.tsx +1 -0
- package/src/components/boundary/create-boundary-component.tsx +1 -0
- package/src/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +0 -14
- package/src/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +13 -2
- package/src/components/boundary/hooks/use-boundary-measurement.ts +7 -2
- package/src/components/boundary/hooks/use-measurer.ts +11 -1
- package/src/components/boundary/portal/components/boundary-portal/components/host.tsx +13 -11
- package/src/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +44 -55
- package/src/components/boundary/portal/components/boundary-portal/helpers/local-measurement.ts +10 -0
- package/src/components/boundary/portal/components/boundary-portal/helpers/offset-style.ts +11 -55
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +20 -24
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +6 -0
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +20 -68
- package/src/components/boundary/portal/components/boundary-portal/index.tsx +19 -3
- package/src/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +3 -2
- package/src/components/boundary/providers/boundary-root.provider.tsx +29 -20
- package/src/components/boundary/types.ts +9 -0
- package/src/components/boundary/utils/refresh-signals.ts +39 -6
- package/src/components/screen-container/layers/backdrop.tsx +11 -7
- package/src/components/screen-lifecycle/hooks/helpers/close-interception-rules.ts +66 -0
- package/src/components/screen-lifecycle/hooks/use-close-completion.ts +25 -0
- package/src/components/screen-lifecycle/hooks/use-close-transition-intent.ts +68 -108
- package/src/components/screen-lifecycle/hooks/use-transition-start-controller.ts +0 -12
- package/src/components/screen-lifecycle/index.tsx +8 -4
- package/src/hooks/navigation/use-navigation-helpers.ts +40 -12
- package/src/providers/helpers/measured-bounds-writes.ts +1 -1
- package/src/providers/screen/gestures/hooks/use-screen-gesture-config.ts +9 -1
- package/src/providers/screen/gestures/pan/behavior/pan-lifecycle.ts +4 -6
- package/src/providers/screen/gestures/pan/behavior/use-pan-behavior.ts +1 -3
- package/src/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +4 -6
- package/src/providers/screen/gestures/pinch/behavior/use-pinch-behavior.ts +2 -8
- package/src/providers/screen/gestures/shared/policy.ts +17 -6
- package/src/providers/screen/gestures/types.ts +2 -0
- package/src/providers/screen/styles/helpers/create-interpolator-scope.ts +45 -0
- package/src/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +8 -12
- package/src/providers/stack/blank-stack-state/blank-stack-controller.ts +7 -7
- package/src/stores/bounds/internals/links.ts +1 -1
- package/src/stores/system.store.ts +1 -2
- package/src/utils/animation/animate-to-progress.ts +0 -23
- package/src/utils/navigation/close-action-replay.ts +25 -0
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/active-pair.js +0 -30
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/active-pair.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js +0 -47
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +0 -1
- package/lib/commonjs/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -21
- package/lib/commonjs/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/active-pair.js +0 -25
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/active-pair.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js +0 -40
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +0 -1
- package/lib/module/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -16
- package/lib/module/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/active-pair.d.ts +0 -9
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/active-pair.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.d.ts +0 -9
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.d.ts.map +0 -1
- package/lib/typescript/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts +0 -2
- package/lib/typescript/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts.map +0 -1
- package/src/components/boundary/portal/components/boundary-portal/helpers/active-pair.ts +0 -36
- package/src/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.ts +0 -45
- package/src/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx +0 -15
|
@@ -3,7 +3,10 @@ import type { View } from "react-native";
|
|
|
3
3
|
import type { AnimatedRef } from "react-native-reanimated";
|
|
4
4
|
import type { BoundTag } from "../../../stores/bounds/types";
|
|
5
5
|
import { prepareStyleForBounds } from "../../../utils/bounds/helpers/styles/styles";
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
BoundaryConfigProps,
|
|
8
|
+
BoundaryLocalMeasurementValue,
|
|
9
|
+
} from "../types";
|
|
7
10
|
import { useBoundaryPresence } from "./lifecycles/use-boundary-presence";
|
|
8
11
|
import { useInitialDestinationMeasurement } from "./lifecycles/use-initial-destination-measurement";
|
|
9
12
|
import { useInitialSourceMeasurement } from "./lifecycles/use-initial-source-measurement";
|
|
@@ -23,6 +26,7 @@ interface UseBoundaryMeasurementParams {
|
|
|
23
26
|
style?: unknown;
|
|
24
27
|
handoff: boolean;
|
|
25
28
|
escapeClipping: boolean;
|
|
29
|
+
localMeasurement: BoundaryLocalMeasurementValue;
|
|
26
30
|
config: BoundaryConfigProps;
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -40,6 +44,7 @@ export const useBoundaryMeasurement = ({
|
|
|
40
44
|
style,
|
|
41
45
|
handoff,
|
|
42
46
|
escapeClipping,
|
|
47
|
+
localMeasurement,
|
|
43
48
|
config,
|
|
44
49
|
}: UseBoundaryMeasurementParams) => {
|
|
45
50
|
const { anchor, scaleMode, target, method } = config;
|
|
@@ -58,6 +63,7 @@ export const useBoundaryMeasurement = ({
|
|
|
58
63
|
measuredAnimatedRef: measuredRef,
|
|
59
64
|
handoff,
|
|
60
65
|
escapeClipping,
|
|
66
|
+
localMeasurement,
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
// Presence and source capture must not depend on this screen owning an
|
|
@@ -81,7 +87,6 @@ export const useBoundaryMeasurement = ({
|
|
|
81
87
|
useInitialDestinationMeasurement({
|
|
82
88
|
boundTag,
|
|
83
89
|
enabled: runtimeEnabled,
|
|
84
|
-
escapeClipping,
|
|
85
90
|
measureBoundary,
|
|
86
91
|
});
|
|
87
92
|
|
|
@@ -8,7 +8,7 @@ import type { BoundTag } from "../../../stores/bounds/types";
|
|
|
8
8
|
import { ScrollStore } from "../../../stores/scroll.store";
|
|
9
9
|
import { SystemStore } from "../../../stores/system.store";
|
|
10
10
|
import { getVisibilityBlockOffset } from "../../../utils/visibility-block-offset";
|
|
11
|
-
import type { MeasureBoundary } from "../types";
|
|
11
|
+
import type { BoundaryLocalMeasurementValue, MeasureBoundary } from "../types";
|
|
12
12
|
import {
|
|
13
13
|
attachScrollSnapshotToMeasuredBounds,
|
|
14
14
|
correctMeasuredBoundsForVisibilityGate,
|
|
@@ -24,6 +24,7 @@ interface UseMeasurerParams {
|
|
|
24
24
|
measuredAnimatedRef: AnimatedRef<View>;
|
|
25
25
|
handoff: boolean;
|
|
26
26
|
escapeClipping: boolean;
|
|
27
|
+
localMeasurement: BoundaryLocalMeasurementValue;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const useMeasurer = ({
|
|
@@ -34,6 +35,7 @@ export const useMeasurer = ({
|
|
|
34
35
|
measuredAnimatedRef,
|
|
35
36
|
handoff,
|
|
36
37
|
escapeClipping,
|
|
38
|
+
localMeasurement,
|
|
37
39
|
}: UseMeasurerParams): MeasureBoundary => {
|
|
38
40
|
const { width: viewportWidth, height: viewportHeight } =
|
|
39
41
|
useWindowDimensions();
|
|
@@ -66,6 +68,13 @@ export const useMeasurer = ({
|
|
|
66
68
|
viewportHeight,
|
|
67
69
|
});
|
|
68
70
|
|
|
71
|
+
if (escapeClipping && target.type === "source") {
|
|
72
|
+
localMeasurement.set({
|
|
73
|
+
bounds: measured,
|
|
74
|
+
pairKey: target.pairKey,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
/**
|
|
70
79
|
* - Destination Pass -
|
|
71
80
|
* Be strict while lifecycle start is blocked for destination capture.
|
|
@@ -112,6 +121,7 @@ export const useMeasurer = ({
|
|
|
112
121
|
measuredAnimatedRef,
|
|
113
122
|
handoff,
|
|
114
123
|
escapeClipping,
|
|
124
|
+
localMeasurement,
|
|
115
125
|
viewportWidth,
|
|
116
126
|
viewportHeight,
|
|
117
127
|
scrollState,
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from "react-native";
|
|
9
9
|
import Animated from "react-native-reanimated";
|
|
10
10
|
import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
|
|
11
|
-
import { useScreenSlots } from "../../../../../../providers/screen/styles";
|
|
12
11
|
import { PORTAL_POINTER_EVENTS } from "../../../teleport";
|
|
13
12
|
import { useHostMeasurement } from "../hooks/use-host-measurement";
|
|
14
13
|
import { registerHost, unregisterHost } from "../stores/host-registry.store";
|
|
@@ -34,20 +33,17 @@ function HostImpl({ fallback = false, style }: HostImplProps) {
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
const hostKey = fallback ? screenKey : generatedHostKeyRef.current;
|
|
37
|
-
const capturesScroll = !fallback;
|
|
38
36
|
const activeBoundaryHosts = useActivePortalBoundaryHosts(hostKey);
|
|
39
|
-
|
|
37
|
+
|
|
40
38
|
const { height: viewportHeight, width: viewportWidth } =
|
|
41
39
|
useWindowDimensions();
|
|
42
40
|
|
|
41
|
+
const measurementKey = activeBoundaryHosts.length
|
|
42
|
+
? activeBoundaryHosts.map((host) => host.portalHostName).join("|")
|
|
43
|
+
: null;
|
|
44
|
+
|
|
43
45
|
const measurement = useHostMeasurement({
|
|
44
|
-
|
|
45
|
-
enabled: activeBoundaryHosts.length > 0,
|
|
46
|
-
hostKey,
|
|
47
|
-
screenKey,
|
|
48
|
-
visibilityBlocked,
|
|
49
|
-
viewportHeight,
|
|
50
|
-
viewportWidth,
|
|
46
|
+
measurementKey,
|
|
51
47
|
});
|
|
52
48
|
|
|
53
49
|
useLayoutEffect(() => {
|
|
@@ -71,7 +67,13 @@ function HostImpl({ fallback = false, style }: HostImplProps) {
|
|
|
71
67
|
{ width: viewportWidth, height: viewportHeight },
|
|
72
68
|
]}
|
|
73
69
|
>
|
|
74
|
-
<PortalBoundaryHost
|
|
70
|
+
<PortalBoundaryHost
|
|
71
|
+
host={host}
|
|
72
|
+
hostBounds={measurement.hostBounds}
|
|
73
|
+
hostMeasurementKey={measurementKey}
|
|
74
|
+
measuredHostKey={measurement.measuredKey}
|
|
75
|
+
style={StyleSheet.absoluteFill}
|
|
76
|
+
/>
|
|
75
77
|
</View>
|
|
76
78
|
));
|
|
77
79
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo
|
|
1
|
+
import { memo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
I18nManager,
|
|
4
4
|
type StyleProp,
|
|
@@ -6,97 +6,86 @@ import {
|
|
|
6
6
|
type ViewStyle,
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import Animated, {
|
|
9
|
+
type MeasuredDimensions,
|
|
10
|
+
type SharedValue,
|
|
11
|
+
useAnimatedReaction,
|
|
9
12
|
useAnimatedStyle,
|
|
10
|
-
useFrameCallback,
|
|
11
|
-
useSharedValue,
|
|
12
13
|
} from "react-native-reanimated";
|
|
13
14
|
import { NO_STYLES } from "../../../../../../constants";
|
|
14
15
|
import { composeSlotStyleWithLocalTransform } from "../../../../../../providers/screen/styles/helpers/compose-slot-style";
|
|
15
|
-
import { getLink } from "../../../../../../stores/bounds/internals/links";
|
|
16
|
-
import { SystemStore } from "../../../../../../stores/system.store";
|
|
17
|
-
import type { ScrollMeasuredDimensions } from "../../../../utils/measured-bounds";
|
|
18
16
|
import { NativePortalHost, PORTAL_POINTER_EVENTS } from "../../../teleport";
|
|
17
|
+
import { resolveBoundaryLocalMeasurement } from "../helpers/local-measurement";
|
|
19
18
|
import { resolvePortalOffsetStyle } from "../helpers/offset-style";
|
|
20
|
-
import { getPortalHostBounds } from "../stores/host-bounds.store";
|
|
21
19
|
import type { ActivePortalBoundaryHost } from "../stores/portal-boundary-host.store";
|
|
22
20
|
|
|
23
21
|
const AnimatedPortalBoundaryHost = NativePortalHost
|
|
24
22
|
? Animated.createAnimatedComponent(NativePortalHost)
|
|
25
23
|
: null;
|
|
26
24
|
|
|
25
|
+
const getCurrentBoundaryBounds = (host: ActivePortalBoundaryHost) => {
|
|
26
|
+
"worklet";
|
|
27
|
+
return resolveBoundaryLocalMeasurement(
|
|
28
|
+
host.localMeasurement.get(),
|
|
29
|
+
host.pairKey,
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
type PortalBoundaryHostProps = {
|
|
28
34
|
host: ActivePortalBoundaryHost;
|
|
35
|
+
hostBounds: SharedValue<MeasuredDimensions | null>;
|
|
36
|
+
hostMeasurementKey: string | null;
|
|
37
|
+
measuredHostKey: SharedValue<string | null>;
|
|
29
38
|
style?: StyleProp<ViewStyle>;
|
|
30
39
|
};
|
|
31
40
|
|
|
32
41
|
export const PortalBoundaryHost = memo(function PortalBoundaryHost({
|
|
33
42
|
host,
|
|
43
|
+
hostBounds,
|
|
44
|
+
hostMeasurementKey,
|
|
45
|
+
measuredHostKey,
|
|
34
46
|
style,
|
|
35
47
|
}: PortalBoundaryHostProps) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (geometryReadyFrames.get() === 0) {
|
|
57
|
-
// Give the source frame, host offset, and slot style one UI frame to
|
|
58
|
-
// reach native before Teleport targets this receiver.
|
|
59
|
-
geometryReadyFrames.set(1);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
host.portalHostReady.set(true);
|
|
64
|
-
unblockLifecycleStart();
|
|
65
|
-
}, [geometryReadyFrames, host, unblockLifecycleStart]);
|
|
66
|
-
|
|
67
|
-
useFrameCallback(handleFrame, true);
|
|
48
|
+
useAnimatedReaction(
|
|
49
|
+
() => {
|
|
50
|
+
"worklet";
|
|
51
|
+
return (
|
|
52
|
+
getCurrentBoundaryBounds(host) !== null &&
|
|
53
|
+
hostBounds.get() !== null &&
|
|
54
|
+
!!hostMeasurementKey &&
|
|
55
|
+
measuredHostKey.get() === hostMeasurementKey
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
(ready) => {
|
|
59
|
+
"worklet";
|
|
60
|
+
if (ready) {
|
|
61
|
+
host.portalHostReady.set(true);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
);
|
|
68
65
|
|
|
69
66
|
const hostStyle = useAnimatedStyle(() => {
|
|
70
67
|
"worklet";
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const link = getLink(host.pairKey, host.boundaryId);
|
|
74
|
-
if (!link?.source) {
|
|
68
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
69
|
+
if (!boundaryBounds) {
|
|
75
70
|
return NO_STYLES;
|
|
76
71
|
}
|
|
77
72
|
|
|
78
|
-
const sourceBounds = link.source.bounds as ScrollMeasuredDimensions;
|
|
79
|
-
const isCrossScreenPortal = link.source.screenKey !== host.screenKey;
|
|
80
|
-
|
|
81
73
|
return resolvePortalOffsetStyle({
|
|
82
|
-
bounds:
|
|
83
|
-
|
|
84
|
-
placement: isCrossScreenPortal ? "cross-screen" : "same-screen",
|
|
74
|
+
bounds: boundaryBounds,
|
|
75
|
+
hostBounds: hostBounds.get(),
|
|
85
76
|
});
|
|
86
77
|
});
|
|
87
78
|
|
|
88
79
|
const contentFrameStyle = useAnimatedStyle(() => {
|
|
89
80
|
"worklet";
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
81
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
82
|
+
if (!boundaryBounds) {
|
|
92
83
|
return NO_STYLES;
|
|
93
84
|
}
|
|
94
85
|
|
|
95
|
-
const sourceBounds = link.source.bounds as ScrollMeasuredDimensions;
|
|
96
|
-
|
|
97
86
|
return {
|
|
98
|
-
height:
|
|
99
|
-
width:
|
|
87
|
+
height: boundaryBounds.height,
|
|
88
|
+
width: boundaryBounds.width,
|
|
100
89
|
};
|
|
101
90
|
});
|
|
102
91
|
const slotStyle = useAnimatedStyle(() => {
|
package/src/components/boundary/portal/components/boundary-portal/helpers/local-measurement.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ScreenPairKey } from "../../../../../../stores/bounds/types";
|
|
2
|
+
import type { BoundaryLocalMeasurement } from "../../../../types";
|
|
3
|
+
|
|
4
|
+
export const resolveBoundaryLocalMeasurement = (
|
|
5
|
+
measurement: BoundaryLocalMeasurement | null,
|
|
6
|
+
pairKey: ScreenPairKey,
|
|
7
|
+
) => {
|
|
8
|
+
"worklet";
|
|
9
|
+
return measurement?.pairKey === pairKey ? measurement.bounds : null;
|
|
10
|
+
};
|
|
@@ -1,69 +1,25 @@
|
|
|
1
|
-
import type { StyleProps } from "react-native-reanimated";
|
|
2
|
-
import { getClampedScrollAxisDelta } from "../../../../../../stores/scroll.store";
|
|
3
|
-
import type { ScrollMeasuredDimensions } from "../../../../utils/measured-bounds";
|
|
4
|
-
import { getPortalHostBounds } from "../stores/host-bounds.store";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The two portal coordinate cases we support:
|
|
8
|
-
*
|
|
9
|
-
* - same-screen: source and host live on the same screen; re-base the stored
|
|
10
|
-
* host frame onto the source measurement's scroll snapshot.
|
|
11
|
-
* - cross-screen: source and host live on different screens; the host is the
|
|
12
|
-
* replacement coordinate space, so destination scroll is inherited naturally
|
|
13
|
-
* from host placement instead of manually propagated.
|
|
14
|
-
*/
|
|
15
|
-
export type PortalOffsetPlacement = "same-screen" | "cross-screen";
|
|
1
|
+
import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
|
|
16
2
|
|
|
17
3
|
type ResolvePortalOffsetStyleParams = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
hostKey: string;
|
|
21
|
-
placement: PortalOffsetPlacement;
|
|
4
|
+
bounds: MeasuredDimensions;
|
|
5
|
+
hostBounds: MeasuredDimensions | null;
|
|
22
6
|
};
|
|
23
7
|
|
|
24
8
|
export const resolvePortalOffsetStyle = ({
|
|
25
9
|
bounds,
|
|
26
|
-
|
|
27
|
-
placement,
|
|
10
|
+
hostBounds,
|
|
28
11
|
}: ResolvePortalOffsetStyleParams): StyleProps => {
|
|
29
12
|
"worklet";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Cross-screen hosts are the chosen replacement coordinate space, so their
|
|
36
|
-
// destination scroll is represented by where the host itself is mounted.
|
|
37
|
-
const alignHostToBoundsScroll = placement === "same-screen";
|
|
38
|
-
|
|
39
|
-
const hostSnapshotDeltaX = alignHostToBoundsScroll
|
|
40
|
-
? getClampedScrollAxisDelta(
|
|
41
|
-
boundsScrollSnapshot,
|
|
42
|
-
hostBoundsScrollSnapshot,
|
|
43
|
-
"horizontal",
|
|
44
|
-
)
|
|
45
|
-
: 0;
|
|
46
|
-
const hostSnapshotDeltaY = alignHostToBoundsScroll
|
|
47
|
-
? getClampedScrollAxisDelta(
|
|
48
|
-
boundsScrollSnapshot,
|
|
49
|
-
hostBoundsScrollSnapshot,
|
|
50
|
-
"vertical",
|
|
51
|
-
)
|
|
52
|
-
: 0;
|
|
53
|
-
|
|
54
|
-
// Without registered host bounds the host frame is the origin, so the source
|
|
55
|
-
// page position becomes the offset directly.
|
|
56
|
-
const adjustedHostPageX = hostBounds
|
|
57
|
-
? hostBounds.pageX - hostSnapshotDeltaX
|
|
58
|
-
: 0;
|
|
59
|
-
const adjustedHostPageY = hostBounds
|
|
60
|
-
? hostBounds.pageY - hostSnapshotDeltaY
|
|
61
|
-
: 0;
|
|
13
|
+
// Both values are measured in page coordinates. Subtracting the host origin
|
|
14
|
+
// gives the boundary's local position inside that host, independent of which
|
|
15
|
+
// scroll container owns either view.
|
|
16
|
+
const hostPageX = hostBounds?.pageX ?? 0;
|
|
17
|
+
const hostPageY = hostBounds?.pageY ?? 0;
|
|
62
18
|
|
|
63
19
|
return {
|
|
64
20
|
transform: [
|
|
65
|
-
{ translateY: bounds.pageY -
|
|
66
|
-
{ translateX: bounds.pageX -
|
|
21
|
+
{ translateY: bounds.pageY - hostPageY },
|
|
22
|
+
{ translateX: bounds.pageX - hostPageX },
|
|
67
23
|
],
|
|
68
24
|
};
|
|
69
25
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect,
|
|
1
|
+
import { useCallback, useLayoutEffect, useState } from "react";
|
|
2
2
|
import { type SharedValue, useAnimatedReaction } from "react-native-reanimated";
|
|
3
3
|
import { scheduleOnRN } from "react-native-worklets";
|
|
4
4
|
import { getPairKeyForSource } from "../../../../../../stores/bounds/internals/links";
|
|
5
5
|
import type { ScreenPairKey } from "../../../../../../stores/bounds/types";
|
|
6
6
|
import type { NormalizedTransitionInterpolatedStyle } from "../../../../../../types/animation.types";
|
|
7
|
+
import type { BoundaryLocalMeasurementValue } from "../../../../types";
|
|
7
8
|
import { createBoundaryPortalHostName } from "../../../utils/naming";
|
|
8
9
|
import {
|
|
9
10
|
mountPortalBoundaryHost,
|
|
@@ -14,44 +15,39 @@ type UseActivePortalBoundaryHostParams = {
|
|
|
14
15
|
boundaryId: string;
|
|
15
16
|
currentScreenKey: string;
|
|
16
17
|
escapeHostKey?: string;
|
|
18
|
+
localMeasurement: BoundaryLocalMeasurementValue;
|
|
17
19
|
portalHostName: SharedValue<string | null>;
|
|
18
20
|
portalHostReady: SharedValue<boolean>;
|
|
19
21
|
slotsMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
type ActivePortal = {
|
|
23
|
-
pairKey: ScreenPairKey;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
24
|
export const useActivePortalBoundaryHost = ({
|
|
27
25
|
boundaryId,
|
|
28
26
|
currentScreenKey,
|
|
29
27
|
escapeHostKey,
|
|
28
|
+
localMeasurement,
|
|
30
29
|
portalHostName,
|
|
31
30
|
portalHostReady,
|
|
32
31
|
slotsMap,
|
|
33
32
|
}: UseActivePortalBoundaryHostParams) => {
|
|
34
|
-
const [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const updateActivePortal = useCallback((pairKey: ScreenPairKey | null) => {
|
|
38
|
-
if (activePairKeyRef.current === pairKey) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
33
|
+
const [activePairKey, setActivePairKey] = useState<ScreenPairKey | null>(
|
|
34
|
+
null,
|
|
35
|
+
);
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
const updateActivePairKey = useCallback((pairKey: ScreenPairKey | null) => {
|
|
38
|
+
setActivePairKey(pairKey);
|
|
44
39
|
}, []);
|
|
45
40
|
|
|
46
41
|
useAnimatedReaction(
|
|
47
42
|
() => {
|
|
48
43
|
"worklet";
|
|
49
|
-
const
|
|
50
|
-
|
|
44
|
+
const pairKey = getPairKeyForSource(boundaryId, currentScreenKey);
|
|
45
|
+
const measurement = localMeasurement.get();
|
|
46
|
+
if (!pairKey || measurement?.pairKey !== pairKey) {
|
|
51
47
|
return null;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
return
|
|
50
|
+
return pairKey;
|
|
55
51
|
},
|
|
56
52
|
(pairKey, previousPairKey) => {
|
|
57
53
|
"worklet";
|
|
@@ -59,12 +55,12 @@ export const useActivePortalBoundaryHost = ({
|
|
|
59
55
|
return;
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
scheduleOnRN(
|
|
58
|
+
scheduleOnRN(updateActivePairKey, pairKey);
|
|
63
59
|
},
|
|
64
60
|
);
|
|
65
61
|
|
|
66
62
|
useLayoutEffect(() => {
|
|
67
|
-
if (!
|
|
63
|
+
if (!activePairKey || !escapeHostKey) {
|
|
68
64
|
portalHostName.set(null);
|
|
69
65
|
portalHostReady.set(false);
|
|
70
66
|
return;
|
|
@@ -73,16 +69,16 @@ export const useActivePortalBoundaryHost = ({
|
|
|
73
69
|
const nextPortalHostName = createBoundaryPortalHostName(
|
|
74
70
|
escapeHostKey,
|
|
75
71
|
boundaryId,
|
|
76
|
-
|
|
72
|
+
activePairKey,
|
|
77
73
|
);
|
|
78
74
|
|
|
79
75
|
mountPortalBoundaryHost({
|
|
80
76
|
boundaryId,
|
|
81
77
|
hostKey: escapeHostKey,
|
|
82
|
-
|
|
78
|
+
localMeasurement,
|
|
79
|
+
pairKey: activePairKey,
|
|
83
80
|
portalHostName: nextPortalHostName,
|
|
84
81
|
portalHostReady,
|
|
85
|
-
screenKey: currentScreenKey,
|
|
86
82
|
slotsMap,
|
|
87
83
|
});
|
|
88
84
|
portalHostName.set(nextPortalHostName);
|
|
@@ -93,10 +89,10 @@ export const useActivePortalBoundaryHost = ({
|
|
|
93
89
|
unmountPortalBoundaryHostByName(nextPortalHostName);
|
|
94
90
|
};
|
|
95
91
|
}, [
|
|
96
|
-
|
|
92
|
+
activePairKey,
|
|
97
93
|
boundaryId,
|
|
98
|
-
currentScreenKey,
|
|
99
94
|
escapeHostKey,
|
|
95
|
+
localMeasurement,
|
|
100
96
|
portalHostName,
|
|
101
97
|
portalHostReady,
|
|
102
98
|
slotsMap,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAnimatedProps, useSharedValue } from "react-native-reanimated";
|
|
2
2
|
import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
|
|
3
3
|
import { useScreenSlots } from "../../../../../../providers/screen/styles";
|
|
4
|
+
import type { BoundaryLocalMeasurementValue } from "../../../../types";
|
|
4
5
|
import { PORTAL_HOST_NAME_RESET_VALUE } from "../../../utils/naming";
|
|
5
6
|
import { isTeleportEnabled } from "../../../utils/teleport-control";
|
|
6
7
|
import { useActiveHostKey } from "../stores/host-registry.store";
|
|
@@ -8,10 +9,12 @@ import { useActivePortalBoundaryHost } from "./use-active-portal-boundary-host";
|
|
|
8
9
|
|
|
9
10
|
interface UseBoundaryPortalAttachmentParams {
|
|
10
11
|
boundaryId: string;
|
|
12
|
+
localMeasurement: BoundaryLocalMeasurementValue;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const useBoundaryPortalAttachment = ({
|
|
14
16
|
boundaryId,
|
|
17
|
+
localMeasurement,
|
|
15
18
|
}: UseBoundaryPortalAttachmentParams) => {
|
|
16
19
|
const currentScreenKey = useDescriptorsStore(
|
|
17
20
|
(s) => s.derivations.currentScreenKey,
|
|
@@ -25,6 +28,7 @@ export const useBoundaryPortalAttachment = ({
|
|
|
25
28
|
boundaryId,
|
|
26
29
|
currentScreenKey,
|
|
27
30
|
escapeHostKey,
|
|
31
|
+
localMeasurement,
|
|
28
32
|
portalHostName,
|
|
29
33
|
portalHostReady,
|
|
30
34
|
slotsMap,
|
|
@@ -39,10 +43,12 @@ export const useBoundaryPortalAttachment = ({
|
|
|
39
43
|
teleport,
|
|
40
44
|
...slotProps
|
|
41
45
|
} = slot?.props ?? {};
|
|
46
|
+
|
|
42
47
|
const shouldAttach =
|
|
43
48
|
slot !== undefined &&
|
|
44
49
|
isTeleportEnabled(teleport) &&
|
|
45
50
|
portalHostReady.get();
|
|
51
|
+
|
|
46
52
|
const hostName = shouldAttach
|
|
47
53
|
? portalHostName.get()
|
|
48
54
|
: PORTAL_HOST_NAME_RESET_VALUE;
|
package/src/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts
CHANGED
|
@@ -1,61 +1,37 @@
|
|
|
1
|
-
import { useLayoutEffect } from "react";
|
|
2
1
|
import type { View } from "react-native";
|
|
3
2
|
import {
|
|
4
3
|
cancelAnimation,
|
|
4
|
+
type MeasuredDimensions,
|
|
5
5
|
measure,
|
|
6
|
-
type SharedValue,
|
|
7
6
|
useAnimatedReaction,
|
|
8
7
|
useAnimatedRef,
|
|
9
8
|
useSharedValue,
|
|
10
9
|
withDelay,
|
|
11
10
|
withTiming,
|
|
12
11
|
} from "react-native-reanimated";
|
|
13
|
-
import { scheduleOnUI } from "react-native-worklets";
|
|
14
|
-
import { ScrollStore } from "../../../../../../stores/scroll.store";
|
|
15
|
-
import { getVisibilityBlockOffset } from "../../../../../../utils/visibility-block-offset";
|
|
16
|
-
import {
|
|
17
|
-
adjustedMeasuredBoundsForOverscrollDeltas,
|
|
18
|
-
correctMeasuredBoundsForVisibilityGate,
|
|
19
|
-
} from "../../../../utils/measured-bounds";
|
|
20
|
-
import {
|
|
21
|
-
clearPortalHostBounds,
|
|
22
|
-
setPortalHostBounds,
|
|
23
|
-
} from "../stores/host-bounds.store";
|
|
24
12
|
|
|
25
13
|
const HOST_MEASUREMENT_RETRY_DELAY_MS = 16;
|
|
26
14
|
|
|
27
15
|
type UseHostMeasurementParams = {
|
|
28
|
-
|
|
29
|
-
enabled: boolean;
|
|
30
|
-
hostKey: string;
|
|
31
|
-
screenKey: string;
|
|
32
|
-
visibilityBlocked: SharedValue<boolean>;
|
|
33
|
-
viewportHeight: number;
|
|
34
|
-
viewportWidth: number;
|
|
16
|
+
measurementKey: string | null;
|
|
35
17
|
};
|
|
36
18
|
|
|
37
19
|
export const useHostMeasurement = ({
|
|
38
|
-
|
|
39
|
-
enabled,
|
|
40
|
-
hostKey,
|
|
41
|
-
screenKey,
|
|
42
|
-
visibilityBlocked,
|
|
43
|
-
viewportHeight,
|
|
44
|
-
viewportWidth,
|
|
20
|
+
measurementKey,
|
|
45
21
|
}: UseHostMeasurementParams) => {
|
|
46
22
|
const hostRef = useAnimatedRef<View>();
|
|
47
|
-
const
|
|
48
|
-
const
|
|
23
|
+
const hostBounds = useSharedValue<MeasuredDimensions | null>(null);
|
|
24
|
+
const measuredKey = useSharedValue<string | null>(null);
|
|
49
25
|
const retryToken = useSharedValue(0);
|
|
50
26
|
|
|
51
27
|
useAnimatedReaction(
|
|
52
28
|
() => {
|
|
53
29
|
"worklet";
|
|
54
|
-
if (!
|
|
30
|
+
if (!measurementKey) {
|
|
55
31
|
return null;
|
|
56
32
|
}
|
|
57
33
|
|
|
58
|
-
return [
|
|
34
|
+
return [measurementKey, measuredKey.get(), retryToken.get()] as const;
|
|
59
35
|
},
|
|
60
36
|
(state) => {
|
|
61
37
|
"worklet";
|
|
@@ -64,9 +40,8 @@ export const useHostMeasurement = ({
|
|
|
64
40
|
return;
|
|
65
41
|
}
|
|
66
42
|
|
|
67
|
-
const [
|
|
68
|
-
|
|
69
|
-
if (!enabled || hasAlreadyMeasured) {
|
|
43
|
+
const [requestedKey, completedKey] = state;
|
|
44
|
+
if (requestedKey === completedKey) {
|
|
70
45
|
return;
|
|
71
46
|
}
|
|
72
47
|
|
|
@@ -85,23 +60,7 @@ export const useHostMeasurement = ({
|
|
|
85
60
|
|
|
86
61
|
cancelAnimation(retryToken);
|
|
87
62
|
|
|
88
|
-
|
|
89
|
-
// overscroll displacement into the host frame. Store the at-rest
|
|
90
|
-
// position instead; clamped scroll deltas share that basis.
|
|
91
|
-
const currentScroll = scrollMetadata.get();
|
|
92
|
-
const overscrollNormalized = capturesScroll
|
|
93
|
-
? adjustedMeasuredBoundsForOverscrollDeltas(measured, currentScroll)
|
|
94
|
-
: measured;
|
|
95
|
-
|
|
96
|
-
const correctedMeasured = correctMeasuredBoundsForVisibilityGate({
|
|
97
|
-
measured: overscrollNormalized,
|
|
98
|
-
visibilityBlocked: visibilityBlocked.get(),
|
|
99
|
-
visibilityBlockOffset: getVisibilityBlockOffset(viewportHeight),
|
|
100
|
-
viewportWidth,
|
|
101
|
-
viewportHeight,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
if (correctedMeasured.width <= 0 || correctedMeasured.height <= 0) {
|
|
63
|
+
if (measured.width <= 0 || measured.height <= 0) {
|
|
105
64
|
cancelAnimation(retryToken);
|
|
106
65
|
retryToken.set(
|
|
107
66
|
withDelay(
|
|
@@ -112,27 +71,20 @@ export const useHostMeasurement = ({
|
|
|
112
71
|
return;
|
|
113
72
|
}
|
|
114
73
|
|
|
115
|
-
|
|
116
|
-
x:
|
|
117
|
-
y:
|
|
118
|
-
width:
|
|
119
|
-
height:
|
|
120
|
-
pageX:
|
|
121
|
-
pageY:
|
|
122
|
-
scroll: capturesScroll ? currentScroll : null,
|
|
74
|
+
hostBounds.set({
|
|
75
|
+
x: measured.x,
|
|
76
|
+
y: measured.y,
|
|
77
|
+
width: measured.width,
|
|
78
|
+
height: measured.height,
|
|
79
|
+
pageX: measured.pageX,
|
|
80
|
+
pageY: measured.pageY,
|
|
123
81
|
});
|
|
124
|
-
|
|
125
|
-
hasMeasuredHost.set(true);
|
|
82
|
+
measuredKey.set(requestedKey);
|
|
126
83
|
},
|
|
127
84
|
);
|
|
128
|
-
|
|
129
|
-
useLayoutEffect(() => {
|
|
130
|
-
return () => {
|
|
131
|
-
scheduleOnUI(clearPortalHostBounds, hostKey);
|
|
132
|
-
};
|
|
133
|
-
}, [hostKey]);
|
|
134
|
-
|
|
135
85
|
return {
|
|
86
|
+
hostBounds,
|
|
136
87
|
hostRef,
|
|
88
|
+
measuredKey,
|
|
137
89
|
};
|
|
138
90
|
};
|