react-native-screen-transitions 3.5.0 → 3.5.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.
Files changed (146) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +2 -2
  2. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +3 -3
  4. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-presence.js +3 -3
  6. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.js +7 -6
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-capture-source-boundary.js +2 -2
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-capture-source-boundary.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js +8 -8
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-refresh-boundary.js +6 -5
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +1 -1
  15. package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +2 -4
  16. package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -1
  17. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +3 -3
  18. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  19. package/lib/commonjs/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.js +4 -4
  20. package/lib/commonjs/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.js.map +1 -1
  21. package/lib/commonjs/shared/providers/register-bounds.provider.js +8 -8
  22. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  23. package/lib/commonjs/shared/providers/screen/styles/components/maybe-floating-container.js +1 -2
  24. package/lib/commonjs/shared/providers/screen/styles/components/maybe-floating-container.js.map +1 -1
  25. package/lib/commonjs/shared/stores/bounds/helpers/apply-measured-bounds-writes.js +6 -6
  26. package/lib/commonjs/shared/stores/bounds/helpers/apply-measured-bounds-writes.js.map +1 -1
  27. package/lib/commonjs/shared/stores/bounds/index.js +85 -1
  28. package/lib/commonjs/shared/stores/bounds/index.js.map +1 -1
  29. package/lib/commonjs/shared/stores/bounds/internals/registry.js +7 -0
  30. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  31. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +3 -1
  32. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  33. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js +3 -3
  34. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -1
  35. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js +3 -3
  36. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  37. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +5 -4
  38. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  39. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js +2 -2
  40. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
  41. package/lib/commonjs/shared/utils/bounds/zoom/build.js +4 -3
  42. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  43. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +2 -2
  44. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  45. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +3 -3
  46. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  47. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-presence.js +3 -3
  48. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-presence.js.map +1 -1
  49. package/lib/module/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.js +7 -6
  50. package/lib/module/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.js.map +1 -1
  51. package/lib/module/shared/components/create-boundary-component/hooks/use-capture-source-boundary.js +2 -2
  52. package/lib/module/shared/components/create-boundary-component/hooks/use-capture-source-boundary.js.map +1 -1
  53. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js +8 -8
  54. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  55. package/lib/module/shared/components/create-boundary-component/hooks/use-refresh-boundary.js +6 -5
  56. package/lib/module/shared/components/create-boundary-component/hooks/use-refresh-boundary.js.map +1 -1
  57. package/lib/module/shared/components/overlay/variations/overlay-host.js +2 -4
  58. package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -1
  59. package/lib/module/shared/components/screen-container/layers/backdrop.js +3 -3
  60. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  61. package/lib/module/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.js +4 -4
  62. package/lib/module/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.js.map +1 -1
  63. package/lib/module/shared/providers/register-bounds.provider.js +8 -8
  64. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  65. package/lib/module/shared/providers/screen/styles/components/maybe-floating-container.js +1 -2
  66. package/lib/module/shared/providers/screen/styles/components/maybe-floating-container.js.map +1 -1
  67. package/lib/module/shared/stores/bounds/helpers/apply-measured-bounds-writes.js +6 -6
  68. package/lib/module/shared/stores/bounds/helpers/apply-measured-bounds-writes.js.map +1 -1
  69. package/lib/module/shared/stores/bounds/index.js +85 -1
  70. package/lib/module/shared/stores/bounds/index.js.map +1 -1
  71. package/lib/module/shared/stores/bounds/internals/registry.js +7 -0
  72. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  73. package/lib/module/shared/stores/bounds/internals/resolver.js +3 -1
  74. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  75. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js +3 -3
  76. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -1
  77. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js +3 -3
  78. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -1
  79. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +5 -4
  80. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -1
  81. package/lib/module/shared/utils/bounds/helpers/styles/compute.js +2 -2
  82. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -1
  83. package/lib/module/shared/utils/bounds/zoom/build.js +4 -3
  84. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  85. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts +207 -4
  86. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
  87. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  88. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-presence.d.ts.map +1 -1
  89. package/lib/typescript/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.d.ts.map +1 -1
  90. package/lib/typescript/shared/components/create-boundary-component/hooks/use-capture-source-boundary.d.ts.map +1 -1
  91. package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts.map +1 -1
  92. package/lib/typescript/shared/components/create-boundary-component/hooks/use-refresh-boundary.d.ts.map +1 -1
  93. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +207 -3
  94. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  95. package/lib/typescript/shared/components/create-transition-aware-component.d.ts +6 -5
  96. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  97. package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +1 -1
  98. package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
  99. package/lib/typescript/shared/components/scene-view.d.ts +1 -1
  100. package/lib/typescript/shared/components/scene-view.d.ts.map +1 -1
  101. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts +2 -2
  102. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  103. package/lib/typescript/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.d.ts.map +1 -1
  104. package/lib/typescript/shared/index.d.ts +911 -649
  105. package/lib/typescript/shared/index.d.ts.map +1 -1
  106. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  107. package/lib/typescript/shared/providers/screen/styles/components/maybe-floating-container.d.ts +1 -1
  108. package/lib/typescript/shared/providers/screen/styles/components/maybe-floating-container.d.ts.map +1 -1
  109. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +2 -2
  110. package/lib/typescript/shared/stores/bounds/index.d.ts +25 -0
  111. package/lib/typescript/shared/stores/bounds/index.d.ts.map +1 -1
  112. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  113. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  114. package/lib/typescript/shared/stores/bounds/types.d.ts +3 -0
  115. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  116. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -1
  117. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts +1 -1
  118. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -1
  119. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +1 -1
  120. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -1
  121. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts +1 -1
  122. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -1
  123. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  124. package/package.json +2 -37
  125. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +2 -2
  126. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +7 -4
  127. package/src/shared/components/create-boundary-component/hooks/use-boundary-presence.ts +6 -3
  128. package/src/shared/components/create-boundary-component/hooks/use-capture-destination-boundary.ts +12 -7
  129. package/src/shared/components/create-boundary-component/hooks/use-capture-source-boundary.ts +2 -4
  130. package/src/shared/components/create-boundary-component/hooks/use-measurer.ts +14 -12
  131. package/src/shared/components/create-boundary-component/hooks/use-refresh-boundary.ts +6 -12
  132. package/src/shared/components/overlay/variations/overlay-host.tsx +5 -4
  133. package/src/shared/components/screen-container/layers/backdrop.tsx +3 -5
  134. package/src/shared/components/screen-lifecycle/hooks/helpers/reset-stores-for-screen.ts +8 -4
  135. package/src/shared/providers/register-bounds.provider.tsx +13 -16
  136. package/src/shared/providers/screen/styles/components/maybe-floating-container.tsx +4 -2
  137. package/src/shared/stores/bounds/helpers/apply-measured-bounds-writes.ts +6 -6
  138. package/src/shared/stores/bounds/index.ts +182 -0
  139. package/src/shared/stores/bounds/internals/registry.ts +8 -0
  140. package/src/shared/stores/bounds/internals/resolver.ts +2 -0
  141. package/src/shared/stores/bounds/types.ts +3 -0
  142. package/src/shared/utils/bounds/helpers/create-interpolators.ts +3 -6
  143. package/src/shared/utils/bounds/helpers/create-link-accessor.ts +7 -6
  144. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +8 -8
  145. package/src/shared/utils/bounds/helpers/styles/compute.ts +3 -5
  146. package/src/shared/utils/bounds/zoom/build.ts +5 -6
@@ -14,8 +14,13 @@ import type { SharedValue } from "react-native-reanimated/lib/typescript/commonT
14
14
  import useStableCallback from "../hooks/use-stable-callback";
15
15
  import useStableCallbackValue from "../hooks/use-stable-callback-value";
16
16
  import { AnimationStore } from "../stores/animation.store";
17
- import { BoundStore } from "../stores/bounds";
18
17
  import { applyMeasuredBoundsWrites } from "../stores/bounds/helpers/apply-measured-bounds-writes";
18
+ import {
19
+ getMeasuredEntry,
20
+ getPendingLink,
21
+ hasDestinationLink,
22
+ hasSourceLink,
23
+ } from "../stores/bounds/internals/registry";
19
24
  import { prepareStyleForBounds } from "../utils/bounds/helpers/styles/styles";
20
25
  import createProvider from "../utils/create-provider";
21
26
  import { useDescriptorDerivations, useDescriptors } from "./screen/descriptors";
@@ -276,10 +281,7 @@ const registerBoundsBundle = createProvider("RegisterBounds", {
276
281
  }
277
282
 
278
283
  if (shouldSetSource && isAnimating.get()) {
279
- const existing = BoundStore.entry.getMeasured(
280
- sharedBoundTag,
281
- currentScreenKey,
282
- );
284
+ const existing = getMeasuredEntry(sharedBoundTag, currentScreenKey);
283
285
  if (existing) {
284
286
  applyMeasuredBoundsWrites({
285
287
  sharedBoundTag,
@@ -297,13 +299,9 @@ const registerBoundsBundle = createProvider("RegisterBounds", {
297
299
  return;
298
300
  }
299
301
 
300
- const hasPendingLink =
301
- BoundStore.link.getPending(sharedBoundTag) !== null;
302
- const hasSourceLink = BoundStore.link.hasSource(
303
- sharedBoundTag,
304
- currentScreenKey,
305
- );
306
- const hasDestinationLink = BoundStore.link.hasDestination(
302
+ const hasPending = getPendingLink(sharedBoundTag) !== null;
303
+ const hasSource = hasSourceLink(sharedBoundTag, currentScreenKey);
304
+ const hasDestination = hasDestinationLink(
307
305
  sharedBoundTag,
308
306
  currentScreenKey,
309
307
  );
@@ -315,11 +313,10 @@ const registerBoundsBundle = createProvider("RegisterBounds", {
315
313
  !wantsSetSource && !wantsSetDestination && !wantsUpdateSource;
316
314
 
317
315
  const canSetSource = wantsSetSource;
318
- const canSetDestination = wantsSetDestination && hasPendingLink;
319
- const canUpdateSource = wantsUpdateSource && hasSourceLink;
316
+ const canSetDestination = wantsSetDestination && hasPending;
317
+ const canUpdateSource = wantsUpdateSource && hasSource;
320
318
  const canSnapshotOnly =
321
- wantsSnapshotOnly &&
322
- (hasPendingLink || hasSourceLink || hasDestinationLink);
319
+ wantsSnapshotOnly && (hasPending || hasSource || hasDestination);
323
320
 
324
321
  if (
325
322
  !canSetSource &&
@@ -15,7 +15,10 @@ export const MaybeFloatingContainer = memo(function MaybeFloatingContainer({
15
15
  }
16
16
 
17
17
  return (
18
- <View style={styles.float} pointerEvents="box-none">
18
+ <View
19
+ style={[StyleSheet.absoluteFill, styles.float]}
20
+ pointerEvents="box-none"
21
+ >
19
22
  {children}
20
23
  </View>
21
24
  );
@@ -23,7 +26,6 @@ export const MaybeFloatingContainer = memo(function MaybeFloatingContainer({
23
26
 
24
27
  const styles = StyleSheet.create({
25
28
  float: {
26
- ...StyleSheet.absoluteFill,
27
29
  zIndex: 999,
28
30
  },
29
31
  });
@@ -1,5 +1,5 @@
1
1
  import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
- import { BoundStore } from "..";
2
+ import { setDestination, setEntry, setSource } from "../internals/registry";
3
3
 
4
4
  type ApplyMeasuredBoundsWritesParams = {
5
5
  sharedBoundTag: string;
@@ -38,7 +38,7 @@ export const applyMeasuredBoundsWrites = (
38
38
  } = params;
39
39
 
40
40
  if (shouldWriteEntry) {
41
- BoundStore.entry.set(sharedBoundTag, currentScreenKey, {
41
+ setEntry(sharedBoundTag, currentScreenKey, {
42
42
  bounds: measured,
43
43
  styles: preparedStyles,
44
44
  ancestorKeys,
@@ -48,7 +48,7 @@ export const applyMeasuredBoundsWrites = (
48
48
  }
49
49
 
50
50
  if (shouldSetSource) {
51
- BoundStore.link.setSource(
51
+ setSource(
52
52
  "capture",
53
53
  sharedBoundTag,
54
54
  currentScreenKey,
@@ -61,7 +61,7 @@ export const applyMeasuredBoundsWrites = (
61
61
  }
62
62
 
63
63
  if (shouldUpdateSource) {
64
- BoundStore.link.setSource(
64
+ setSource(
65
65
  "refresh",
66
66
  sharedBoundTag,
67
67
  currentScreenKey,
@@ -74,7 +74,7 @@ export const applyMeasuredBoundsWrites = (
74
74
  }
75
75
 
76
76
  if (shouldUpdateDestination) {
77
- BoundStore.link.setDestination(
77
+ setDestination(
78
78
  "refresh",
79
79
  sharedBoundTag,
80
80
  currentScreenKey,
@@ -88,7 +88,7 @@ export const applyMeasuredBoundsWrites = (
88
88
  }
89
89
 
90
90
  if (shouldSetDestination) {
91
- BoundStore.link.setDestination(
91
+ setDestination(
92
92
  "attach",
93
93
  sharedBoundTag,
94
94
  currentScreenKey,
@@ -1,3 +1,4 @@
1
+ import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
1
2
  import { clear, clearByAncestor, clearByBranch } from "./internals/clear";
2
3
  import { getGroupActiveId, setGroupActiveId } from "./internals/groups";
3
4
  import {
@@ -14,6 +15,13 @@ import {
14
15
  setSource,
15
16
  } from "./internals/registry";
16
17
  import { resolveTransitionPair } from "./internals/resolver";
18
+ import type {
19
+ BoundaryConfig,
20
+ MeasuredEntry,
21
+ NavigatorKey,
22
+ ScreenKey,
23
+ TagID,
24
+ } from "./types";
17
25
 
18
26
  export type {
19
27
  BoundaryConfig,
@@ -24,6 +32,154 @@ export type {
24
32
  ResolveTransitionContext,
25
33
  } from "./types";
26
34
 
35
+ export type Snapshot = MeasuredEntry;
36
+
37
+ const registerSnapshot = (
38
+ tag: TagID,
39
+ screenKey: ScreenKey,
40
+ bounds: MeasuredDimensions,
41
+ styles: StyleProps = {},
42
+ ancestorKeys?: ScreenKey[],
43
+ navigatorKey?: NavigatorKey,
44
+ ancestorNavigatorKeys?: NavigatorKey[],
45
+ ) => {
46
+ "worklet";
47
+ setEntry(tag, screenKey, {
48
+ bounds,
49
+ styles,
50
+ ancestorKeys,
51
+ navigatorKey,
52
+ ancestorNavigatorKeys,
53
+ });
54
+ };
55
+
56
+ const registerBoundaryPresence = (
57
+ tag: TagID,
58
+ screenKey: ScreenKey,
59
+ ancestorKeys?: ScreenKey[],
60
+ boundaryConfig?: BoundaryConfig,
61
+ navigatorKey?: NavigatorKey,
62
+ ancestorNavigatorKeys?: NavigatorKey[],
63
+ ) => {
64
+ "worklet";
65
+ const currentPresenceCount = getEntry(tag, screenKey)?.presenceCount ?? 0;
66
+ setEntry(tag, screenKey, {
67
+ ancestorKeys,
68
+ boundaryConfig,
69
+ navigatorKey,
70
+ ancestorNavigatorKeys,
71
+ presenceCount: currentPresenceCount + 1,
72
+ });
73
+ };
74
+
75
+ const unregisterBoundaryPresence = (tag: TagID, screenKey: ScreenKey) => {
76
+ "worklet";
77
+ const currentPresenceCount = getEntry(tag, screenKey)?.presenceCount ?? 0;
78
+ if (currentPresenceCount > 1) {
79
+ setEntry(tag, screenKey, { presenceCount: currentPresenceCount - 1 });
80
+ return;
81
+ }
82
+
83
+ removeEntry(tag, screenKey);
84
+ };
85
+
86
+ const getLatestPendingSourceScreenKey = (tag: TagID): ScreenKey | null => {
87
+ "worklet";
88
+ return getPendingLink(tag)?.source.screenKey ?? null;
89
+ };
90
+
91
+ const setLinkSource = (
92
+ tag: TagID,
93
+ screenKey: ScreenKey,
94
+ bounds: MeasuredDimensions,
95
+ styles?: StyleProps,
96
+ ancestorKeys?: ScreenKey[],
97
+ navigatorKey?: NavigatorKey,
98
+ ancestorNavigatorKeys?: NavigatorKey[],
99
+ ) => {
100
+ "worklet";
101
+ setSource(
102
+ "capture",
103
+ tag,
104
+ screenKey,
105
+ bounds,
106
+ styles,
107
+ ancestorKeys,
108
+ navigatorKey,
109
+ ancestorNavigatorKeys,
110
+ );
111
+ };
112
+
113
+ const updateLinkSource = (
114
+ tag: TagID,
115
+ screenKey: ScreenKey,
116
+ bounds: MeasuredDimensions,
117
+ styles?: StyleProps,
118
+ ancestorKeys?: ScreenKey[],
119
+ navigatorKey?: NavigatorKey,
120
+ ancestorNavigatorKeys?: NavigatorKey[],
121
+ ) => {
122
+ "worklet";
123
+ setSource(
124
+ "refresh",
125
+ tag,
126
+ screenKey,
127
+ bounds,
128
+ styles,
129
+ ancestorKeys,
130
+ navigatorKey,
131
+ ancestorNavigatorKeys,
132
+ );
133
+ };
134
+
135
+ const setLinkDestination = (
136
+ tag: TagID,
137
+ screenKey: ScreenKey,
138
+ bounds: MeasuredDimensions,
139
+ styles?: StyleProps,
140
+ ancestorKeys?: ScreenKey[],
141
+ expectedSourceScreenKey?: ScreenKey,
142
+ navigatorKey?: NavigatorKey,
143
+ ancestorNavigatorKeys?: NavigatorKey[],
144
+ ) => {
145
+ "worklet";
146
+ setDestination(
147
+ "attach",
148
+ tag,
149
+ screenKey,
150
+ bounds,
151
+ styles,
152
+ ancestorKeys,
153
+ expectedSourceScreenKey,
154
+ navigatorKey,
155
+ ancestorNavigatorKeys,
156
+ );
157
+ };
158
+
159
+ const updateLinkDestination = (
160
+ tag: TagID,
161
+ screenKey: ScreenKey,
162
+ bounds: MeasuredDimensions,
163
+ styles?: StyleProps,
164
+ ancestorKeys?: ScreenKey[],
165
+ expectedSourceScreenKey?: ScreenKey,
166
+ navigatorKey?: NavigatorKey,
167
+ ancestorNavigatorKeys?: NavigatorKey[],
168
+ ) => {
169
+ "worklet";
170
+ setDestination(
171
+ "refresh",
172
+ tag,
173
+ screenKey,
174
+ bounds,
175
+ styles,
176
+ ancestorKeys,
177
+ expectedSourceScreenKey,
178
+ navigatorKey,
179
+ ancestorNavigatorKeys,
180
+ );
181
+ };
182
+
27
183
  export const BoundStore = {
28
184
  entry: {
29
185
  set: setEntry,
@@ -50,4 +206,30 @@ export const BoundStore = {
50
206
  byAncestor: clearByAncestor,
51
207
  byBranch: clearByBranch,
52
208
  },
209
+ // Legacy flat aliases used by the v3 tests and older internals. New code should
210
+ // prefer the explicit entry/link/group/cleanup namespaces above.
211
+ registerSnapshot,
212
+ getSnapshot: getMeasuredEntry,
213
+ setLinkSource,
214
+ updateLinkSource,
215
+ setLinkDestination,
216
+ updateLinkDestination,
217
+ getActiveLink,
218
+ resolveTransitionPair,
219
+ hasPendingLink: (tag: TagID) => getPendingLink(tag) !== null,
220
+ hasPendingLinkFromSource: (tag: TagID, sourceScreenKey: ScreenKey) =>
221
+ getPendingLink(tag, sourceScreenKey) !== null,
222
+ getLatestPendingSourceScreenKey,
223
+ hasSourceLink,
224
+ hasDestinationLink,
225
+ registerBoundaryPresence,
226
+ unregisterBoundaryPresence,
227
+ hasBoundaryPresence: (tag: TagID, screenKey: ScreenKey) =>
228
+ (getEntry(tag, screenKey)?.presenceCount ?? 0) > 0,
229
+ getBoundaryConfig: getEntryConfig,
230
+ setGroupActiveId,
231
+ getGroupActiveId,
232
+ clear,
233
+ clearByAncestor,
234
+ clearByBranch,
53
235
  };
@@ -102,6 +102,14 @@ const applyEntryPatch = (entry: ScreenEntry, patch: EntryPatch) => {
102
102
  entry.ancestorNavigatorKeys = patch.ancestorNavigatorKeys;
103
103
  }
104
104
  }
105
+
106
+ if (patch.presenceCount !== undefined) {
107
+ if (patch.presenceCount === null) {
108
+ delete entry.presenceCount;
109
+ } else {
110
+ entry.presenceCount = patch.presenceCount;
111
+ }
112
+ }
105
113
  };
106
114
 
107
115
  const findMatchingScreenEntry = (
@@ -130,6 +130,7 @@ function resolveTransitionPair(
130
130
  const destinationStyles = matchedLink?.destination?.styles ?? null;
131
131
  const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
132
132
  const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
133
+ const usedPending = matchedLink ? matchedLink.destination === null : false;
133
134
 
134
135
  return {
135
136
  sourceBounds,
@@ -138,6 +139,7 @@ function resolveTransitionPair(
138
139
  destinationStyles,
139
140
  sourceScreenKey,
140
141
  destinationScreenKey,
142
+ usedPending,
141
143
  };
142
144
  }
143
145
 
@@ -23,6 +23,7 @@ export type Entry = {
23
23
  ancestorKeys?: ScreenKey[];
24
24
  navigatorKey?: NavigatorKey;
25
25
  ancestorNavigatorKeys?: NavigatorKey[];
26
+ presenceCount?: number;
26
27
  };
27
28
 
28
29
  export type MeasuredEntry = Entry & {
@@ -36,6 +37,7 @@ export type EntryPatch = {
36
37
  ancestorKeys?: ScreenKey[] | null;
37
38
  navigatorKey?: NavigatorKey | null;
38
39
  ancestorNavigatorKeys?: NavigatorKey[] | null;
40
+ presenceCount?: number | null;
39
41
  };
40
42
 
41
43
  export type ScreenIdentifier = {
@@ -64,6 +66,7 @@ export type ResolvedTransitionPair = {
64
66
  destinationStyles: StyleProps | null;
65
67
  sourceScreenKey: ScreenKey | null;
66
68
  destinationScreenKey: ScreenKey | null;
69
+ usedPending: boolean;
67
70
  };
68
71
 
69
72
  export type ScreenEntry = Entry;
@@ -4,7 +4,7 @@ import {
4
4
  type MeasuredDimensions,
5
5
  } from "react-native-reanimated";
6
6
  import { ENTER_RANGE, EXIT_RANGE } from "../../../constants";
7
- import { BoundStore } from "../../../stores/bounds";
7
+ import { getMeasuredEntry } from "../../../stores/bounds/internals/registry";
8
8
  import type { ScreenInterpolationProps } from "../../../types/animation.types";
9
9
  import type { BoundId } from "../types/options";
10
10
  import type { LinkAccessor } from "./create-link-accessor";
@@ -51,12 +51,9 @@ export const createInterpolators = ({
51
51
  const normalizedTag = String(tag);
52
52
 
53
53
  const currentMeasuredEntry = currentKey
54
- ? BoundStore.entry.getMeasured(normalizedTag, currentKey)
54
+ ? getMeasuredEntry(normalizedTag, currentKey)
55
55
  : null;
56
- const targetMeasuredEntry = BoundStore.entry.getMeasured(
57
- normalizedTag,
58
- targetKey,
59
- );
56
+ const targetMeasuredEntry = getMeasuredEntry(normalizedTag, targetKey);
60
57
 
61
58
  const currentValue = currentMeasuredEntry?.bounds?.[property] ?? fb;
62
59
  const targetValue = targetMeasuredEntry?.bounds?.[property] ?? fb;
@@ -1,4 +1,8 @@
1
- import { BoundStore, type MeasuredEntry } from "../../../stores/bounds";
1
+ import {
2
+ getActiveLink,
3
+ getMeasuredEntry,
4
+ } from "../../../stores/bounds/internals/registry";
5
+ import type { MeasuredEntry } from "../../../stores/bounds/types";
2
6
  import type { ScreenInterpolationProps } from "../../../types/animation.types";
3
7
  import type { BoundsLink } from "../../../types/bounds.types";
4
8
  import type { BoundId } from "../types/options";
@@ -17,7 +21,7 @@ export const createLinkAccessor = (getProps: GetProps): LinkAccessor => {
17
21
  const getMeasured = (tag: BoundId, key?: string): MeasuredEntry | null => {
18
22
  "worklet";
19
23
  if (!key) return null;
20
- return BoundStore.entry.getMeasured(String(tag), key);
24
+ return getMeasuredEntry(String(tag), key);
21
25
  };
22
26
 
23
27
  const getSnapshot = (tag: BoundId, key?: string): MeasuredEntry | null => {
@@ -28,10 +32,7 @@ export const createLinkAccessor = (getProps: GetProps): LinkAccessor => {
28
32
  const getLink = (tag: BoundId): BoundsLink | null => {
29
33
  "worklet";
30
34
  const props = getProps();
31
- const link = BoundStore.link.getActive(
32
- String(tag),
33
- props.current?.route.key,
34
- );
35
+ const link = getActiveLink(String(tag), props.current?.route.key);
35
36
  if (!link) return null;
36
37
  return {
37
38
  source: link.source
@@ -1,7 +1,9 @@
1
1
  import {
2
- BoundStore,
3
- type ResolvedTransitionPair,
4
- } from "../../../stores/bounds";
2
+ getGroupActiveId,
3
+ setGroupActiveId,
4
+ } from "../../../stores/bounds/internals/groups";
5
+ import { getEntryConfig } from "../../../stores/bounds/internals/registry";
6
+ import type { ResolvedTransitionPair } from "../../../stores/bounds/types";
5
7
  import type { ScreenInterpolationProps } from "../../../types/animation.types";
6
8
  import { DEFAULT_BOUNDS_OPTIONS } from "../constants";
7
9
  import type {
@@ -40,9 +42,7 @@ export const buildBoundsOptions = ({
40
42
  const currentScreenKey = props.current?.route.key;
41
43
 
42
44
  const boundaryConfig =
43
- tag && currentScreenKey
44
- ? BoundStore.entry.getConfig(tag, currentScreenKey)
45
- : null;
45
+ tag && currentScreenKey ? getEntryConfig(tag, currentScreenKey) : null;
46
46
 
47
47
  const resolved = {
48
48
  ...DEFAULT_BOUNDS_OPTIONS,
@@ -61,9 +61,9 @@ const syncGroupActiveMember = (group?: string, id?: BoundId) => {
61
61
 
62
62
  const normalizedId = String(id);
63
63
 
64
- if (BoundStore.group.getActiveId(group) === normalizedId) return;
64
+ if (getGroupActiveId(group) === normalizedId) return;
65
65
 
66
- BoundStore.group.setActiveId(group, normalizedId);
66
+ setGroupActiveId(group, normalizedId);
67
67
  };
68
68
 
69
69
  export const prepareBoundStyles = <T extends BoundsOptions>({
@@ -5,10 +5,8 @@ import {
5
5
  FULLSCREEN_DIMENSIONS,
6
6
  NO_STYLES,
7
7
  } from "../../../../constants";
8
- import {
9
- BoundStore,
10
- type ResolvedTransitionPair,
11
- } from "../../../../stores/bounds";
8
+ import { resolveTransitionPair } from "../../../../stores/bounds/internals/resolver";
9
+ import type { ResolvedTransitionPair } from "../../../../stores/bounds/types";
12
10
  import type { ScreenTransitionState } from "../../../../types/animation.types";
13
11
  import type { Layout } from "../../../../types/screen.types";
14
12
  import type {
@@ -54,7 +52,7 @@ const resolveStartEnd = (params: {
54
52
 
55
53
  const resolvedPair =
56
54
  params.resolvedPair ??
57
- BoundStore.link.getPair(String(params.id), {
55
+ resolveTransitionPair(String(params.id), {
58
56
  currentScreenKey,
59
57
  previousScreenKey,
60
58
  nextScreenKey,
@@ -5,10 +5,9 @@ import {
5
5
  NAVIGATION_MASK_ELEMENT_STYLE_ID,
6
6
  VISIBLE_STYLE,
7
7
  } from "../../../constants";
8
- import {
9
- BoundStore,
10
- type ResolvedTransitionPair,
11
- } from "../../../stores/bounds";
8
+ import { getGroupActiveId } from "../../../stores/bounds/internals/groups";
9
+ import { resolveTransitionPair } from "../../../stores/bounds/internals/resolver";
10
+ import type { ResolvedTransitionPair } from "../../../stores/bounds/types";
12
11
  import type { TransitionInterpolatedStyle } from "../../../types/animation.types";
13
12
  import type { Layout } from "../../../types/screen.types";
14
13
  import { prepareBoundStyles } from "../helpers/prepare-bound-styles";
@@ -176,7 +175,7 @@ export function buildZoomStyles({
176
175
  let buildEffectiveTag = tag;
177
176
  if (isGroup) {
178
177
  const group = tag.split(":")[0];
179
- const groupActiveTag = BoundStore.group.getActiveId(group)?.split(":")[0];
178
+ const groupActiveTag = getGroupActiveId(group)?.split(":")[0];
180
179
  buildEffectiveTag = `${group}:${groupActiveTag ?? tag.split(":")[1]}`;
181
180
  }
182
181
 
@@ -201,7 +200,7 @@ export function buildZoomStyles({
201
200
  scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
202
201
  } as const;
203
202
 
204
- const linkPair = BoundStore.link.getPair(buildEffectiveTag, {
203
+ const linkPair = resolveTransitionPair(buildEffectiveTag, {
205
204
  currentScreenKey: currentRouteKey,
206
205
  previousScreenKey: previousRouteKey,
207
206
  nextScreenKey: nextRouteKey,