react-native-screen-transitions 3.11.0 → 3.11.2
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/hooks/lifecycles/use-initial-destination-measurement.js +27 -15
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +5 -4
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/destination-signals.js +8 -4
- package/lib/commonjs/shared/components/boundary/utils/destination-signals.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +2 -4
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js +3 -7
- package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
- package/lib/commonjs/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -20
- package/lib/commonjs/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/create-interpolator-scope.js +40 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
- package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +22 -27
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/entries.js +27 -0
- package/lib/commonjs/shared/stores/bounds/internals/entries.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/links.js +25 -0
- package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +2 -12
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js +2 -2
- package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +30 -18
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js +3 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +3 -5
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +5 -4
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +4 -15
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +22 -24
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -36
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +2 -2
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/destination-signals.js +8 -4
- package/lib/module/shared/components/boundary/utils/destination-signals.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/refresh-signals.js +2 -4
- package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js +4 -8
- package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js +1 -3
- package/lib/module/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.js.map +1 -1
- package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js +3 -19
- package/lib/module/shared/providers/screen/descriptors/helpers/get-ancestor-keys.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/create-interpolator-scope.js +35 -0
- package/lib/module/shared/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js +15 -14
- package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +22 -27
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/entries.js +27 -1
- package/lib/module/shared/stores/bounds/internals/entries.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/links.js +25 -2
- package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +3 -13
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js +3 -3
- package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +1 -5
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +0 -2
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/destination-signals.d.ts +2 -3
- 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 +0 -2
- package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts +1 -3
- package/lib/typescript/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts +0 -8
- package/lib/typescript/shared/providers/screen/descriptors/helpers/get-ancestor-keys.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/create-interpolator-scope.d.ts +9 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/create-interpolator-scope.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts +1 -3
- package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts +4 -4
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/entries.d.ts +2 -1
- package/lib/typescript/shared/stores/bounds/internals/entries.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts +3 -1
- 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/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +67 -24
- package/src/shared/components/boundary/hooks/lifecycles/use-initial-source-measurement.ts +6 -1
- package/src/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +8 -9
- package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +5 -4
- package/src/shared/components/boundary/portal/components/boundary-content-portal/components/host.tsx +1 -1
- package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +4 -20
- package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +27 -37
- package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +10 -57
- package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +1 -8
- package/src/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +0 -3
- package/src/shared/components/boundary/utils/destination-signals.ts +8 -8
- package/src/shared/components/boundary/utils/refresh-signals.ts +2 -10
- package/src/shared/providers/screen/descriptors/descriptors.provider.tsx +4 -11
- package/src/shared/providers/screen/descriptors/helpers/derive-descriptor-derivations.ts +0 -4
- package/src/shared/providers/screen/descriptors/helpers/get-ancestor-keys.ts +3 -30
- package/src/shared/providers/screen/styles/helpers/create-interpolator-scope.ts +45 -0
- package/src/shared/providers/screen/styles/helpers/resolve-interpolator-style-handoff.ts +16 -16
- package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +28 -35
- package/src/shared/stores/bounds/internals/entries.ts +38 -1
- package/src/shared/stores/bounds/internals/links.ts +36 -0
- package/src/shared/stores/bounds/internals/resolver.ts +7 -21
- package/src/shared/utils/bounds/helpers/create-link-accessor.ts +9 -3
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -18
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -21
- package/lib/commonjs/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js +0 -13
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.js.map +0 -1
- package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -16
- package/lib/module/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts +0 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts +0 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts.map +0 -1
- package/src/shared/components/boundary/portal/components/boundary-portal/helpers/has-local-slot.ts +0 -16
- package/src/shared/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx +0 -15
|
@@ -4,12 +4,10 @@ import {
|
|
|
4
4
|
type SharedValue,
|
|
5
5
|
useAnimatedReaction,
|
|
6
6
|
} from "react-native-reanimated";
|
|
7
|
-
import
|
|
8
|
-
import { pairs } from "../../../../../../stores/bounds/internals/state";
|
|
7
|
+
import { getPairKeyForSource } from "../../../../../../stores/bounds/internals/links";
|
|
9
8
|
import type { ScreenPairKey } from "../../../../../../stores/bounds/types";
|
|
10
9
|
import type { NormalizedTransitionInterpolatedStyle } from "../../../../../../types/animation.types";
|
|
11
10
|
import { createBoundaryPortalHostName } from "../../../utils/naming";
|
|
12
|
-
import { hasActiveBoundaryPortalLink } from "../helpers/active-pair";
|
|
13
11
|
import {
|
|
14
12
|
mountPortalBoundaryHost,
|
|
15
13
|
unmountPortalBoundaryHostByName,
|
|
@@ -19,62 +17,57 @@ type UseActivePortalBoundaryHostParams = {
|
|
|
19
17
|
boundaryId: string;
|
|
20
18
|
currentScreenKey: string;
|
|
21
19
|
escapeHostKey?: string;
|
|
22
|
-
localStylesMaps: SharedValue<LocalStyleLayers>;
|
|
23
20
|
portalHostName: SharedValue<string | null>;
|
|
24
21
|
portalHostReady: SharedValue<boolean>;
|
|
25
22
|
slotsMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
26
|
-
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type ActivePortal = {
|
|
26
|
+
pairKey: ScreenPairKey;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const useActivePortalBoundaryHost = ({
|
|
30
30
|
boundaryId,
|
|
31
31
|
currentScreenKey,
|
|
32
32
|
escapeHostKey,
|
|
33
|
-
localStylesMaps,
|
|
34
33
|
portalHostName,
|
|
35
34
|
portalHostReady,
|
|
36
35
|
slotsMap,
|
|
37
|
-
sourcePairKey,
|
|
38
36
|
}: UseActivePortalBoundaryHostParams) => {
|
|
39
|
-
const [
|
|
40
|
-
const
|
|
41
|
-
sourcePairKeyRef.current = sourcePairKey;
|
|
37
|
+
const [activePortal, setActivePortal] = useState<ActivePortal | null>(null);
|
|
38
|
+
const activePairKeyRef = useRef<ScreenPairKey | null>(null);
|
|
42
39
|
|
|
43
|
-
const
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
) => {
|
|
48
|
-
if (sourcePairKeyRef.current !== observedSourcePairKey) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
40
|
+
const updateActivePortal = useCallback((pairKey: ScreenPairKey | null) => {
|
|
41
|
+
if (activePairKeyRef.current === pairKey) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
);
|
|
45
|
+
activePairKeyRef.current = pairKey;
|
|
46
|
+
setActivePortal(pairKey ? { pairKey } : null);
|
|
47
|
+
}, []);
|
|
56
48
|
|
|
57
49
|
useAnimatedReaction(
|
|
58
50
|
() => {
|
|
59
51
|
"worklet";
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
const isBoundaryAnimating = slotsMap.get()[boundaryId] !== undefined;
|
|
53
|
+
if (!isBoundaryAnimating) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return getPairKeyForSource(boundaryId, currentScreenKey);
|
|
65
58
|
},
|
|
66
|
-
(
|
|
59
|
+
(pairKey, previousPairKey) => {
|
|
67
60
|
"worklet";
|
|
68
|
-
if (
|
|
61
|
+
if (pairKey === previousPairKey) {
|
|
69
62
|
return;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
|
-
runOnJS(
|
|
65
|
+
runOnJS(updateActivePortal)(pairKey);
|
|
73
66
|
},
|
|
74
67
|
);
|
|
75
68
|
|
|
76
69
|
useLayoutEffect(() => {
|
|
77
|
-
if (!
|
|
70
|
+
if (!activePortal || !escapeHostKey) {
|
|
78
71
|
portalHostName.set(null);
|
|
79
72
|
portalHostReady.set(false);
|
|
80
73
|
return;
|
|
@@ -83,14 +76,13 @@ export const useActivePortalBoundaryHost = ({
|
|
|
83
76
|
const nextPortalHostName = createBoundaryPortalHostName(
|
|
84
77
|
escapeHostKey,
|
|
85
78
|
boundaryId,
|
|
86
|
-
|
|
79
|
+
activePortal.pairKey,
|
|
87
80
|
);
|
|
88
81
|
|
|
89
82
|
mountPortalBoundaryHost({
|
|
90
83
|
boundaryId,
|
|
91
84
|
hostKey: escapeHostKey,
|
|
92
|
-
|
|
93
|
-
pairKey: sourcePairKey,
|
|
85
|
+
pairKey: activePortal.pairKey,
|
|
94
86
|
portalHostName: nextPortalHostName,
|
|
95
87
|
portalHostReady,
|
|
96
88
|
screenKey: currentScreenKey,
|
|
@@ -104,14 +96,12 @@ export const useActivePortalBoundaryHost = ({
|
|
|
104
96
|
unmountPortalBoundaryHostByName(nextPortalHostName);
|
|
105
97
|
};
|
|
106
98
|
}, [
|
|
99
|
+
activePortal,
|
|
107
100
|
boundaryId,
|
|
108
101
|
currentScreenKey,
|
|
109
102
|
escapeHostKey,
|
|
110
|
-
localStylesMaps,
|
|
111
103
|
portalHostName,
|
|
112
104
|
portalHostReady,
|
|
113
|
-
sourcePairKey,
|
|
114
105
|
slotsMap,
|
|
115
|
-
hasActiveLink,
|
|
116
106
|
]);
|
|
117
107
|
};
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type SharedValue,
|
|
3
|
-
useAnimatedProps,
|
|
4
|
-
useSharedValue,
|
|
5
|
-
} from "react-native-reanimated";
|
|
1
|
+
import { useAnimatedProps, useSharedValue } from "react-native-reanimated";
|
|
6
2
|
import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
|
|
7
3
|
import { useScreenSlots } from "../../../../../../providers/screen/styles";
|
|
8
|
-
import { hasCloseTransitionFinished } from "../../../../../../providers/screen/styles/helpers/transition-visual-state";
|
|
9
|
-
import { AnimationStore } from "../../../../../../stores/animation.store";
|
|
10
|
-
import { pairs } from "../../../../../../stores/bounds/internals/state";
|
|
11
|
-
import { SystemStore } from "../../../../../../stores/system.store";
|
|
12
4
|
import { PORTAL_HOST_NAME_RESET_VALUE } from "../../../utils/naming";
|
|
13
5
|
import { isTeleportEnabled } from "../../../utils/teleport-control";
|
|
14
|
-
import { hasActiveBoundaryPortalLink } from "../helpers/active-pair";
|
|
15
6
|
import { useActiveHostKey } from "../stores/host-registry.store";
|
|
16
7
|
import { useActivePortalBoundaryHost } from "./use-active-portal-boundary-host";
|
|
17
8
|
|
|
@@ -19,42 +10,23 @@ interface UseBoundaryPortalAttachmentParams {
|
|
|
19
10
|
boundaryId: string;
|
|
20
11
|
}
|
|
21
12
|
|
|
22
|
-
type AttachedDestination = {
|
|
23
|
-
animationProgress: SharedValue<number>;
|
|
24
|
-
closing: SharedValue<number>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
13
|
export const useBoundaryPortalAttachment = ({
|
|
28
14
|
boundaryId,
|
|
29
15
|
}: UseBoundaryPortalAttachmentParams) => {
|
|
30
|
-
const sourcePairKey = useDescriptorsStore((s) => s.derivations.sourcePairKey);
|
|
31
16
|
const currentScreenKey = useDescriptorsStore(
|
|
32
17
|
(s) => s.derivations.currentScreenKey,
|
|
33
18
|
);
|
|
34
|
-
const
|
|
35
|
-
const destinationScreenKey = nextScreenKey ?? currentScreenKey;
|
|
36
|
-
const destinationAnimationProgress = SystemStore.getValue(
|
|
37
|
-
destinationScreenKey,
|
|
38
|
-
"animationProgress",
|
|
39
|
-
);
|
|
40
|
-
const destinationClosing = AnimationStore.getValue(
|
|
41
|
-
destinationScreenKey,
|
|
42
|
-
"closing",
|
|
43
|
-
);
|
|
44
|
-
const { localStylesMaps, slotsMap } = useScreenSlots();
|
|
19
|
+
const { slotsMap } = useScreenSlots();
|
|
45
20
|
const portalHostName = useSharedValue<string | null>(null);
|
|
46
21
|
const portalHostReady = useSharedValue(false);
|
|
47
|
-
const attachedDestination = useSharedValue<AttachedDestination | null>(null);
|
|
48
22
|
const escapeHostKey = useActiveHostKey(currentScreenKey);
|
|
49
23
|
|
|
50
24
|
useActivePortalBoundaryHost({
|
|
51
25
|
boundaryId,
|
|
52
26
|
currentScreenKey,
|
|
53
27
|
escapeHostKey,
|
|
54
|
-
localStylesMaps,
|
|
55
28
|
portalHostName,
|
|
56
29
|
portalHostReady,
|
|
57
|
-
sourcePairKey,
|
|
58
30
|
slotsMap,
|
|
59
31
|
});
|
|
60
32
|
|
|
@@ -67,36 +39,17 @@ export const useBoundaryPortalAttachment = ({
|
|
|
67
39
|
teleport,
|
|
68
40
|
...slotProps
|
|
69
41
|
} = slot?.props ?? {};
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const hasAttachableHost =
|
|
78
|
-
shouldTeleport && hasActiveLink && portalHostReady.get() && hostName;
|
|
79
|
-
|
|
80
|
-
if (hasAttachableHost) {
|
|
81
|
-
attachedDestination.set({
|
|
82
|
-
animationProgress: destinationAnimationProgress,
|
|
83
|
-
closing: destinationClosing,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const attached = attachedDestination.get();
|
|
88
|
-
const hasAttachedCloseFinished =
|
|
89
|
-
attached !== null &&
|
|
90
|
-
hasCloseTransitionFinished({
|
|
91
|
-
animationProgress: attached.animationProgress.get(),
|
|
92
|
-
closing: attached.closing.get(),
|
|
93
|
-
});
|
|
94
|
-
const canAttach = hasAttachableHost && !hasAttachedCloseFinished;
|
|
95
|
-
const targetHostName = canAttach ? hostName : PORTAL_HOST_NAME_RESET_VALUE;
|
|
42
|
+
const shouldAttach =
|
|
43
|
+
slot !== undefined &&
|
|
44
|
+
isTeleportEnabled(teleport) &&
|
|
45
|
+
portalHostReady.get();
|
|
46
|
+
const hostName = shouldAttach
|
|
47
|
+
? portalHostName.get()
|
|
48
|
+
: PORTAL_HOST_NAME_RESET_VALUE;
|
|
96
49
|
|
|
97
50
|
return {
|
|
98
51
|
...slotProps,
|
|
99
|
-
hostName
|
|
52
|
+
hostName,
|
|
100
53
|
};
|
|
101
54
|
});
|
|
102
55
|
|
|
@@ -16,7 +16,6 @@ import { getVisibilityBlockOffset } from "../../../../../../utils/visibility-blo
|
|
|
16
16
|
import {
|
|
17
17
|
adjustedMeasuredBoundsForOverscrollDeltas,
|
|
18
18
|
correctMeasuredBoundsForVisibilityGate,
|
|
19
|
-
isMeasurementInViewport,
|
|
20
19
|
} from "../../../../utils/measured-bounds";
|
|
21
20
|
import {
|
|
22
21
|
clearPortalHostBounds,
|
|
@@ -102,13 +101,7 @@ export const useHostMeasurement = ({
|
|
|
102
101
|
viewportHeight,
|
|
103
102
|
});
|
|
104
103
|
|
|
105
|
-
if (
|
|
106
|
-
!isMeasurementInViewport(
|
|
107
|
-
correctedMeasured,
|
|
108
|
-
viewportWidth,
|
|
109
|
-
viewportHeight,
|
|
110
|
-
)
|
|
111
|
-
) {
|
|
104
|
+
if (correctedMeasured.width <= 0 || correctedMeasured.height <= 0) {
|
|
112
105
|
cancelAnimation(retryToken);
|
|
113
106
|
retryToken.set(
|
|
114
107
|
withDelay(
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
2
|
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
-
import type { LocalStyleLayers } from "../../../../../../providers/screen/styles/helpers/resolve-slot-styles";
|
|
4
3
|
import type { NormalizedTransitionInterpolatedStyle } from "../../../../../../types/animation.types";
|
|
5
4
|
|
|
6
5
|
export type ActivePortalBoundaryHost = {
|
|
7
6
|
boundaryId: string;
|
|
8
7
|
hostKey: string;
|
|
9
|
-
localStylesMaps: SharedValue<LocalStyleLayers>;
|
|
10
8
|
pairKey: string;
|
|
11
9
|
portalHostName: string;
|
|
12
10
|
portalHostReady: SharedValue<boolean>;
|
|
@@ -56,7 +54,6 @@ const isSameHost = (
|
|
|
56
54
|
return (
|
|
57
55
|
a.boundaryId === b.boundaryId &&
|
|
58
56
|
a.hostKey === b.hostKey &&
|
|
59
|
-
a.localStylesMaps === b.localStylesMaps &&
|
|
60
57
|
a.pairKey === b.pairKey &&
|
|
61
58
|
a.portalHostName === b.portalHostName &&
|
|
62
59
|
a.portalHostReady === b.portalHostReady &&
|
|
@@ -14,14 +14,13 @@ export type InitialDestinationMeasurementAction =
|
|
|
14
14
|
| "complete";
|
|
15
15
|
|
|
16
16
|
export type InitialDestinationMeasurementSignal = {
|
|
17
|
-
pairKey: ScreenPairKey;
|
|
17
|
+
pairKey: ScreenPairKey | null;
|
|
18
18
|
action: InitialDestinationMeasurementAction;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const getInitialDestinationMeasurementSignal = (params: {
|
|
22
22
|
enabled: boolean;
|
|
23
|
-
|
|
24
|
-
ancestorDestinationPairKey?: ScreenPairKey;
|
|
23
|
+
pairKey?: ScreenPairKey;
|
|
25
24
|
linkId: string;
|
|
26
25
|
group?: string;
|
|
27
26
|
destinationPresent: boolean;
|
|
@@ -31,20 +30,21 @@ export const getInitialDestinationMeasurementSignal = (params: {
|
|
|
31
30
|
"worklet";
|
|
32
31
|
const {
|
|
33
32
|
enabled,
|
|
34
|
-
|
|
35
|
-
ancestorDestinationPairKey,
|
|
33
|
+
pairKey,
|
|
36
34
|
linkId,
|
|
37
35
|
group,
|
|
38
36
|
destinationPresent,
|
|
39
37
|
sourcePresent,
|
|
40
38
|
linkState,
|
|
41
39
|
} = params;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!enabled || !pairKey) {
|
|
40
|
+
if (!enabled) {
|
|
45
41
|
return null;
|
|
46
42
|
}
|
|
47
43
|
|
|
44
|
+
if (!pairKey) {
|
|
45
|
+
return { pairKey: null, action: "wait" };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
48
|
if (!destinationPresent) {
|
|
49
49
|
return { pairKey, action: "wait" };
|
|
50
50
|
}
|
|
@@ -31,8 +31,6 @@ export const getRefreshBoundarySignal = (params: {
|
|
|
31
31
|
currentScreenKey: string;
|
|
32
32
|
sourcePairKey?: ScreenPairKey;
|
|
33
33
|
destinationPairKey?: ScreenPairKey;
|
|
34
|
-
ancestorDestinationPairKey?: ScreenPairKey;
|
|
35
|
-
nextScreenKey?: string;
|
|
36
34
|
linkId: string;
|
|
37
35
|
group?: string;
|
|
38
36
|
shouldRefresh: boolean;
|
|
@@ -45,8 +43,6 @@ export const getRefreshBoundarySignal = (params: {
|
|
|
45
43
|
currentScreenKey,
|
|
46
44
|
sourcePairKey,
|
|
47
45
|
destinationPairKey,
|
|
48
|
-
ancestorDestinationPairKey,
|
|
49
|
-
nextScreenKey,
|
|
50
46
|
linkId,
|
|
51
47
|
group,
|
|
52
48
|
shouldRefresh,
|
|
@@ -79,9 +75,7 @@ export const getRefreshBoundarySignal = (params: {
|
|
|
79
75
|
);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
const refreshDestinationPairKey =
|
|
83
|
-
destinationPairKey ??
|
|
84
|
-
(nextScreenKey ? undefined : ancestorDestinationPairKey);
|
|
78
|
+
const refreshDestinationPairKey = destinationPairKey;
|
|
85
79
|
|
|
86
80
|
if (!refreshDestinationPairKey) {
|
|
87
81
|
return null;
|
|
@@ -114,9 +108,7 @@ export const getRefreshBoundarySignal = (params: {
|
|
|
114
108
|
);
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
const refreshDestinationPairKey =
|
|
118
|
-
destinationPairKey ??
|
|
119
|
-
(nextScreenKey ? undefined : ancestorDestinationPairKey);
|
|
111
|
+
const refreshDestinationPairKey = destinationPairKey;
|
|
120
112
|
|
|
121
113
|
if (!refreshDestinationPairKey) return null;
|
|
122
114
|
|
|
@@ -6,7 +6,7 @@ import type { BaseStackDescriptor } from "../../../types/stack.types";
|
|
|
6
6
|
import createProvider from "../../../utils/create-provider";
|
|
7
7
|
import type { DescriptorDerivations } from "./helpers/derive-descriptor-derivations";
|
|
8
8
|
import { deriveDescriptorDerivations } from "./helpers/derive-descriptor-derivations";
|
|
9
|
-
import {
|
|
9
|
+
import { getAncestorKeys } from "./helpers/get-ancestor-keys";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Base descriptor interface - minimal contract for all stack types.
|
|
@@ -84,8 +84,8 @@ export const { DescriptorsProvider, useDescriptorsStore } = createProvider(
|
|
|
84
84
|
[resolvedPrevious, resolvedCurrent, resolvedNext],
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
const
|
|
88
|
-
() =>
|
|
87
|
+
const ancestorKeys = useMemo(
|
|
88
|
+
() => getAncestorKeys(resolvedCurrent),
|
|
89
89
|
[resolvedCurrent],
|
|
90
90
|
);
|
|
91
91
|
|
|
@@ -96,15 +96,8 @@ export const { DescriptorsProvider, useDescriptorsStore } = createProvider(
|
|
|
96
96
|
current: resolvedCurrent,
|
|
97
97
|
next: resolvedNext,
|
|
98
98
|
ancestorKeys,
|
|
99
|
-
ancestorDestinationPairKey,
|
|
100
99
|
}),
|
|
101
|
-
[
|
|
102
|
-
resolvedPrevious,
|
|
103
|
-
resolvedCurrent,
|
|
104
|
-
resolvedNext,
|
|
105
|
-
ancestorKeys,
|
|
106
|
-
ancestorDestinationPairKey,
|
|
107
|
-
],
|
|
100
|
+
[resolvedPrevious, resolvedCurrent, resolvedNext, ancestorKeys],
|
|
108
101
|
);
|
|
109
102
|
|
|
110
103
|
return {
|
|
@@ -8,7 +8,6 @@ export interface DescriptorDerivations {
|
|
|
8
8
|
nextScreenKey?: string;
|
|
9
9
|
sourcePairKey?: ScreenPairKey;
|
|
10
10
|
destinationPairKey?: ScreenPairKey;
|
|
11
|
-
ancestorDestinationPairKey?: ScreenPairKey;
|
|
12
11
|
parentScreenKey?: string;
|
|
13
12
|
isFirstKey: boolean;
|
|
14
13
|
isTopMostScreen: boolean;
|
|
@@ -21,7 +20,6 @@ interface Params {
|
|
|
21
20
|
current: BaseStackDescriptor;
|
|
22
21
|
next?: BaseStackDescriptor;
|
|
23
22
|
ancestorKeys: string[];
|
|
24
|
-
ancestorDestinationPairKey?: ScreenPairKey;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export function deriveDescriptorDerivations({
|
|
@@ -29,7 +27,6 @@ export function deriveDescriptorDerivations({
|
|
|
29
27
|
current,
|
|
30
28
|
next,
|
|
31
29
|
ancestorKeys,
|
|
32
|
-
ancestorDestinationPairKey,
|
|
33
30
|
}: Params): DescriptorDerivations {
|
|
34
31
|
const previousScreenKey = previous?.route.key;
|
|
35
32
|
const currentScreenKey = current.route.key;
|
|
@@ -56,7 +53,6 @@ export function deriveDescriptorDerivations({
|
|
|
56
53
|
nextScreenKey,
|
|
57
54
|
sourcePairKey,
|
|
58
55
|
destinationPairKey,
|
|
59
|
-
ancestorDestinationPairKey,
|
|
60
56
|
parentScreenKey: ancestorKeys[0],
|
|
61
57
|
isFirstKey,
|
|
62
58
|
isTopMostScreen,
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import { createScreenPairKey } from "../../../../stores/bounds/helpers/link-pairs.helpers";
|
|
2
|
-
import type { ScreenPairKey } from "../../../../stores/bounds/types";
|
|
3
1
|
import type { BaseStackDescriptor } from "../../../../types/stack.types";
|
|
4
2
|
|
|
5
|
-
export interface AncestorKeyState {
|
|
6
|
-
ancestorKeys: string[];
|
|
7
|
-
ancestorDestinationPairKey?: ScreenPairKey;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
3
|
/**
|
|
11
4
|
* Builds nested navigator ancestor keys from immediate parent to root.
|
|
12
|
-
* The nearest ancestor destination pair lets child routes attach measurements
|
|
13
|
-
* to the transition owned by the parent stack.
|
|
14
5
|
*/
|
|
15
|
-
export function
|
|
16
|
-
current: BaseStackDescriptor,
|
|
17
|
-
): AncestorKeyState {
|
|
6
|
+
export function getAncestorKeys(current: BaseStackDescriptor): string[] {
|
|
18
7
|
const ancestors: string[] = [];
|
|
19
|
-
let ancestorDestinationPairKey: ScreenPairKey | undefined;
|
|
20
8
|
const nav = current.navigation as any;
|
|
21
9
|
|
|
22
10
|
if (typeof nav?.getParent !== "function") {
|
|
23
|
-
return
|
|
11
|
+
return ancestors;
|
|
24
12
|
}
|
|
25
13
|
|
|
26
14
|
let parent = nav.getParent();
|
|
@@ -31,25 +19,10 @@ export function getAncestorKeyState(
|
|
|
31
19
|
const focusedRoute = state.routes[state.index];
|
|
32
20
|
if (focusedRoute?.key) {
|
|
33
21
|
ancestors.push(focusedRoute.key);
|
|
34
|
-
|
|
35
|
-
const previousRoute = state.routes[state.index - 1];
|
|
36
|
-
if (!ancestorDestinationPairKey && previousRoute?.key) {
|
|
37
|
-
ancestorDestinationPairKey = createScreenPairKey(
|
|
38
|
-
previousRoute.key,
|
|
39
|
-
focusedRoute.key,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
22
|
}
|
|
43
23
|
}
|
|
44
24
|
parent = parent.getParent();
|
|
45
25
|
}
|
|
46
26
|
|
|
47
|
-
return
|
|
48
|
-
ancestorKeys: ancestors,
|
|
49
|
-
ancestorDestinationPairKey,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function getAncestorKeys(current: BaseStackDescriptor): string[] {
|
|
54
|
-
return getAncestorKeyState(current).ancestorKeys;
|
|
27
|
+
return ancestors;
|
|
55
28
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ScreenInterpolationProps,
|
|
3
|
+
ScreenTransitionAccessor,
|
|
4
|
+
} from "../../../../types/animation.types";
|
|
5
|
+
import { createBoundsAccessor } from "../../../../utils/bounds";
|
|
6
|
+
import type { ScreenInterpolatorFrame } from "../../animation/helpers/pipeline";
|
|
7
|
+
import type { SelectedInterpolatorFrame } from "./select-interpolator-frame";
|
|
8
|
+
|
|
9
|
+
export const createInterpolatorScope = ({
|
|
10
|
+
frame,
|
|
11
|
+
selectedFrame,
|
|
12
|
+
transition,
|
|
13
|
+
}: {
|
|
14
|
+
frame: ScreenInterpolatorFrame;
|
|
15
|
+
selectedFrame: SelectedInterpolatorFrame;
|
|
16
|
+
transition: ScreenTransitionAccessor;
|
|
17
|
+
}): ScreenInterpolationProps => {
|
|
18
|
+
"worklet";
|
|
19
|
+
|
|
20
|
+
const selectedProps = {
|
|
21
|
+
...frame,
|
|
22
|
+
...selectedFrame,
|
|
23
|
+
};
|
|
24
|
+
let scope: ScreenInterpolationProps;
|
|
25
|
+
const scopedTransition: ScreenTransitionAccessor = (target) => {
|
|
26
|
+
"worklet";
|
|
27
|
+
|
|
28
|
+
if ((target?.depth ?? 0) === 0) {
|
|
29
|
+
return scope;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return transition(target);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
scope = {
|
|
36
|
+
...selectedProps,
|
|
37
|
+
bounds: createBoundsAccessor(() => {
|
|
38
|
+
"worklet";
|
|
39
|
+
return selectedProps;
|
|
40
|
+
}),
|
|
41
|
+
transition: scopedTransition,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return scope;
|
|
45
|
+
};
|
|
@@ -81,18 +81,18 @@ const mergeSlots = (
|
|
|
81
81
|
return merged;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const composeCurrentAndNextStyles = (
|
|
85
|
+
current: NormalizedTransitionInterpolatedStyle,
|
|
86
|
+
next: NormalizedTransitionInterpolatedStyle,
|
|
87
87
|
) => {
|
|
88
88
|
"worklet";
|
|
89
|
-
const composed: NormalizedTransitionInterpolatedStyle = { ...
|
|
89
|
+
const composed: NormalizedTransitionInterpolatedStyle = { ...current };
|
|
90
90
|
|
|
91
|
-
for (const slotId in
|
|
92
|
-
const
|
|
91
|
+
for (const slotId in next) {
|
|
92
|
+
const nextSlot = next[slotId];
|
|
93
93
|
|
|
94
|
-
if (
|
|
95
|
-
composed[slotId] = mergeSlots(
|
|
94
|
+
if (nextSlot) {
|
|
95
|
+
composed[slotId] = mergeSlots(current[slotId], nextSlot);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -103,36 +103,36 @@ export const resolveInterpolatorStyleHandoff = ({
|
|
|
103
103
|
currentOwnsInterpolator,
|
|
104
104
|
currentStylesMap,
|
|
105
105
|
nextStylesMap,
|
|
106
|
-
frozenCurrentStylesMap,
|
|
107
106
|
}: {
|
|
108
107
|
currentOwnsInterpolator: boolean;
|
|
109
108
|
currentStylesMap: NormalizedTransitionInterpolatedStyle | undefined;
|
|
110
109
|
nextStylesMap: NormalizedTransitionInterpolatedStyle | undefined;
|
|
111
|
-
frozenCurrentStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
112
110
|
}): {
|
|
113
111
|
localStylesMaps: LocalStyleLayers;
|
|
114
|
-
nextFrozenCurrentStylesMap: NormalizedTransitionInterpolatedStyle;
|
|
115
112
|
} => {
|
|
116
113
|
"worklet";
|
|
117
114
|
|
|
118
115
|
if (currentOwnsInterpolator) {
|
|
119
116
|
return {
|
|
120
117
|
localStylesMaps: currentStylesMap ? [currentStylesMap] : [],
|
|
121
|
-
nextFrozenCurrentStylesMap: currentStylesMap ?? frozenCurrentStylesMap,
|
|
122
118
|
};
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
if (!nextStylesMap) {
|
|
126
122
|
return {
|
|
127
|
-
localStylesMaps:
|
|
128
|
-
|
|
123
|
+
localStylesMaps: currentStylesMap ? [currentStylesMap] : [],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!currentStylesMap) {
|
|
128
|
+
return {
|
|
129
|
+
localStylesMaps: [nextStylesMap],
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
return {
|
|
133
134
|
localStylesMaps: [
|
|
134
|
-
|
|
135
|
+
composeCurrentAndNextStyles(currentStylesMap, nextStylesMap),
|
|
135
136
|
],
|
|
136
|
-
nextFrozenCurrentStylesMap: frozenCurrentStylesMap,
|
|
137
137
|
};
|
|
138
138
|
};
|