react-native-screen-transitions 3.9.0-alpha.2 → 3.9.0-beta.0
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/shared/components/boundary/components/boundary-target.js +14 -9
- package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/create-boundary-component.js +66 -28
- package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/{use-boundary-presence.js → lifecycles/use-boundary-presence.js} +8 -4
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-boundary-presence.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/hooks/{use-initial-destination-measurement.js → lifecycles/use-initial-destination-measurement.js} +27 -10
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/hooks/{use-initial-source-measurement.js → lifecycles/use-initial-source-measurement.js} +5 -7
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/hooks/{use-refresh-boundary.js → lifecycles/use-refresh-boundary.js} +4 -4
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +14 -35
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-measurer.js +5 -6
- package/lib/commonjs/shared/components/boundary/hooks/use-measurer.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/index.js +26 -29
- package/lib/commonjs/shared/components/boundary/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-local-portal-host.js +58 -0
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-local-portal-host.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/components/host.js +20 -4
- package/lib/commonjs/shared/components/boundary/portal/components/host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js +78 -27
- package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/portal.js +195 -121
- package/lib/commonjs/shared/components/boundary/portal/components/portal.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/hooks/use-host-measurement.js +14 -2
- package/lib/commonjs/shared/components/boundary/portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/hooks/use-placeholder-styles.js +57 -0
- package/lib/commonjs/shared/components/boundary/portal/hooks/use-placeholder-styles.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/stores/host-registry.store.js +5 -44
- package/lib/commonjs/shared/components/boundary/portal/stores/host-registry.store.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/stores/portal-boundary-host.store.js +37 -5
- package/lib/commonjs/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/teleport.js +15 -2
- package/lib/commonjs/shared/components/boundary/portal/teleport.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/has-local-slot.js +18 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/has-local-slot.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/naming.js +10 -3
- package/lib/commonjs/shared/components/boundary/portal/utils/naming.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/offset-style.js +28 -48
- package/lib/commonjs/shared/components/boundary/portal/utils/offset-style.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js +254 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js +38 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js +29 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js +10 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js +25 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +6 -7
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/destination-signals.js +1 -22
- package/lib/commonjs/shared/components/boundary/utils/destination-signals.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +0 -21
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/source-signals.js +4 -9
- package/lib/commonjs/shared/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/commonjs/shared/components/masked-view.js +5 -0
- package/lib/commonjs/shared/components/masked-view.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +18 -8
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +34 -16
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/render-component.js +10 -0
- package/lib/commonjs/shared/components/screen-container/layers/render-component.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container/layers/surface-container.js +5 -3
- package/lib/commonjs/shared/components/screen-container/layers/surface-container.js.map +1 -1
- package/lib/commonjs/shared/index.js +4 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js +6 -3
- package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +6 -0
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/compose-slot-style.js +95 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/compose-slot-style.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/normalize-slots.js +30 -9
- package/lib/commonjs/shared/providers/screen/styles/helpers/normalize-slots.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +9 -3
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +2 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/slot-resolvers.js +96 -0
- package/lib/commonjs/shared/providers/screen/styles/hooks/slot-resolvers.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +16 -3
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/index.js +16 -3
- package/lib/commonjs/shared/providers/screen/styles/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/slot.provider.js +22 -51
- package/lib/commonjs/shared/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/stores/slot-references.store.js +53 -0
- package/lib/commonjs/shared/providers/screen/styles/stores/slot-references.store.js.map +1 -0
- package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js +22 -2
- package/lib/commonjs/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/entries.js +11 -4
- package/lib/commonjs/shared/stores/bounds/internals/entries.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/links.js +134 -51
- package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +1 -3
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/stores/system.store.js +5 -0
- package/lib/commonjs/shared/stores/system.store.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js +10 -69
- package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles/local-transform.js +59 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles/local-transform.js.map +1 -0
- package/lib/module/shared/components/boundary/components/boundary-target.js +12 -7
- package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/module/shared/components/boundary/create-boundary-component.js +67 -29
- package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/{use-boundary-presence.js → lifecycles/use-boundary-presence.js} +8 -4
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-boundary-presence.js.map +1 -0
- package/lib/module/shared/components/boundary/hooks/{use-initial-destination-measurement.js → lifecycles/use-initial-destination-measurement.js} +27 -10
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -0
- package/lib/module/shared/components/boundary/hooks/{use-initial-source-measurement.js → lifecycles/use-initial-source-measurement.js} +5 -7
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -0
- package/lib/module/shared/components/boundary/hooks/{use-refresh-boundary.js → lifecycles/use-refresh-boundary.js} +4 -4
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -0
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +15 -36
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/use-measurer.js +5 -6
- package/lib/module/shared/components/boundary/hooks/use-measurer.js.map +1 -1
- package/lib/module/shared/components/boundary/index.js +26 -29
- package/lib/module/shared/components/boundary/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-local-portal-host.js +53 -0
- package/lib/module/shared/components/boundary/portal/components/boundary-local-portal-host.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/components/host.js +21 -5
- package/lib/module/shared/components/boundary/portal/components/host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js +79 -28
- package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/portal.js +201 -127
- package/lib/module/shared/components/boundary/portal/components/portal.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/hooks/use-host-measurement.js +15 -3
- package/lib/module/shared/components/boundary/portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/hooks/use-placeholder-styles.js +52 -0
- package/lib/module/shared/components/boundary/portal/hooks/use-placeholder-styles.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/stores/host-registry.store.js +4 -41
- package/lib/module/shared/components/boundary/portal/stores/host-registry.store.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/stores/portal-boundary-host.store.js +35 -4
- package/lib/module/shared/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/teleport.js +16 -2
- package/lib/module/shared/components/boundary/portal/teleport.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/has-local-slot.js +13 -0
- package/lib/module/shared/components/boundary/portal/utils/has-local-slot.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/utils/naming.js +8 -2
- package/lib/module/shared/components/boundary/portal/utils/naming.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/offset-style.js +29 -48
- package/lib/module/shared/components/boundary/portal/utils/offset-style.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/ownership.js +246 -0
- package/lib/module/shared/components/boundary/portal/utils/ownership.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js +33 -0
- package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js +24 -0
- package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/utils/teleport-control.js +8 -0
- package/lib/module/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/visible-host.js +20 -0
- package/lib/module/shared/components/boundary/portal/utils/visible-host.js.map +1 -0
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +6 -7
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/destination-signals.js +2 -23
- package/lib/module/shared/components/boundary/utils/destination-signals.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/refresh-signals.js +0 -21
- package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/source-signals.js +4 -9
- package/lib/module/shared/components/boundary/utils/source-signals.js.map +1 -1
- package/lib/module/shared/components/masked-view.js +5 -0
- package/lib/module/shared/components/masked-view.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +19 -9
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +35 -17
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/render-component.js +6 -0
- package/lib/module/shared/components/screen-container/layers/render-component.js.map +1 -0
- package/lib/module/shared/components/screen-container/layers/surface-container.js +5 -3
- package/lib/module/shared/components/screen-container/layers/surface-container.js.map +1 -1
- package/lib/module/shared/index.js +4 -0
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/helpers/measured-bounds-writes.js +6 -3
- package/lib/module/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +6 -0
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/compose-slot-style.js +89 -0
- package/lib/module/shared/providers/screen/styles/helpers/compose-slot-style.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/helpers/normalize-slots.js +30 -9
- package/lib/module/shared/providers/screen/styles/helpers/normalize-slots.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js +9 -3
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js +2 -0
- package/lib/module/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/slot-resolvers.js +87 -0
- package/lib/module/shared/providers/screen/styles/hooks/slot-resolvers.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +16 -3
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/index.js +2 -1
- package/lib/module/shared/providers/screen/styles/index.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/slot.provider.js +22 -47
- package/lib/module/shared/providers/screen/styles/slot.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/stores/slot-references.store.js +47 -0
- package/lib/module/shared/providers/screen/styles/stores/slot-references.store.js.map +1 -0
- package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js +19 -1
- package/lib/module/shared/stores/bounds/helpers/link-pairs.helpers.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/entries.js +11 -4
- package/lib/module/shared/stores/bounds/internals/entries.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/links.js +135 -53
- package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +1 -3
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/stores/system.store.js +5 -0
- package/lib/module/shared/stores/system.store.js.map +1 -1
- package/lib/module/shared/types/animation.types.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/styles/compute.js +10 -69
- package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/styles/local-transform.js +52 -0
- package/lib/module/shared/utils/bounds/helpers/styles/local-transform.js.map +1 -0
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +1 -2
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/component-stack/components/component-screen.d.ts +1 -1
- package/lib/typescript/component-stack/components/component-screen.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -2
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/component-stack/types.d.ts +26 -0
- package/lib/typescript/component-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +1 -1
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -2
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/useHeaderConfigProps.d.ts +2 -2
- package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts.map +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts +1 -1
- package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts.map +1 -1
- package/lib/typescript/shared/components/activity/variants/activity-container.d.ts +1 -1
- package/lib/typescript/shared/components/activity/variants/activity-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts +1 -1
- package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts +1 -1
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts +0 -1
- package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-boundary-presence.d.ts +11 -0
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-boundary-presence.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/hooks/{use-initial-destination-measurement.d.ts → lifecycles/use-initial-destination-measurement.d.ts} +2 -2
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.d.ts +8 -0
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/hooks/{use-refresh-boundary.d.ts → lifecycles/use-refresh-boundary.d.ts} +2 -2
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts +5 -9
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/use-measurer.d.ts +4 -3
- package/lib/typescript/shared/components/boundary/hooks/use-measurer.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/index.d.ts +35 -24
- package/lib/typescript/shared/components/boundary/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-local-portal-host.d.ts +8 -0
- package/lib/typescript/shared/components/boundary/portal/components/boundary-local-portal-host.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/components/host.d.ts +2 -2
- package/lib/typescript/shared/components/boundary/portal/components/host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts +2 -2
- package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts +4 -3
- package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/hooks/use-host-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/hooks/use-placeholder-styles.d.ts +17 -0
- package/lib/typescript/shared/components/boundary/portal/hooks/use-placeholder-styles.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/stores/host-registry.store.d.ts +0 -7
- package/lib/typescript/shared/components/boundary/portal/stores/host-registry.store.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/stores/portal-boundary-host.store.d.ts +16 -1
- package/lib/typescript/shared/components/boundary/portal/stores/portal-boundary-host.store.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts +1 -1
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/has-local-slot.d.ts +3 -0
- package/lib/typescript/shared/components/boundary/portal/utils/has-local-slot.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts +2 -1
- package/lib/typescript/shared/components/boundary/portal/utils/naming.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/offset-style.d.ts +23 -30
- package/lib/typescript/shared/components/boundary/portal/utils/offset-style.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts +35 -0
- package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts +12 -0
- package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts +8 -0
- package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts +4 -0
- package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts +8 -0
- package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +7 -12
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/types.d.ts +9 -36
- package/lib/typescript/shared/components/boundary/types.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/source-signals.d.ts +0 -1
- package/lib/typescript/shared/components/boundary/utils/source-signals.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts +6 -5
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/masked-view.d.ts +5 -1
- package/lib/typescript/shared/components/masked-view.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts +1 -1
- package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/scene-view.d.ts +1 -1
- package/lib/typescript/shared/components/scene-view.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/index.d.ts +1 -1
- package/lib/typescript/shared/components/screen-container/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts +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 +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/render-component.d.ts +3 -0
- package/lib/typescript/shared/components/screen-container/layers/render-component.d.ts.map +1 -0
- package/lib/typescript/shared/components/screen-container/layers/surface-container.d.ts +1 -1
- package/lib/typescript/shared/components/screen-container/layers/surface-container.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +731 -683
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts +3 -3
- package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/screen-composer.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/components/floating-overlay-layer.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/styles/components/floating-overlay-layer.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/compose-slot-style.d.ts +4 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/compose-slot-style.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/normalize-slots.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/slot-resolvers.d.ts +11 -0
- package/lib/typescript/shared/providers/screen/styles/hooks/slot-resolvers.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +4 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +3 -3
- package/lib/typescript/shared/providers/screen/styles/index.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/styles/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/slot.provider.d.ts +5 -10
- package/lib/typescript/shared/providers/screen/styles/slot.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/stores/slot-references.store.d.ts +6 -0
- package/lib/typescript/shared/providers/screen/styles/stores/slot-references.store.d.ts.map +1 -0
- package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts +2 -0
- package/lib/typescript/shared/stores/bounds/helpers/link-pairs.helpers.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/entries.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts +4 -3
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/types.d.ts +9 -20
- package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
- package/lib/typescript/shared/stores/system.store.d.ts +1 -0
- package/lib/typescript/shared/stores/system.store.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +7 -1
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +99 -4
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles/local-transform.d.ts +6 -0
- package/lib/typescript/shared/utils/bounds/helpers/styles/local-transform.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +2 -0
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/component-stack/types.ts +26 -0
- package/src/shared/components/boundary/components/boundary-target.tsx +21 -7
- package/src/shared/components/boundary/create-boundary-component.tsx +92 -28
- package/src/shared/components/boundary/hooks/{use-boundary-presence.ts → lifecycles/use-boundary-presence.ts} +16 -5
- package/src/shared/components/boundary/hooks/{use-initial-destination-measurement.ts → lifecycles/use-initial-destination-measurement.ts} +40 -13
- package/src/shared/components/boundary/hooks/{use-initial-source-measurement.ts → lifecycles/use-initial-source-measurement.ts} +7 -9
- package/src/shared/components/boundary/hooks/{use-refresh-boundary.ts → lifecycles/use-refresh-boundary.ts} +6 -6
- package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +15 -45
- package/src/shared/components/boundary/hooks/use-measurer.ts +9 -14
- package/src/shared/components/boundary/index.tsx +55 -29
- package/src/shared/components/boundary/portal/components/boundary-local-portal-host.tsx +66 -0
- package/src/shared/components/boundary/portal/components/host.tsx +20 -5
- package/src/shared/components/boundary/portal/components/portal-boundary-host.tsx +112 -46
- package/src/shared/components/boundary/portal/components/portal.tsx +263 -134
- package/src/shared/components/boundary/portal/hooks/use-host-measurement.ts +23 -2
- package/src/shared/components/boundary/portal/hooks/use-placeholder-styles.ts +55 -0
- package/src/shared/components/boundary/portal/stores/host-registry.store.ts +4 -51
- package/src/shared/components/boundary/portal/stores/portal-boundary-host.store.ts +59 -6
- package/src/shared/components/boundary/portal/teleport.ts +28 -3
- package/src/shared/components/boundary/portal/utils/has-local-slot.ts +16 -0
- package/src/shared/components/boundary/portal/utils/naming.ts +11 -1
- package/src/shared/components/boundary/portal/utils/offset-style.ts +42 -137
- package/src/shared/components/boundary/portal/utils/ownership.ts +371 -0
- package/src/shared/components/boundary/portal/utils/resolve-portal.ts +50 -0
- package/src/shared/components/boundary/portal/utils/shallow-equal.ts +25 -0
- package/src/shared/components/boundary/portal/utils/teleport-control.ts +12 -0
- package/src/shared/components/boundary/portal/utils/visible-host.ts +24 -0
- package/src/shared/components/boundary/providers/boundary-root.provider.tsx +9 -18
- package/src/shared/components/boundary/types.ts +9 -39
- package/src/shared/components/boundary/utils/destination-signals.ts +1 -32
- package/src/shared/components/boundary/utils/refresh-signals.ts +0 -41
- package/src/shared/components/boundary/utils/source-signals.ts +5 -17
- package/src/shared/components/masked-view.tsx +4 -0
- package/src/shared/components/screen-container/layers/backdrop.tsx +31 -10
- package/src/shared/components/screen-container/layers/content.tsx +61 -22
- package/src/shared/components/screen-container/layers/render-component.ts +9 -0
- package/src/shared/components/screen-container/layers/surface-container.tsx +5 -4
- package/src/shared/index.ts +9 -5
- package/src/shared/providers/helpers/measured-bounds-writes.ts +6 -11
- package/src/shared/providers/register-bounds.provider.tsx +5 -0
- package/src/shared/providers/screen/animation/helpers/derivations.ts +3 -0
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +1 -0
- package/src/shared/providers/screen/styles/helpers/compose-slot-style.ts +129 -0
- package/src/shared/providers/screen/styles/helpers/normalize-slots.ts +45 -8
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/index.ts +14 -2
- package/src/shared/providers/screen/styles/helpers/resolve-slot-styles/materialize-slot.ts +3 -0
- package/src/shared/providers/screen/styles/hooks/slot-resolvers.tsx +111 -0
- package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +21 -3
- package/src/shared/providers/screen/styles/index.tsx +8 -3
- package/src/shared/providers/screen/styles/slot.provider.tsx +36 -54
- package/src/shared/providers/screen/styles/stores/slot-references.store.ts +71 -0
- package/src/shared/stores/bounds/helpers/link-pairs.helpers.ts +24 -1
- package/src/shared/stores/bounds/internals/entries.ts +13 -5
- package/src/shared/stores/bounds/internals/links.ts +167 -85
- package/src/shared/stores/bounds/internals/resolver.ts +0 -2
- package/src/shared/stores/bounds/types.ts +10 -22
- package/src/shared/stores/system.store.ts +6 -0
- package/src/shared/types/animation.types.ts +8 -1
- package/src/shared/types/index.ts +5 -0
- package/src/shared/types/screen.types.ts +111 -4
- package/src/shared/utils/bounds/helpers/styles/compute.ts +22 -124
- package/src/shared/utils/bounds/helpers/styles/local-transform.ts +86 -0
- package/src/shared/utils/bounds/types/options.ts +2 -0
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-presence.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-initial-destination-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-initial-source-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-refresh-boundary.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/resolve-portal.js +0 -36
- package/lib/commonjs/shared/components/boundary/portal/resolve-portal.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/attachment.js +0 -40
- package/lib/commonjs/shared/components/boundary/portal/utils/attachment.js.map +0 -1
- package/lib/module/shared/components/boundary/hooks/use-boundary-presence.js.map +0 -1
- package/lib/module/shared/components/boundary/hooks/use-initial-destination-measurement.js.map +0 -1
- package/lib/module/shared/components/boundary/hooks/use-initial-source-measurement.js.map +0 -1
- package/lib/module/shared/components/boundary/hooks/use-refresh-boundary.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/resolve-portal.js +0 -31
- package/lib/module/shared/components/boundary/portal/resolve-portal.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/utils/attachment.js +0 -35
- package/lib/module/shared/components/boundary/portal/utils/attachment.js.map +0 -1
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-presence.d.ts +0 -9
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-presence.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/hooks/use-initial-destination-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/hooks/use-initial-source-measurement.d.ts +0 -9
- package/lib/typescript/shared/components/boundary/hooks/use-initial-source-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/hooks/use-refresh-boundary.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/resolve-portal.d.ts +0 -14
- package/lib/typescript/shared/components/boundary/portal/resolve-portal.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/utils/attachment.d.ts +0 -21
- package/lib/typescript/shared/components/boundary/portal/utils/attachment.d.ts.map +0 -1
- package/src/shared/components/boundary/portal/resolve-portal.ts +0 -40
- package/src/shared/components/boundary/portal/utils/attachment.ts +0 -48
|
@@ -11,37 +11,39 @@ import type { View } from "react-native";
|
|
|
11
11
|
import Animated, {
|
|
12
12
|
type AnimatedRef,
|
|
13
13
|
runOnJS,
|
|
14
|
+
runOnUI,
|
|
14
15
|
useAnimatedProps,
|
|
15
16
|
useAnimatedReaction,
|
|
16
|
-
useAnimatedStyle,
|
|
17
17
|
useSharedValue,
|
|
18
18
|
} from "react-native-reanimated";
|
|
19
|
+
import { EPSILON } from "../../../../constants";
|
|
19
20
|
import { useDescriptorsStore } from "../../../../providers/screen/descriptors";
|
|
20
21
|
import { useScreenSlots } from "../../../../providers/screen/styles";
|
|
22
|
+
import { useRegisteredScreenSlots } from "../../../../providers/screen/styles/stores/slot-references.store";
|
|
21
23
|
import { AnimationStore } from "../../../../stores/animation.store";
|
|
22
|
-
import { getLinkKeyFromTag } from "../../../../stores/bounds/helpers/link-pairs.helpers";
|
|
23
|
-
import { getLink } from "../../../../stores/bounds/internals/links";
|
|
24
24
|
import { pairs } from "../../../../stores/bounds/internals/state";
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
getHostCapturesScroll,
|
|
29
|
-
useActiveHostKey,
|
|
30
|
-
} from "../stores/host-registry.store";
|
|
25
|
+
import { logger } from "../../../../utils/logger";
|
|
26
|
+
import { usePlaceholderStyles } from "../hooks/use-placeholder-styles";
|
|
27
|
+
import { useActiveHostKey } from "../stores/host-registry.store";
|
|
31
28
|
import {
|
|
29
|
+
dropStalePortalBoundaryHosts,
|
|
32
30
|
mountPortalBoundaryHost,
|
|
33
31
|
unmountPortalBoundaryHost,
|
|
34
32
|
} from "../stores/portal-boundary-host.store";
|
|
35
33
|
import { isTeleportAvailable, NativePortal } from "../teleport";
|
|
36
34
|
import {
|
|
37
|
-
|
|
38
|
-
resolvePortalAttachmentTargets,
|
|
39
|
-
} from "../utils/attachment";
|
|
40
|
-
import {
|
|
35
|
+
createBoundaryLocalPortalHostName,
|
|
41
36
|
createPortalBoundaryHostName,
|
|
42
37
|
PORTAL_HOST_NAME_RESET_VALUE,
|
|
43
38
|
} from "../utils/naming";
|
|
44
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
canSwitchBoundaryLocalHandoffImmediately,
|
|
41
|
+
type PortalOwnershipSignal,
|
|
42
|
+
resolveBoundaryPortalOwnership,
|
|
43
|
+
} from "../utils/ownership";
|
|
44
|
+
import { shallowEqual } from "../utils/shallow-equal";
|
|
45
|
+
import { shouldAttachBoundaryPortal } from "../utils/teleport-control";
|
|
46
|
+
import { resolveNextVisiblePortalHostName } from "../utils/visible-host";
|
|
45
47
|
|
|
46
48
|
type NullableHostNamePortalProps = Omit<
|
|
47
49
|
ComponentProps<NonNullable<typeof NativePortal>>,
|
|
@@ -50,8 +52,8 @@ type NullableHostNamePortalProps = Omit<
|
|
|
50
52
|
hostName?: string | null;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
const
|
|
54
|
-
?
|
|
55
|
+
const AnimatedNativePortal = NativePortal
|
|
56
|
+
? Animated.createAnimatedComponent(
|
|
55
57
|
NativePortal as ComponentType<NullableHostNamePortalProps>,
|
|
56
58
|
)
|
|
57
59
|
: null;
|
|
@@ -59,7 +61,8 @@ const TransitionAwareTeleport = NativePortal
|
|
|
59
61
|
interface PortalProps {
|
|
60
62
|
id?: string;
|
|
61
63
|
children: ReactNode;
|
|
62
|
-
|
|
64
|
+
handoff?: boolean;
|
|
65
|
+
escapeClipping?: boolean;
|
|
63
66
|
/**
|
|
64
67
|
* Ref to the layout-preserving placeholder wrapper. Boundaries measure
|
|
65
68
|
* this instead of teleported content — the placeholder keeps the source
|
|
@@ -67,214 +70,340 @@ interface PortalProps {
|
|
|
67
70
|
* host.
|
|
68
71
|
*/
|
|
69
72
|
placeholderRef?: AnimatedRef<View>;
|
|
73
|
+
placeholderChildren?: ReactNode;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
export const Portal = memo(function Portal({
|
|
73
|
-
id
|
|
77
|
+
id,
|
|
74
78
|
children,
|
|
75
|
-
|
|
79
|
+
handoff = false,
|
|
80
|
+
escapeClipping = false,
|
|
76
81
|
placeholderRef,
|
|
82
|
+
placeholderChildren,
|
|
77
83
|
}: PortalProps) {
|
|
78
|
-
// Teleporting requires the optional `react-native-teleport` peer
|
|
79
|
-
//
|
|
80
|
-
// children` path below).
|
|
81
|
-
const isPortalEnabled =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
// Teleporting requires the optional `react-native-teleport` peer and a stable
|
|
85
|
+
// `id` to name the boundary host. Missing either degrades to inline rendering
|
|
86
|
+
// (the `return children` path below).
|
|
87
|
+
const isPortalEnabled =
|
|
88
|
+
(handoff || escapeClipping) && isTeleportAvailable && id !== undefined;
|
|
89
|
+
|
|
90
|
+
if (__DEV__ && (handoff || escapeClipping) && id === undefined) {
|
|
91
|
+
logger.warnOnce(
|
|
92
|
+
"portal:missing-id",
|
|
93
|
+
"A handoff or escapeClipping boundary was rendered without an id; rendering inline.",
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const boundaryId = id ?? "";
|
|
97
|
+
const ownScreenSlots = useScreenSlots();
|
|
87
98
|
const sourcePairKey = useDescriptorsStore((s) => s.derivations.sourcePairKey);
|
|
88
99
|
const currentScreenKey = useDescriptorsStore(
|
|
89
100
|
(s) => s.derivations.currentScreenKey,
|
|
90
101
|
);
|
|
91
102
|
|
|
92
|
-
const
|
|
103
|
+
const [ownership, setOwnership] = useState<Extract<
|
|
104
|
+
PortalOwnershipSignal,
|
|
105
|
+
{ status: "complete" }
|
|
106
|
+
> | null>(null);
|
|
93
107
|
|
|
94
|
-
const
|
|
95
|
-
|
|
108
|
+
const styleOwnerScreenKey = ownership?.ownerScreenKey ?? currentScreenKey;
|
|
109
|
+
const ownerScreenSlots = useRegisteredScreenSlots(styleOwnerScreenKey);
|
|
110
|
+
const activeScreenSlots = ownerScreenSlots ?? ownScreenSlots;
|
|
111
|
+
const {
|
|
112
|
+
localStylesMaps: activeLocalStylesMaps,
|
|
113
|
+
nextInterpolatorReady: activeNextInterpolatorReady,
|
|
114
|
+
slotsMap: activeSlotsMap,
|
|
115
|
+
} = activeScreenSlots;
|
|
116
|
+
const requestedPortalHostName = useSharedValue<string | null>(null);
|
|
117
|
+
const visiblePortalHostName = useSharedValue<string | null>(null);
|
|
118
|
+
const canSwitchPortalHostImmediately = useSharedValue(0);
|
|
119
|
+
|
|
120
|
+
const targetScreenKey = ownership ? ownership.hostScreenKey : null;
|
|
121
|
+
const settledHostScreenKey = ownership?.hostScreenKey ?? null;
|
|
122
|
+
const settledHostProgress = AnimationStore.getValue(
|
|
123
|
+
settledHostScreenKey ?? currentScreenKey,
|
|
124
|
+
"progressSettled",
|
|
96
125
|
);
|
|
97
|
-
const
|
|
98
|
-
|
|
126
|
+
const settledHostAnimating = AnimationStore.getValue(
|
|
127
|
+
settledHostScreenKey ?? currentScreenKey,
|
|
128
|
+
"progressAnimating",
|
|
99
129
|
);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
nextScreenKey,
|
|
108
|
-
portalAttachTarget,
|
|
109
|
-
sourcePairKey,
|
|
110
|
-
},
|
|
130
|
+
const settledHostClosing = AnimationStore.getValue(
|
|
131
|
+
settledHostScreenKey ?? currentScreenKey,
|
|
132
|
+
"closing",
|
|
133
|
+
);
|
|
134
|
+
const settledHostVisualProgress = AnimationStore.getValue(
|
|
135
|
+
settledHostScreenKey ?? currentScreenKey,
|
|
136
|
+
"visualProgress",
|
|
111
137
|
);
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
?
|
|
115
|
-
: false;
|
|
116
|
-
const progress = AnimationStore.getValue(
|
|
117
|
-
progressScreenKey ?? "",
|
|
118
|
-
"transitionProgress",
|
|
138
|
+
|
|
139
|
+
const activeHostKey = useActiveHostKey(
|
|
140
|
+
escapeClipping ? targetScreenKey : null,
|
|
119
141
|
);
|
|
120
|
-
const
|
|
142
|
+
const boundaryLocalHostName =
|
|
143
|
+
handoff && !escapeClipping && targetScreenKey
|
|
144
|
+
? createBoundaryLocalPortalHostName(targetScreenKey, boundaryId)
|
|
145
|
+
: null;
|
|
121
146
|
|
|
122
|
-
const
|
|
123
|
-
(
|
|
124
|
-
|
|
125
|
-
|
|
147
|
+
const updatePortalOwnership = useCallback(
|
|
148
|
+
(
|
|
149
|
+
hostScreenKey: string | null,
|
|
150
|
+
ownerPairKey?: string,
|
|
151
|
+
ownerScreenKey?: string,
|
|
152
|
+
) => {
|
|
153
|
+
if (hostScreenKey && ownerPairKey && ownerScreenKey) {
|
|
154
|
+
setOwnership((current) => {
|
|
126
155
|
if (
|
|
127
|
-
current?.
|
|
128
|
-
current.
|
|
156
|
+
current?.hostScreenKey === hostScreenKey &&
|
|
157
|
+
current.ownerPairKey === ownerPairKey &&
|
|
158
|
+
current.ownerScreenKey === ownerScreenKey
|
|
129
159
|
) {
|
|
130
160
|
return current;
|
|
131
161
|
}
|
|
132
162
|
|
|
133
163
|
return {
|
|
134
|
-
|
|
135
|
-
|
|
164
|
+
hostScreenKey,
|
|
165
|
+
ownerPairKey,
|
|
166
|
+
ownerScreenKey,
|
|
167
|
+
status: "complete",
|
|
136
168
|
};
|
|
137
169
|
});
|
|
138
170
|
return;
|
|
139
171
|
}
|
|
140
172
|
|
|
141
|
-
|
|
173
|
+
setOwnership((current) => (current ? null : current));
|
|
142
174
|
},
|
|
143
175
|
[],
|
|
144
176
|
);
|
|
145
177
|
|
|
146
178
|
useLayoutEffect(() => {
|
|
147
|
-
if (!isPortalEnabled || !
|
|
148
|
-
|
|
179
|
+
if (!isPortalEnabled || !ownership || !targetScreenKey) {
|
|
180
|
+
requestedPortalHostName.set(null);
|
|
181
|
+
visiblePortalHostName.set(null);
|
|
182
|
+
unmountPortalBoundaryHost(boundaryId);
|
|
149
183
|
return;
|
|
150
184
|
}
|
|
151
185
|
|
|
186
|
+
if (boundaryLocalHostName) {
|
|
187
|
+
requestedPortalHostName.set(boundaryLocalHostName);
|
|
188
|
+
unmountPortalBoundaryHost(boundaryId);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (!escapeClipping || !activeHostKey) {
|
|
193
|
+
requestedPortalHostName.set(null);
|
|
194
|
+
visiblePortalHostName.set(null);
|
|
195
|
+
unmountPortalBoundaryHost(boundaryId);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const portalHostName = createPortalBoundaryHostName(
|
|
200
|
+
activeHostKey,
|
|
201
|
+
boundaryId,
|
|
202
|
+
ownership.ownerPairKey,
|
|
203
|
+
);
|
|
204
|
+
|
|
152
205
|
mountPortalBoundaryHost({
|
|
153
|
-
boundaryId
|
|
154
|
-
|
|
206
|
+
boundaryId,
|
|
207
|
+
escapeClipping,
|
|
155
208
|
hostKey: activeHostKey,
|
|
156
|
-
|
|
209
|
+
localStylesMaps: activeLocalStylesMaps,
|
|
210
|
+
pairKey: ownership.ownerPairKey,
|
|
211
|
+
portalHostName,
|
|
157
212
|
screenKey: targetScreenKey,
|
|
213
|
+
slotsMap: activeSlotsMap,
|
|
158
214
|
});
|
|
159
215
|
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
attachedHostName.set(createPortalBoundaryHostName(activeHostKey, id));
|
|
216
|
+
// Request the new receiver immediately, but keep the currently visible
|
|
217
|
+
// receiver until the new interpolator is ready. This avoids a no-host gap
|
|
218
|
+
// during A -> B(closing) -> C(opening) spam retargets.
|
|
219
|
+
requestedPortalHostName.set(portalHostName);
|
|
165
220
|
}, [
|
|
166
221
|
activeHostKey,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
attachment,
|
|
170
|
-
id,
|
|
222
|
+
boundaryId,
|
|
223
|
+
escapeClipping,
|
|
171
224
|
isPortalEnabled,
|
|
225
|
+
activeLocalStylesMaps,
|
|
226
|
+
activeSlotsMap,
|
|
227
|
+
ownership,
|
|
228
|
+
boundaryLocalHostName,
|
|
229
|
+
requestedPortalHostName,
|
|
172
230
|
targetScreenKey,
|
|
231
|
+
visiblePortalHostName,
|
|
173
232
|
]);
|
|
174
233
|
|
|
175
234
|
useLayoutEffect(() => {
|
|
176
235
|
return () => {
|
|
177
|
-
|
|
178
|
-
|
|
236
|
+
requestedPortalHostName.set(null);
|
|
237
|
+
visiblePortalHostName.set(null);
|
|
238
|
+
unmountPortalBoundaryHost(boundaryId);
|
|
179
239
|
};
|
|
180
|
-
}, [
|
|
240
|
+
}, [boundaryId, requestedPortalHostName, visiblePortalHostName]);
|
|
181
241
|
|
|
182
242
|
useAnimatedReaction(
|
|
183
243
|
() => {
|
|
184
244
|
"worklet";
|
|
185
245
|
if (!isPortalEnabled || !sourcePairKey) {
|
|
186
|
-
return
|
|
246
|
+
return {
|
|
247
|
+
hostScreenKey: null,
|
|
248
|
+
ownerPairKey: sourcePairKey,
|
|
249
|
+
ownerScreenKey: null,
|
|
250
|
+
status: "clear",
|
|
251
|
+
};
|
|
187
252
|
}
|
|
188
253
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
254
|
+
return resolveBoundaryPortalOwnership({
|
|
255
|
+
boundaryId,
|
|
256
|
+
currentScreenKey,
|
|
257
|
+
escapeClipping,
|
|
258
|
+
handoff,
|
|
259
|
+
isSettledHostClosingComplete:
|
|
260
|
+
!!settledHostClosing.get() &&
|
|
261
|
+
settledHostVisualProgress.get() <= EPSILON,
|
|
262
|
+
isSettledHostReady:
|
|
263
|
+
settledHostProgress.get() === 1 && settledHostAnimating.get() === 0,
|
|
264
|
+
pairsState: pairs.get(),
|
|
265
|
+
settledHostScreenKey,
|
|
266
|
+
sourcePairKey,
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
(signal, previousSignal) => {
|
|
270
|
+
"worklet";
|
|
271
|
+
if (shallowEqual(previousSignal, signal)) {
|
|
272
|
+
return;
|
|
198
273
|
}
|
|
199
274
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
275
|
+
if (!handoff || escapeClipping) {
|
|
276
|
+
canSwitchPortalHostImmediately.set(0);
|
|
277
|
+
} else if (signal.status === "pending") {
|
|
278
|
+
canSwitchPortalHostImmediately.set(0);
|
|
279
|
+
return;
|
|
280
|
+
} else {
|
|
281
|
+
const hostScreenKey =
|
|
282
|
+
signal.status === "complete" ? signal.hostScreenKey : null;
|
|
283
|
+
let previousOwnerPairKey: string | undefined;
|
|
207
284
|
|
|
208
|
-
if (
|
|
209
|
-
|
|
285
|
+
if (previousSignal?.status === "complete") {
|
|
286
|
+
previousOwnerPairKey = previousSignal.ownerPairKey ?? undefined;
|
|
287
|
+
}
|
|
288
|
+
const canSwitchImmediately = canSwitchBoundaryLocalHandoffImmediately({
|
|
289
|
+
hostScreenKey,
|
|
290
|
+
ownerPairKey:
|
|
291
|
+
signal.status === "complete" ? signal.ownerPairKey : undefined,
|
|
292
|
+
previousOwnerPairKey,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
canSwitchPortalHostImmediately.set(canSwitchImmediately ? 1 : 0);
|
|
296
|
+
|
|
297
|
+
if (canSwitchImmediately && hostScreenKey) {
|
|
298
|
+
const hostName = createBoundaryLocalPortalHostName(
|
|
299
|
+
hostScreenKey,
|
|
300
|
+
boundaryId,
|
|
301
|
+
);
|
|
302
|
+
requestedPortalHostName.set(hostName);
|
|
303
|
+
visiblePortalHostName.set(hostName);
|
|
210
304
|
}
|
|
211
305
|
}
|
|
212
306
|
|
|
213
|
-
|
|
307
|
+
runOnJS(updatePortalOwnership)(
|
|
308
|
+
signal.hostScreenKey,
|
|
309
|
+
signal.ownerPairKey,
|
|
310
|
+
signal.ownerScreenKey ?? undefined,
|
|
311
|
+
);
|
|
312
|
+
},
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
useAnimatedReaction(
|
|
316
|
+
() => {
|
|
317
|
+
"worklet";
|
|
318
|
+
const slot = activeSlotsMap.get()[boundaryId];
|
|
319
|
+
const teleport = slot?.props?.teleport;
|
|
320
|
+
const shouldTeleport = shouldAttachBoundaryPortal({
|
|
321
|
+
enabled: isPortalEnabled,
|
|
322
|
+
teleport,
|
|
323
|
+
});
|
|
324
|
+
const requestedName = requestedPortalHostName.get();
|
|
325
|
+
const visibleName = visiblePortalHostName.get();
|
|
326
|
+
const isInterpolatorReady = activeNextInterpolatorReady.get();
|
|
327
|
+
const nextVisibleName = resolveNextVisiblePortalHostName({
|
|
328
|
+
canSwitchImmediately: canSwitchPortalHostImmediately.get() === 1,
|
|
329
|
+
isInterpolatorReady: isInterpolatorReady === 1,
|
|
330
|
+
requestedName,
|
|
331
|
+
shouldTeleport,
|
|
332
|
+
visibleName,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
isInterpolatorReady,
|
|
337
|
+
nextVisibleName,
|
|
338
|
+
requestedName,
|
|
339
|
+
shouldTeleport,
|
|
340
|
+
teleport,
|
|
341
|
+
visibleName,
|
|
342
|
+
};
|
|
214
343
|
},
|
|
215
|
-
(
|
|
344
|
+
(state, previousState) => {
|
|
216
345
|
"worklet";
|
|
217
|
-
if (
|
|
346
|
+
if (shallowEqual(previousState, state)) {
|
|
218
347
|
return;
|
|
219
348
|
}
|
|
220
349
|
|
|
221
|
-
|
|
350
|
+
if (state.nextVisibleName !== state.visibleName) {
|
|
351
|
+
visiblePortalHostName.set(state.nextVisibleName);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Visible receiver has caught up to the request: GC the superseded hosts.
|
|
356
|
+
if (state.visibleName && state.visibleName === state.requestedName) {
|
|
357
|
+
runOnJS(dropStalePortalBoundaryHosts)({
|
|
358
|
+
boundaryId,
|
|
359
|
+
keepPortalHostName: state.visibleName,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
222
362
|
},
|
|
223
363
|
);
|
|
224
364
|
|
|
225
365
|
const teleportProps = useAnimatedProps(() => {
|
|
226
366
|
"worklet";
|
|
227
367
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
368
|
+
const slot = activeSlotsMap.get()[boundaryId];
|
|
369
|
+
const { teleport, ...slotProps } = slot?.props ?? {};
|
|
370
|
+
const shouldTeleport = shouldAttachBoundaryPortal({
|
|
371
|
+
enabled: isPortalEnabled,
|
|
372
|
+
teleport,
|
|
373
|
+
});
|
|
374
|
+
const visibleName = visiblePortalHostName.get();
|
|
234
375
|
|
|
235
376
|
return {
|
|
236
377
|
// Preserve portal slot props from the interpolator while keeping
|
|
237
|
-
// hostName owned by the attachment gate below.
|
|
378
|
+
// hostName owned by the attachment gate below. Handoff
|
|
379
|
+
// waits until the receiving interpolator owns styles for the same host;
|
|
380
|
+
// after that, it stays attached until teleport is disabled or retargeted.
|
|
238
381
|
...slotProps,
|
|
239
382
|
hostName:
|
|
240
|
-
shouldTeleport &&
|
|
241
|
-
?
|
|
383
|
+
shouldTeleport && visibleName
|
|
384
|
+
? visibleName
|
|
242
385
|
: PORTAL_HOST_NAME_RESET_VALUE,
|
|
243
386
|
};
|
|
244
387
|
});
|
|
245
388
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
// first layout lands (dims 0) sizing stays natural so an instant attach
|
|
249
|
-
// cannot collapse the slot.
|
|
250
|
-
const placeholderStyle = useAnimatedStyle(() => {
|
|
251
|
-
"worklet";
|
|
252
|
-
const hostName = attachedHostName.get();
|
|
253
|
-
const isAttached = hostName !== null;
|
|
254
|
-
const width = placeholderWidth.get();
|
|
255
|
-
const height = placeholderHeight.get();
|
|
256
|
-
|
|
257
|
-
if (!isAttached || width === 0) {
|
|
258
|
-
return { width: "auto", height: "auto" } as const;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return { width, height };
|
|
389
|
+
const { handleOnLayout, placeholderStyle } = usePlaceholderStyles({
|
|
390
|
+
visiblePortalHostName,
|
|
262
391
|
});
|
|
263
392
|
|
|
264
|
-
if (isPortalEnabled &&
|
|
393
|
+
if (isPortalEnabled && AnimatedNativePortal) {
|
|
265
394
|
return (
|
|
266
395
|
<Animated.View
|
|
267
396
|
ref={placeholderRef}
|
|
268
|
-
onLayout={(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}}
|
|
397
|
+
onLayout={({ nativeEvent: { layout } }) =>
|
|
398
|
+
runOnUI(handleOnLayout)(layout)
|
|
399
|
+
}
|
|
272
400
|
style={placeholderStyle}
|
|
273
401
|
collapsable={false}
|
|
274
402
|
>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
403
|
+
{placeholderChildren}
|
|
404
|
+
<AnimatedNativePortal animatedProps={teleportProps} name={boundaryId}>
|
|
405
|
+
{children}
|
|
406
|
+
</AnimatedNativePortal>
|
|
278
407
|
</Animated.View>
|
|
279
408
|
);
|
|
280
409
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useLayoutEffect, useState } from "react";
|
|
2
2
|
import type { View } from "react-native";
|
|
3
3
|
import {
|
|
4
|
+
cancelAnimation,
|
|
4
5
|
measure,
|
|
5
6
|
runOnJS,
|
|
6
7
|
runOnUI,
|
|
7
8
|
useAnimatedReaction,
|
|
8
9
|
useAnimatedRef,
|
|
9
10
|
useSharedValue,
|
|
11
|
+
withDelay,
|
|
12
|
+
withTiming,
|
|
10
13
|
} from "react-native-reanimated";
|
|
11
14
|
import { useOriginContext } from "../../../../providers/screen/origin.provider";
|
|
12
15
|
import { ScrollStore } from "../../../../stores/scroll.store";
|
|
@@ -19,6 +22,8 @@ import {
|
|
|
19
22
|
setPortalHostBounds,
|
|
20
23
|
} from "../stores/host-bounds.store";
|
|
21
24
|
|
|
25
|
+
const HOST_MEASUREMENT_RETRY_DELAY_MS = 16;
|
|
26
|
+
|
|
22
27
|
type UseHostMeasurementParams = {
|
|
23
28
|
capturesScroll: boolean;
|
|
24
29
|
enabled: boolean;
|
|
@@ -37,6 +42,7 @@ export const useHostMeasurement = ({
|
|
|
37
42
|
const [canRenderHosts, setCanRenderHosts] = useState<boolean>(false);
|
|
38
43
|
const { originRef } = useOriginContext();
|
|
39
44
|
const hasMeasuredHost = useSharedValue(false);
|
|
45
|
+
const retryToken = useSharedValue(0);
|
|
40
46
|
|
|
41
47
|
useAnimatedReaction(
|
|
42
48
|
() => {
|
|
@@ -45,10 +51,17 @@ export const useHostMeasurement = ({
|
|
|
45
51
|
return null;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
return hasMeasuredHost.get();
|
|
54
|
+
return [hasMeasuredHost.get(), retryToken.get()] as const;
|
|
49
55
|
},
|
|
50
|
-
(
|
|
56
|
+
(state) => {
|
|
51
57
|
"worklet";
|
|
58
|
+
if (!state) {
|
|
59
|
+
cancelAnimation(retryToken);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const [hasAlreadyMeasured] = state;
|
|
64
|
+
|
|
52
65
|
if (!enabled || hasAlreadyMeasured) {
|
|
53
66
|
return;
|
|
54
67
|
}
|
|
@@ -57,9 +70,17 @@ export const useHostMeasurement = ({
|
|
|
57
70
|
const measuredOrigin = measure(originRef);
|
|
58
71
|
|
|
59
72
|
if (!measured || !measuredOrigin) {
|
|
73
|
+
cancelAnimation(retryToken);
|
|
74
|
+
retryToken.set(
|
|
75
|
+
withDelay(
|
|
76
|
+
HOST_MEASUREMENT_RETRY_DELAY_MS,
|
|
77
|
+
withTiming(retryToken.get() + 1, { duration: 0 }),
|
|
78
|
+
),
|
|
79
|
+
);
|
|
60
80
|
return;
|
|
61
81
|
}
|
|
62
82
|
|
|
83
|
+
cancelAnimation(retryToken);
|
|
63
84
|
hasMeasuredHost.set(true);
|
|
64
85
|
|
|
65
86
|
// A measurement taken mid rubber-band would bake the transient
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import type { LayoutRectangle } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
type SharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
|
|
9
|
+
interface UsePlaceholderProps {
|
|
10
|
+
visiblePortalHostName: SharedValue<string | null>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const usePlaceholderStyles = ({
|
|
14
|
+
visiblePortalHostName,
|
|
15
|
+
}: UsePlaceholderProps) => {
|
|
16
|
+
const placeholderWidth = useSharedValue(0);
|
|
17
|
+
const placeholderHeight = useSharedValue(0);
|
|
18
|
+
// Pin the placeholder to its measured size while content lives in the host,
|
|
19
|
+
// in the same UI frame the host name flips — no commit in between. Until the
|
|
20
|
+
// first layout lands (dims 0) sizing stays natural so an instant attach
|
|
21
|
+
// cannot collapse the slot.
|
|
22
|
+
const placeholderStyle = useAnimatedStyle(() => {
|
|
23
|
+
"worklet";
|
|
24
|
+
const isAttached = visiblePortalHostName.get() !== null;
|
|
25
|
+
const width = placeholderWidth.get();
|
|
26
|
+
const height = placeholderHeight.get();
|
|
27
|
+
|
|
28
|
+
if (!isAttached || width === 0) {
|
|
29
|
+
return { width: "auto", height: "auto" } as const;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return { width, height };
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const handleOnLayout = useCallback(
|
|
36
|
+
(layout: LayoutRectangle) => {
|
|
37
|
+
"worklet";
|
|
38
|
+
const { width, height } = layout;
|
|
39
|
+
if (width === 0 || height === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const hasValidDimensions =
|
|
44
|
+
placeholderHeight.get() !== 0 && placeholderWidth.get() !== 0;
|
|
45
|
+
|
|
46
|
+
if (!hasValidDimensions) {
|
|
47
|
+
placeholderWidth.set(width);
|
|
48
|
+
placeholderHeight.set(height);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[placeholderHeight, placeholderWidth],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return { placeholderStyle, handleOnLayout };
|
|
55
|
+
};
|