react-native-screen-transitions 3.4.0-beta.0 → 3.4.0-beta.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 (216) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +6 -5
  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/hooks/helpers/measurement-rules.js +4 -1
  4. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +28 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +7 -5
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  9. package/lib/commonjs/shared/constants.js +1 -2
  10. package/lib/commonjs/shared/constants.js.map +1 -1
  11. package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
  12. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  13. package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
  14. package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
  15. package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
  16. package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
  17. package/lib/commonjs/shared/stores/bounds/internals/registry.js +0 -5
  18. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  19. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +0 -3
  20. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  21. package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
  22. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  23. package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
  24. package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
  25. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  26. package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
  27. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  28. package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  29. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  30. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
  31. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  32. package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  33. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  34. package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +9 -9
  35. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  36. package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  37. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  38. package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  39. package/lib/commonjs/shared/utils/bounds/index.js +16 -44
  40. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  41. package/lib/commonjs/shared/utils/bounds/zoom/build.js +135 -31
  42. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  43. package/lib/commonjs/shared/utils/bounds/zoom/config.js +8 -1
  44. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  45. package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
  46. package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
  47. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +6 -5
  48. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  49. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +4 -1
  50. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  51. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +29 -1
  52. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  53. package/lib/module/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +5 -3
  54. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  55. package/lib/module/shared/constants.js +1 -2
  56. package/lib/module/shared/constants.js.map +1 -1
  57. package/lib/module/shared/providers/register-bounds.provider.js +9 -1
  58. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  59. package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
  60. package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
  61. package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
  62. package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
  63. package/lib/module/shared/stores/bounds/internals/registry.js +1 -6
  64. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  65. package/lib/module/shared/stores/bounds/internals/resolver.js +1 -4
  66. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  67. package/lib/module/shared/stores/bounds/internals/state.js +0 -78
  68. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  69. package/lib/module/shared/utils/bounds/constants.js.map +1 -0
  70. package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
  71. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  72. package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
  73. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  74. package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  75. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  76. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
  77. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  78. package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  79. package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  80. package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +7 -7
  81. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  82. package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  83. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  84. package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  85. package/lib/module/shared/utils/bounds/index.js +14 -42
  86. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  87. package/lib/module/shared/utils/bounds/zoom/build.js +138 -34
  88. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  89. package/lib/module/shared/utils/bounds/zoom/config.js +7 -0
  90. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  91. package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
  92. package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
  93. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  94. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +1 -0
  95. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  96. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +14 -0
  97. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  98. package/lib/typescript/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.d.ts → use-pre-transition-measurement.d.ts} +2 -2
  99. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
  100. package/lib/typescript/shared/constants.d.ts +0 -1
  101. package/lib/typescript/shared/constants.d.ts.map +1 -1
  102. package/lib/typescript/shared/index.d.ts +1 -1
  103. package/lib/typescript/shared/index.d.ts.map +1 -1
  104. package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
  105. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  106. package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
  107. package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
  108. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  109. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  110. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
  111. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  112. package/lib/typescript/shared/types/bounds.types.d.ts +72 -0
  113. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  114. package/lib/typescript/shared/types/index.d.ts +1 -1
  115. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  116. package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
  117. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
  118. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
  119. package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
  120. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
  121. package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
  122. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
  123. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
  124. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
  125. package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
  126. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
  127. package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
  128. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
  129. package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
  130. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
  131. package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
  132. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  133. package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
  134. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  135. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  136. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +7 -0
  137. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  138. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
  139. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
  140. package/package.json +1 -1
  141. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +6 -5
  142. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +6 -1
  143. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +28 -13
  144. package/src/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.ts → use-pre-transition-measurement.ts} +8 -5
  145. package/src/shared/constants.ts +0 -1
  146. package/src/shared/index.ts +2 -0
  147. package/src/shared/providers/register-bounds.provider.tsx +8 -1
  148. package/src/shared/stores/bounds/internals/clear.ts +47 -220
  149. package/src/shared/stores/bounds/internals/presence.ts +1 -4
  150. package/src/shared/stores/bounds/internals/registry.ts +1 -11
  151. package/src/shared/stores/bounds/internals/resolver.ts +1 -9
  152. package/src/shared/stores/bounds/internals/state.ts +0 -98
  153. package/src/shared/types/bounds.types.ts +74 -0
  154. package/src/shared/types/index.ts +2 -0
  155. package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
  156. package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
  157. package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
  158. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
  159. package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
  160. package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +9 -9
  161. package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
  162. package/src/shared/utils/bounds/index.ts +13 -53
  163. package/src/shared/utils/bounds/types/options.ts +3 -2
  164. package/src/shared/utils/bounds/zoom/build.ts +169 -61
  165. package/src/shared/utils/bounds/zoom/config.ts +9 -0
  166. package/src/shared/utils/bounds/zoom/math.ts +57 -0
  167. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
  168. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
  169. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  170. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  171. package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
  172. package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  173. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
  174. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  175. package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  176. package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  177. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  178. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  179. package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
  180. package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
  181. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
  182. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  183. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  184. package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
  185. package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  186. package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
  187. package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  188. package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  189. package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  190. package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  191. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  192. package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
  193. package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +0 -1
  194. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
  195. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
  196. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
  197. package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
  198. package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
  199. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
  200. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
  201. package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
  202. package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
  203. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
  204. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
  205. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
  206. package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
  207. package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
  208. package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
  209. /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  210. /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  211. /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  212. /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  213. /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
  214. /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
  215. /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
  216. /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
@@ -1,11 +1,14 @@
1
- import type { MeasuredDimensions } from "react-native-reanimated";
1
+ import {
2
+ Extrapolation,
3
+ interpolate,
4
+ type MeasuredDimensions,
5
+ } from "react-native-reanimated";
2
6
  import { ENTER_RANGE, EXIT_RANGE } from "../../../constants";
3
7
  import { BoundStore } from "../../../stores/bounds";
4
8
  import type { ScreenInterpolationProps } from "../../../types/animation.types";
5
9
  import type { BoundId } from "../types/options";
6
- import { interpolateClamped } from "./interpolate";
7
- import { interpolateLinkStyle } from "./interpolate-style";
8
- import type { LinkAccessor } from "./link-accessor";
10
+ import type { LinkAccessor } from "./create-link-accessor";
11
+ import { interpolateLinkStyle } from "./styles/interpolate-link-style";
9
12
 
10
13
  type InterpolatorParams = {
11
14
  getProps: () => Omit<ScreenInterpolationProps, "bounds">;
@@ -55,10 +58,12 @@ export const createInterpolators = ({
55
58
  const currentValue = currentSnapshot?.bounds?.[property] ?? fb;
56
59
  const targetValue = targetSnapshot?.bounds?.[property] ?? fb;
57
60
 
58
- return interpolateClamped(props.progress, range, [
59
- targetValue,
60
- currentValue,
61
- ]);
61
+ return interpolate(
62
+ props.progress,
63
+ range,
64
+ [targetValue, currentValue],
65
+ Extrapolation.CLAMP,
66
+ );
62
67
  };
63
68
 
64
69
  const interpolateBoundsFromLink = (
@@ -77,10 +82,12 @@ export const createInterpolators = ({
77
82
  const sourceValue = link?.source?.bounds?.[property] ?? fb;
78
83
  const destinationValue = link?.destination?.bounds?.[property] ?? fb;
79
84
 
80
- return interpolateClamped(props.progress, range, [
81
- sourceValue,
82
- destinationValue,
83
- ]);
85
+ return interpolate(
86
+ props.progress,
87
+ range,
88
+ [sourceValue, destinationValue],
89
+ Extrapolation.CLAMP,
90
+ );
84
91
  };
85
92
 
86
93
  const interpolateBounds = (
@@ -0,0 +1,100 @@
1
+ import {
2
+ BoundStore,
3
+ type ResolvedTransitionPair,
4
+ } from "../../../stores/bounds";
5
+ import type { ScreenInterpolationProps } from "../../../types/animation.types";
6
+ import { DEFAULT_BOUNDS_OPTIONS } from "../constants";
7
+ import type {
8
+ BoundId,
9
+ BoundsOptions,
10
+ BoundsOptionsResult,
11
+ } from "../types/options";
12
+ import { createBoundTag } from "./create-bound-tag";
13
+ import { computeBoundStyles } from "./styles/compute";
14
+
15
+ type BaseInterpolatorProps = Omit<ScreenInterpolationProps, "bounds">;
16
+
17
+ type ComputeResolvedBoundsStylesParams<T extends BoundsOptions> = {
18
+ props: BaseInterpolatorProps;
19
+ options: T;
20
+ resolvedPair?: ResolvedTransitionPair;
21
+ syncGroupActiveId?: boolean;
22
+ };
23
+
24
+ type BuildBoundsOptionsParams = {
25
+ props: Omit<ScreenInterpolationProps, "bounds">;
26
+ id?: BoundId;
27
+ group?: string;
28
+ overrides?: Partial<BoundsOptions>;
29
+ };
30
+
31
+ export const buildBoundsOptions = ({
32
+ props,
33
+ id,
34
+ group,
35
+ overrides,
36
+ }: BuildBoundsOptionsParams): BoundsOptions => {
37
+ "worklet";
38
+
39
+ const tag = createBoundTag({ id, group });
40
+ const currentScreenKey = props.current?.route.key;
41
+
42
+ const boundaryConfig =
43
+ tag && currentScreenKey
44
+ ? BoundStore.getBoundaryConfig(tag, currentScreenKey)
45
+ : null;
46
+
47
+ const resolved = {
48
+ ...DEFAULT_BOUNDS_OPTIONS,
49
+ ...(boundaryConfig ?? {}),
50
+ ...(overrides ?? {}),
51
+ id: tag ?? "",
52
+ group,
53
+ };
54
+
55
+ return resolved;
56
+ };
57
+
58
+ const syncGroupActiveMember = (group?: string, id?: BoundId) => {
59
+ "worklet";
60
+ if (!group || id == null || id === "") return;
61
+
62
+ const normalizedId = String(id);
63
+
64
+ if (BoundStore.getGroupActiveId(group) === normalizedId) return;
65
+
66
+ BoundStore.setGroupActiveId(group, normalizedId);
67
+ };
68
+
69
+ export const prepareBoundStyles = <T extends BoundsOptions>({
70
+ props,
71
+ options,
72
+ resolvedPair,
73
+ syncGroupActiveId = true,
74
+ }: ComputeResolvedBoundsStylesParams<T>): BoundsOptionsResult<T> => {
75
+ "worklet";
76
+
77
+ if (syncGroupActiveId) {
78
+ syncGroupActiveMember(options.group, options.id);
79
+ }
80
+
81
+ const resolved = buildBoundsOptions({
82
+ props,
83
+ id: options.id,
84
+ group: options.group,
85
+ overrides: options,
86
+ });
87
+
88
+ return computeBoundStyles(
89
+ {
90
+ id: resolved.id,
91
+ previous: props.previous,
92
+ current: props.current,
93
+ next: props.next,
94
+ progress: props.progress,
95
+ dimensions: props.layouts.screen,
96
+ },
97
+ resolved,
98
+ resolvedPair,
99
+ ) as BoundsOptionsResult<T>;
100
+ };
@@ -1,11 +1,15 @@
1
- import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
- import { VISIBLE_STYLE } from "../../../constants";
1
+ import {
2
+ Extrapolation,
3
+ interpolate,
4
+ type MeasuredDimensions,
5
+ type StyleProps,
6
+ } from "react-native-reanimated";
7
+ import { VISIBLE_STYLE } from "../../../../constants";
3
8
  import type {
4
9
  ContentTransformGeometry,
5
10
  RelativeGeometry,
6
- } from "../types/geometry";
7
- import type { BoundsAnchor, BoundsOptions } from "../types/options";
8
- import { interpolateClamped } from "./interpolate";
11
+ } from "../../types/geometry";
12
+ import type { BoundsAnchor, BoundsOptions } from "../../types/options";
9
13
 
10
14
  /**
11
15
  * Element-level (relative) params shared by size/transform composers.
@@ -108,20 +112,31 @@ export function composeSizeAbsolute(params: ElementComposeParams): StyleProps {
108
112
  const startAnchor = getAnchorPoint(start, anchor);
109
113
  const endAnchor = getAnchorPoint(end, anchor);
110
114
 
111
- const width = interpolateClamped(progress, ranges, [start.width, end.width]);
112
- const height = interpolateClamped(progress, ranges, [
113
- start.height,
114
- end.height,
115
- ]);
115
+ const width = interpolate(
116
+ progress,
117
+ ranges,
118
+ [start.width, end.width],
119
+ Extrapolation.CLAMP,
120
+ );
121
+ const height = interpolate(
122
+ progress,
123
+ ranges,
124
+ [start.height, end.height],
125
+ Extrapolation.CLAMP,
126
+ );
116
127
 
117
- const anchorX = interpolateClamped(progress, ranges, [
118
- startAnchor.x,
119
- endAnchor.x,
120
- ]);
121
- const anchorY = interpolateClamped(progress, ranges, [
122
- startAnchor.y,
123
- endAnchor.y,
124
- ]);
128
+ const anchorX = interpolate(
129
+ progress,
130
+ ranges,
131
+ [startAnchor.x, endAnchor.x],
132
+ Extrapolation.CLAMP,
133
+ );
134
+ const anchorY = interpolate(
135
+ progress,
136
+ ranges,
137
+ [startAnchor.y, endAnchor.y],
138
+ Extrapolation.CLAMP,
139
+ );
125
140
  const anchorOffset = getAnchorOffset({ width, height, anchor });
126
141
 
127
142
  const translateX = anchorX - anchorOffset.x;
@@ -154,19 +169,30 @@ export function composeSizeRelative(params: ElementComposeParams): StyleProps {
154
169
  const baseX = geometry.entering ? end.pageX : start.pageX;
155
170
  const baseY = geometry.entering ? end.pageY : start.pageY;
156
171
 
157
- const width = interpolateClamped(progress, ranges, [start.width, end.width]);
158
- const height = interpolateClamped(progress, ranges, [
159
- start.height,
160
- end.height,
161
- ]);
162
- const anchorX = interpolateClamped(progress, ranges, [
163
- startAnchor.x,
164
- endAnchor.x,
165
- ]);
166
- const anchorY = interpolateClamped(progress, ranges, [
167
- startAnchor.y,
168
- endAnchor.y,
169
- ]);
172
+ const width = interpolate(
173
+ progress,
174
+ ranges,
175
+ [start.width, end.width],
176
+ Extrapolation.CLAMP,
177
+ );
178
+ const height = interpolate(
179
+ progress,
180
+ ranges,
181
+ [start.height, end.height],
182
+ Extrapolation.CLAMP,
183
+ );
184
+ const anchorX = interpolate(
185
+ progress,
186
+ ranges,
187
+ [startAnchor.x, endAnchor.x],
188
+ Extrapolation.CLAMP,
189
+ );
190
+ const anchorY = interpolate(
191
+ progress,
192
+ ranges,
193
+ [startAnchor.y, endAnchor.y],
194
+ Extrapolation.CLAMP,
195
+ );
170
196
  const anchorOffset = getAnchorOffset({ width, height, anchor });
171
197
 
172
198
  const translateX = anchorX - (baseX + anchorOffset.x);
@@ -197,17 +223,47 @@ export function composeTransformAbsolute(
197
223
  const { start, end, geometry, progress, ranges, computeOptions } = params;
198
224
 
199
225
  const translateX = geometry.entering
200
- ? interpolateClamped(progress, ranges, [start.pageX, end.pageX])
201
- : interpolateClamped(progress, ranges, [end.pageX, start.pageX]);
226
+ ? interpolate(
227
+ progress,
228
+ ranges,
229
+ [start.pageX, end.pageX],
230
+ Extrapolation.CLAMP,
231
+ )
232
+ : interpolate(
233
+ progress,
234
+ ranges,
235
+ [end.pageX, start.pageX],
236
+ Extrapolation.CLAMP,
237
+ );
202
238
  const translateY = geometry.entering
203
- ? interpolateClamped(progress, ranges, [start.pageY, end.pageY])
204
- : interpolateClamped(progress, ranges, [end.pageY, start.pageY]);
239
+ ? interpolate(
240
+ progress,
241
+ ranges,
242
+ [start.pageY, end.pageY],
243
+ Extrapolation.CLAMP,
244
+ )
245
+ : interpolate(
246
+ progress,
247
+ ranges,
248
+ [end.pageY, start.pageY],
249
+ Extrapolation.CLAMP,
250
+ );
205
251
  const scaleX = geometry.entering
206
- ? interpolateClamped(progress, ranges, [geometry.scaleX, 1])
207
- : interpolateClamped(progress, ranges, [1, 1 / geometry.scaleX]);
252
+ ? interpolate(progress, ranges, [geometry.scaleX, 1], Extrapolation.CLAMP)
253
+ : interpolate(
254
+ progress,
255
+ ranges,
256
+ [1, 1 / geometry.scaleX],
257
+ Extrapolation.CLAMP,
258
+ );
208
259
  const scaleY = geometry.entering
209
- ? interpolateClamped(progress, ranges, [geometry.scaleY, 1])
210
- : interpolateClamped(progress, ranges, [1, 1 / geometry.scaleY]);
260
+ ? interpolate(progress, ranges, [geometry.scaleY, 1], Extrapolation.CLAMP)
261
+ : interpolate(
262
+ progress,
263
+ ranges,
264
+ [1, 1 / geometry.scaleY],
265
+ Extrapolation.CLAMP,
266
+ );
211
267
 
212
268
  if (computeOptions.raw) {
213
269
  return {
@@ -232,17 +288,27 @@ export function composeTransformRelative(
232
288
  const { geometry, computeOptions, progress, ranges } = params;
233
289
 
234
290
  const translateX = geometry.entering
235
- ? interpolateClamped(progress, ranges, [geometry.dx, 0])
236
- : interpolateClamped(progress, ranges, [0, -geometry.dx]);
291
+ ? interpolate(progress, ranges, [geometry.dx, 0], Extrapolation.CLAMP)
292
+ : interpolate(progress, ranges, [0, -geometry.dx], Extrapolation.CLAMP);
237
293
  const translateY = geometry.entering
238
- ? interpolateClamped(progress, ranges, [geometry.dy, 0])
239
- : interpolateClamped(progress, ranges, [0, -geometry.dy]);
294
+ ? interpolate(progress, ranges, [geometry.dy, 0], Extrapolation.CLAMP)
295
+ : interpolate(progress, ranges, [0, -geometry.dy], Extrapolation.CLAMP);
240
296
  const scaleX = geometry.entering
241
- ? interpolateClamped(progress, ranges, [geometry.scaleX, 1])
242
- : interpolateClamped(progress, ranges, [1, 1 / geometry.scaleX]);
297
+ ? interpolate(progress, ranges, [geometry.scaleX, 1], Extrapolation.CLAMP)
298
+ : interpolate(
299
+ progress,
300
+ ranges,
301
+ [1, 1 / geometry.scaleX],
302
+ Extrapolation.CLAMP,
303
+ );
243
304
  const scaleY = geometry.entering
244
- ? interpolateClamped(progress, ranges, [geometry.scaleY, 1])
245
- : interpolateClamped(progress, ranges, [1, 1 / geometry.scaleY]);
305
+ ? interpolate(progress, ranges, [geometry.scaleY, 1], Extrapolation.CLAMP)
306
+ : interpolate(
307
+ progress,
308
+ ranges,
309
+ [1, 1 / geometry.scaleY],
310
+ Extrapolation.CLAMP,
311
+ );
246
312
 
247
313
  if (computeOptions.raw) {
248
314
  return {
@@ -278,14 +344,14 @@ export function composeContentStyle(params: ContentComposeParams): StyleProps {
278
344
  const { s, tx, ty, entering } = geometry;
279
345
 
280
346
  const translateX = entering
281
- ? interpolateClamped(progress, ranges, [tx, 0])
282
- : interpolateClamped(progress, ranges, [0, tx]);
347
+ ? interpolate(progress, ranges, [tx, 0], Extrapolation.CLAMP)
348
+ : interpolate(progress, ranges, [0, tx], Extrapolation.CLAMP);
283
349
  const translateY = entering
284
- ? interpolateClamped(progress, ranges, [ty, 0])
285
- : interpolateClamped(progress, ranges, [0, ty]);
350
+ ? interpolate(progress, ranges, [ty, 0], Extrapolation.CLAMP)
351
+ : interpolate(progress, ranges, [0, ty], Extrapolation.CLAMP);
286
352
  const scale = entering
287
- ? interpolateClamped(progress, ranges, [s, 1])
288
- : interpolateClamped(progress, ranges, [1, s]);
353
+ ? interpolate(progress, ranges, [s, 1], Extrapolation.CLAMP)
354
+ : interpolate(progress, ranges, [1, s], Extrapolation.CLAMP);
289
355
 
290
356
  if (raw) {
291
357
  return {
@@ -6,22 +6,22 @@ import {
6
6
  FULLSCREEN_DIMENSIONS,
7
7
  HIDDEN_STYLE,
8
8
  NO_STYLES,
9
- } from "../../../constants";
9
+ } from "../../../../constants";
10
10
  import {
11
11
  BoundStore,
12
12
  type ResolvedTransitionPair,
13
- } from "../../../stores/bounds";
14
- import type { ScreenTransitionState } from "../../../types/animation.types";
15
- import type { Layout } from "../../../types/screen.types";
13
+ } from "../../../../stores/bounds";
14
+ import type { ScreenTransitionState } from "../../../../types/animation.types";
15
+ import type { Layout } from "../../../../types/screen.types";
16
16
  import type {
17
17
  BoundId,
18
18
  BoundsComputeParams,
19
19
  BoundsOptions,
20
- } from "../types/options";
20
+ } from "../../types/options";
21
21
  import {
22
22
  computeContentTransformGeometry,
23
23
  computeRelativeGeometry,
24
- } from "./geometry";
24
+ } from "../geometry";
25
25
  import {
26
26
  composeContentStyle,
27
27
  composeSizeAbsolute,
@@ -29,9 +29,9 @@ import {
29
29
  composeTransformAbsolute,
30
30
  composeTransformRelative,
31
31
  type ElementComposeParams,
32
- } from "./style-composers";
32
+ } from "./composers";
33
33
 
34
- const resolveBounds = (params: {
34
+ const resolveStartEnd = (params: {
35
35
  id: BoundId;
36
36
  previous?: ScreenTransitionState;
37
37
  current?: ScreenTransitionState;
@@ -135,7 +135,7 @@ export const computeBoundStyles = (
135
135
  currentScreenKey,
136
136
  sourceScreenKey,
137
137
  destinationScreenKey,
138
- } = resolveBounds({
138
+ } = resolveStartEnd({
139
139
  id,
140
140
  previous,
141
141
  current,
@@ -1,6 +1,6 @@
1
- import { ENTER_RANGE, EXIT_RANGE } from "../../../constants";
2
- import type { BoundsLink } from "../../../types/bounds.types";
3
- import { interpolateClamped } from "./interpolate";
1
+ import { Extrapolation, interpolate } from "react-native-reanimated";
2
+ import { ENTER_RANGE, EXIT_RANGE } from "../../../../constants";
3
+ import type { BoundsLink } from "../../../../types/bounds.types";
4
4
 
5
5
  type InterpolateStyleOptions = {
6
6
  fallback?: number;
@@ -34,5 +34,10 @@ export function interpolateLinkStyle(
34
34
 
35
35
  const range = entering ? ENTER_RANGE : EXIT_RANGE;
36
36
 
37
- return interpolateClamped(progress, range, [sourceValue, destValue]);
37
+ return interpolate(
38
+ progress,
39
+ range,
40
+ [sourceValue, destValue],
41
+ Extrapolation.CLAMP,
42
+ );
38
43
  }
@@ -1,75 +1,35 @@
1
- import { BoundStore, type ResolvedTransitionPair } from "../../stores/bounds";
2
- import type { ScreenInterpolationProps } from "../../types/animation.types";
3
1
  import type {
4
2
  BoundsAccessor,
5
3
  BoundsInterpolationProps,
6
4
  BoundsNavigationZoomOptions,
7
5
  } from "../../types/bounds.types";
8
- import { buildBoundsOptions } from "./helpers/build-bounds-options";
9
- import { computeBoundStyles } from "./helpers/compute-bounds-styles";
10
- import { createInterpolators } from "./helpers/interpolators";
11
- import { createLinkAccessor } from "./helpers/link-accessor";
12
- import { resolveBoundTag } from "./helpers/resolve-bound-tag";
6
+ import { createBoundTag } from "./helpers/create-bound-tag";
7
+ import { createInterpolators } from "./helpers/create-interpolators";
8
+ import { createLinkAccessor } from "./helpers/create-link-accessor";
9
+ import { prepareBoundStyles } from "./helpers/prepare-bound-styles";
13
10
  import type { BoundsOptions } from "./types/options";
14
11
  import { buildZoomStyles } from "./zoom/build";
15
12
 
16
- const syncGroupActiveMember = (group?: string, id?: string | number) => {
17
- "worklet";
18
- if (!group) return;
19
- if (id === undefined || id === null || id === "") return;
20
-
21
- const normalizedId = String(id);
22
- if (BoundStore.getGroupActiveId(group) === normalizedId) return;
23
-
24
- BoundStore.setGroupActiveId(group, normalizedId);
25
- };
26
-
27
13
  export const createBoundsAccessor = (
28
14
  getProps: () => BoundsInterpolationProps,
29
15
  ): BoundsAccessor => {
30
16
  "worklet";
31
17
 
32
- const computeForResolvedOptions = (
33
- resolvedOptions: BoundsOptions,
34
- props: Omit<ScreenInterpolationProps, "bounds">,
35
- resolvedPair?: ResolvedTransitionPair,
36
- ) => {
37
- "worklet";
38
- return computeBoundStyles(
39
- {
40
- id: resolvedOptions.id,
41
- previous: props.previous,
42
- current: props.current,
43
- next: props.next,
44
- progress: props.progress,
45
- dimensions: props.layouts.screen,
46
- },
47
- resolvedOptions,
48
- resolvedPair,
49
- );
50
- };
51
-
52
- const computeElementBoundsStyles = (params?: BoundsOptions) => {
18
+ const computeBounds = (params?: BoundsOptions) => {
53
19
  "worklet";
54
20
  const props = getProps();
55
- const id = params?.id;
56
- const group = params?.group;
57
- syncGroupActiveMember(group, id);
58
-
59
- const resolved = buildBoundsOptions({
21
+ const options = (params ?? { id: "" }) as BoundsOptions;
22
+ const computed = prepareBoundStyles({
60
23
  props,
61
- id,
62
- group,
63
- overrides: params,
64
- mode: "style",
65
- resolveBoundTag,
24
+ options,
66
25
  });
67
-
68
- const computed = computeForResolvedOptions(resolved, props);
69
26
  // Navigation helpers are intentionally opinionated. Only the resolved
70
27
  // tag from `id`/`group` is allowed to flow into `navigation.zoom()`;
71
28
  // base bounds overrides like `target`, `anchor`, or `scaleMode` must not.
72
- const navigationTag = resolveBoundTag({ id, group });
29
+ const navigationTag = createBoundTag({
30
+ id: options.id,
31
+ group: options.group,
32
+ });
73
33
 
74
34
  const target = Object.isExtensible(computed) ? computed : { ...computed };
75
35
 
@@ -97,7 +57,7 @@ export const createBoundsAccessor = (
97
57
  getLink,
98
58
  });
99
59
 
100
- return Object.assign(computeElementBoundsStyles, {
60
+ return Object.assign(computeBounds, {
101
61
  getSnapshot,
102
62
  getLink,
103
63
  interpolateStyle,
@@ -112,8 +112,9 @@ export type BoundsOptions = {
112
112
  /**
113
113
  * Coordinate space selection.
114
114
  *
115
- * For `bounds({ ... })` element styles, space is normalized to `"relative"`.
116
- * `"absolute"` is reserved for internal navigation helpers (e.g. mask geometry).
115
+ * - `"relative"` composes movement relative to the current element's layout box
116
+ * - `"absolute"` composes movement in screen/window coordinates
117
+ *
117
118
  * @default "relative"
118
119
  */
119
120
  space?: BoundsSpace;