react-native-screen-transitions 3.4.0-alpha.7 → 3.4.0-beta.1

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 (372) hide show
  1. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  2. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  3. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +22 -60
  4. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  6. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  7. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +56 -41
  8. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  9. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  10. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +111 -2
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +69 -0
  16. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  17. package/lib/commonjs/shared/components/create-boundary-component/index.js +10 -5
  18. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  19. package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -32
  20. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  21. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  22. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  23. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +7 -5
  24. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  25. package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
  26. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  27. package/lib/commonjs/shared/constants.js +17 -3
  28. package/lib/commonjs/shared/constants.js.map +1 -1
  29. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
  30. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  31. package/lib/commonjs/shared/index.js +6 -0
  32. package/lib/commonjs/shared/index.js.map +1 -1
  33. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
  34. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  35. package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
  36. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  38. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  40. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  41. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +1 -11
  42. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
  43. package/lib/commonjs/shared/stores/animation.store.js +9 -3
  44. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  45. package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
  46. package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
  47. package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
  48. package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
  49. package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -7
  50. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  51. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -51
  52. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  53. package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
  54. package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
  55. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
  56. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  57. package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
  58. package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
  59. package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  60. package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
  61. package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  62. package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  63. package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  64. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
  65. package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  66. package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  67. package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  68. package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +14 -20
  69. package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  70. package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  71. package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  72. package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  73. package/lib/commonjs/shared/utils/bounds/index.js +16 -44
  74. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  75. package/lib/commonjs/shared/utils/bounds/zoom/build.js +234 -50
  76. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  77. package/lib/commonjs/shared/utils/bounds/zoom/config.js +10 -1
  78. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  79. package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
  80. package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
  81. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +6 -4
  82. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
  83. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +23 -61
  84. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
  85. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  86. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  87. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +54 -39
  88. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  89. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  90. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  91. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
  92. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  93. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +114 -4
  94. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  95. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +64 -0
  96. package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
  97. package/lib/module/shared/components/create-boundary-component/index.js +10 -5
  98. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  99. package/lib/module/shared/components/create-transition-aware-component.js +10 -34
  100. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  101. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  102. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  103. package/lib/module/shared/components/screen-container/layers/backdrop.js +7 -5
  104. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  105. package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
  106. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  107. package/lib/module/shared/constants.js +16 -2
  108. package/lib/module/shared/constants.js.map +1 -1
  109. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
  110. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  111. package/lib/module/shared/index.js +1 -1
  112. package/lib/module/shared/index.js.map +1 -1
  113. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
  114. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  115. package/lib/module/shared/providers/register-bounds.provider.js +9 -1
  116. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  117. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  118. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  119. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  120. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  121. package/lib/module/shared/providers/screen/styles/styles.provider.js +1 -11
  122. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
  123. package/lib/module/shared/stores/animation.store.js +9 -3
  124. package/lib/module/shared/stores/animation.store.js.map +1 -1
  125. package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
  126. package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
  127. package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
  128. package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
  129. package/lib/module/shared/stores/bounds/internals/registry.js +19 -8
  130. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  131. package/lib/module/shared/stores/bounds/internals/resolver.js +8 -52
  132. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  133. package/lib/module/shared/stores/bounds/internals/state.js +0 -78
  134. package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
  135. package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
  136. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  137. package/lib/module/shared/utils/bounds/constants.js.map +1 -0
  138. package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
  139. package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
  140. package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
  141. package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
  142. package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
  143. package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
  144. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
  145. package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
  146. package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
  147. package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
  148. package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +12 -18
  149. package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
  150. package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
  151. package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
  152. package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
  153. package/lib/module/shared/utils/bounds/index.js +14 -42
  154. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  155. package/lib/module/shared/utils/bounds/zoom/build.js +238 -54
  156. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  157. package/lib/module/shared/utils/bounds/zoom/config.js +9 -0
  158. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  159. package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
  160. package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
  161. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
  162. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
  163. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  164. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +17 -11
  165. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  166. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
  167. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
  168. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +1 -2
  169. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  170. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +20 -1
  171. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  172. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts +12 -0
  173. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
  174. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +10 -4
  175. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  176. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
  177. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  178. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  179. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  180. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  181. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  182. package/lib/typescript/shared/constants.d.ts +33 -1
  183. package/lib/typescript/shared/constants.d.ts.map +1 -1
  184. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
  185. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
  186. package/lib/typescript/shared/index.d.ts +3 -3
  187. package/lib/typescript/shared/index.d.ts.map +1 -1
  188. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  189. package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
  190. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  191. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
  192. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
  193. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
  194. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  195. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
  196. package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
  197. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  198. package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
  199. package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
  200. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  201. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  202. package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
  203. package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
  204. package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
  205. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  206. package/lib/typescript/shared/types/animation.types.d.ts +11 -0
  207. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  208. package/lib/typescript/shared/types/bounds.types.d.ts +106 -1
  209. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  210. package/lib/typescript/shared/types/index.d.ts +1 -1
  211. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  212. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
  213. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  214. package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
  215. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
  216. package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
  217. package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
  218. package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
  219. package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
  220. package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
  221. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
  222. package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
  223. package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
  224. package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
  225. package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
  226. package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
  227. package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
  228. package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
  229. package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
  230. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  231. package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
  232. package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
  233. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  234. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +9 -0
  235. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  236. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
  237. package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
  238. package/package.json +1 -1
  239. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +6 -4
  240. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +28 -60
  241. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
  242. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +72 -53
  243. package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
  244. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +5 -34
  245. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +180 -6
  246. package/src/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.ts +110 -0
  247. package/src/shared/components/create-boundary-component/index.tsx +10 -5
  248. package/src/shared/components/create-boundary-component/types.ts +1 -2
  249. package/src/shared/components/create-transition-aware-component.tsx +10 -47
  250. package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
  251. package/src/shared/components/screen-container/layers/backdrop.tsx +6 -9
  252. package/src/shared/components/screen-lifecycle/index.tsx +1 -4
  253. package/src/shared/constants.ts +11 -1
  254. package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
  255. package/src/shared/index.ts +3 -0
  256. package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
  257. package/src/shared/providers/register-bounds.provider.tsx +8 -1
  258. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
  259. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
  260. package/src/shared/providers/screen/styles/styles.provider.tsx +1 -12
  261. package/src/shared/stores/animation.store.ts +11 -2
  262. package/src/shared/stores/bounds/internals/clear.ts +47 -220
  263. package/src/shared/stores/bounds/internals/presence.ts +1 -4
  264. package/src/shared/stores/bounds/internals/registry.ts +25 -14
  265. package/src/shared/stores/bounds/internals/resolver.ts +7 -84
  266. package/src/shared/stores/bounds/internals/state.ts +0 -98
  267. package/src/shared/stores/bounds/types.ts +0 -2
  268. package/src/shared/types/animation.types.ts +13 -0
  269. package/src/shared/types/bounds.types.ts +108 -1
  270. package/src/shared/types/index.ts +2 -0
  271. package/src/shared/utils/animation/animate-to-progress.ts +11 -1
  272. package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
  273. package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
  274. package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
  275. package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
  276. package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
  277. package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +10 -20
  278. package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
  279. package/src/shared/utils/bounds/index.ts +13 -53
  280. package/src/shared/utils/bounds/types/options.ts +3 -2
  281. package/src/shared/utils/bounds/zoom/build.ts +316 -95
  282. package/src/shared/utils/bounds/zoom/config.ts +11 -0
  283. package/src/shared/utils/bounds/zoom/math.ts +57 -0
  284. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
  285. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  286. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
  287. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  288. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
  289. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  290. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
  291. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  292. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -58
  293. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  294. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
  295. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  296. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
  297. package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  298. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  299. package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
  300. package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  301. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
  302. package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  303. package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  304. package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  305. package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  306. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  307. package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
  308. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
  309. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  310. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
  311. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  312. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
  313. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  314. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
  315. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  316. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -53
  317. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  318. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
  319. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  320. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
  321. package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
  322. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
  323. package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
  324. package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
  325. package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
  326. package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
  327. package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
  328. package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
  329. package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
  330. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
  331. package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
  332. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
  333. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
  334. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
  335. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
  336. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
  337. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
  338. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
  339. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
  340. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -11
  341. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
  342. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
  343. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
  344. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
  345. package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
  346. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
  347. package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
  348. package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
  349. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
  350. package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
  351. package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
  352. package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
  353. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
  354. package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
  355. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
  356. package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
  357. package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
  358. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
  359. package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
  360. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
  361. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -87
  362. package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
  363. package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
  364. package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
  365. /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  366. /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  367. /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
  368. /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
  369. /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
  370. /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
  371. /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
  372. /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
@@ -10,7 +10,6 @@ export type MeasurementIntentFlags = {
10
10
  completeDestination: boolean;
11
11
  refreshSource: boolean;
12
12
  refreshDestination: boolean;
13
- snapshotOnly: boolean;
14
13
  };
15
14
 
16
15
  export type MeasurementWritePlan = {
@@ -18,7 +17,6 @@ export type MeasurementWritePlan = {
18
17
  completeDestination: boolean;
19
18
  refreshSource: boolean;
20
19
  refreshDestination: boolean;
21
- registerSnapshot: boolean;
22
20
  writesAny: boolean;
23
21
  wantsDestinationWrite: boolean;
24
22
  };
@@ -37,7 +35,6 @@ export const getMeasurementIntentFlags = (
37
35
  completeDestination: false,
38
36
  refreshSource: false,
39
37
  refreshDestination: false,
40
- snapshotOnly: false,
41
38
  };
42
39
 
43
40
  if (!intent) {
@@ -60,9 +57,6 @@ export const getMeasurementIntentFlags = (
60
57
  case "refresh-destination":
61
58
  flags.refreshDestination = true;
62
59
  break;
63
- case "snapshot-only":
64
- flags.snapshotOnly = true;
65
- break;
66
60
  }
67
61
  }
68
62
 
@@ -74,68 +68,99 @@ export const resolveMeasurementWritePlan = (params: {
74
68
  hasPendingLink: boolean;
75
69
  hasSourceLink: boolean;
76
70
  hasDestinationLink: boolean;
71
+ hasAttachableSourceLink: boolean;
77
72
  }): MeasurementWritePlan => {
78
73
  "worklet";
79
- const { intents, hasPendingLink, hasSourceLink, hasDestinationLink } = params;
74
+ const {
75
+ intents,
76
+ hasPendingLink,
77
+ hasSourceLink,
78
+ hasDestinationLink,
79
+ hasAttachableSourceLink,
80
+ } = params;
80
81
 
81
82
  const captureSource = intents.captureSource;
82
- const completeDestination = intents.completeDestination && hasPendingLink;
83
+ const completeDestination =
84
+ intents.completeDestination && (hasPendingLink || hasAttachableSourceLink);
83
85
  const refreshSource = intents.refreshSource && hasSourceLink;
84
86
  const refreshDestination =
85
- intents.refreshDestination && (hasDestinationLink || hasPendingLink);
86
- const registerSnapshot = intents.snapshotOnly || intents.refreshSource;
87
+ intents.refreshDestination &&
88
+ (hasDestinationLink || hasPendingLink || hasAttachableSourceLink);
87
89
  const writesAny =
88
- registerSnapshot ||
89
- captureSource ||
90
- completeDestination ||
91
- refreshSource ||
92
- refreshDestination;
90
+ captureSource || completeDestination || refreshSource || refreshDestination;
93
91
 
94
92
  return {
95
93
  captureSource,
96
94
  completeDestination,
97
95
  refreshSource,
98
96
  refreshDestination,
99
- registerSnapshot,
100
97
  writesAny,
101
98
  wantsDestinationWrite: completeDestination || refreshDestination,
102
99
  };
103
100
  };
104
101
 
102
+ /**
103
+ * Temporarily removed destination-match gating for auto source capture.
104
+ *
105
+ * For now, any enabled boundary on a source screen will eagerly capture when a
106
+ * next screen exists, even if no matching destination boundary has registered
107
+ * presence yet. The previous behavior waited for an explicit destination match
108
+ * before allowing source capture.
109
+ */
105
110
  export const resolveAutoSourceCaptureSignal = (params: {
106
111
  enabled: boolean;
107
112
  nextScreenKey?: string;
108
113
  tagPresence?: Record<string, PresenceLikeEntry>;
109
114
  }): string | 0 => {
110
115
  "worklet";
111
- const { enabled, nextScreenKey, tagPresence } = params;
116
+ const { enabled, nextScreenKey } = params;
112
117
  if (!enabled) return 0;
113
118
  if (!nextScreenKey) return 0;
114
- if (!tagPresence) return 0;
115
119
 
116
- const direct = tagPresence[nextScreenKey];
117
- if (direct && direct.count > 0) return nextScreenKey;
120
+ /**
121
+ * Temporarily removed destination-match gating for auto source capture.
122
+ *
123
+ * For now, any enabled boundary on a source screen will eagerly capture when
124
+ * a next screen exists, even if no matching destination boundary has
125
+ * registered presence yet. The previous behavior waited for an explicit
126
+ * destination match before allowing source capture.
127
+ */
128
+ // const tagPresence = params.tagPresence;
129
+ // if (!tagPresence) return 0;
130
+ //
131
+ // const direct = tagPresence[nextScreenKey];
132
+ // if (direct && direct.count > 0) return nextScreenKey;
133
+ //
134
+ // for (const screenKey in tagPresence) {
135
+ // const entry = tagPresence[screenKey];
136
+ // if (entry.ancestorKeys?.includes(nextScreenKey)) {
137
+ // return nextScreenKey;
138
+ // }
139
+ // }
140
+ //
141
+ // return 0;
118
142
 
119
- for (const screenKey in tagPresence) {
120
- const entry = tagPresence[screenKey];
121
- if (entry.ancestorKeys?.includes(nextScreenKey)) {
122
- return nextScreenKey;
123
- }
124
- }
125
-
126
- return 0;
143
+ return nextScreenKey;
127
144
  };
128
145
 
129
146
  export const resolvePendingDestinationCaptureSignal = (params: {
130
147
  enabled: boolean;
131
148
  resolvedSourceKey?: string | null;
132
- hasPendingLinkFromSource: boolean;
149
+ hasAttachableSourceLink: boolean;
150
+ hasDestinationLink: boolean;
133
151
  }): string | 0 => {
134
152
  "worklet";
135
- const { enabled, resolvedSourceKey, hasPendingLinkFromSource } = params;
153
+ const {
154
+ enabled,
155
+ resolvedSourceKey,
156
+ hasAttachableSourceLink,
157
+ hasDestinationLink,
158
+ } = params;
136
159
  if (!enabled) return 0;
137
160
  if (!resolvedSourceKey) return 0;
138
- return hasPendingLinkFromSource ? resolvedSourceKey : 0;
161
+ if (!hasAttachableSourceLink) return 0;
162
+ if (hasDestinationLink) return 0;
163
+ return resolvedSourceKey;
139
164
  };
140
165
 
141
166
  export const resolvePendingDestinationRetrySignal = (params: {
@@ -148,7 +173,7 @@ export const resolvePendingDestinationRetrySignal = (params: {
148
173
  retryProgressMax: number;
149
174
  retryProgressBuckets: number;
150
175
  resolvedSourceKey?: string | null;
151
- hasPendingLinkFromSource: boolean;
176
+ hasAttachableSourceLink: boolean;
152
177
  }): number => {
153
178
  "worklet";
154
179
  const {
@@ -161,7 +186,7 @@ export const resolvePendingDestinationRetrySignal = (params: {
161
186
  retryProgressMax,
162
187
  retryProgressBuckets,
163
188
  resolvedSourceKey,
164
- hasPendingLinkFromSource,
189
+ hasAttachableSourceLink,
165
190
  } = params;
166
191
 
167
192
  if (!enabled) return 0;
@@ -170,34 +195,28 @@ export const resolvePendingDestinationRetrySignal = (params: {
170
195
  if (hasDestinationLink) return 0;
171
196
  if (progress <= 0 || progress >= retryProgressMax) return 0;
172
197
  if (!resolvedSourceKey) return 0;
173
- if (!hasPendingLinkFromSource) return 0;
198
+ if (!hasAttachableSourceLink) return 0;
174
199
 
175
200
  return Math.floor(progress * retryProgressBuckets) + 1;
176
201
  };
177
202
 
178
- export const resolveInitialLayoutMeasurementIntent = (params: {
179
- enabled: boolean;
180
- hasSharedBoundTag: boolean;
181
- hasMeasuredOnLayout: boolean;
182
- isAnyAnimating: boolean;
183
- hasPendingLinkFromSource: boolean;
184
- }): MeasurementIntent | readonly MeasurementIntent[] | null => {
203
+ export const resolvePrepareSourceMeasurementIntent = (params: {
204
+ hasSourceLink: boolean;
205
+ shouldRefreshExistingSource: boolean;
206
+ }): MeasurementIntent | null => {
185
207
  "worklet";
186
- const {
187
- enabled,
188
- hasSharedBoundTag,
189
- hasMeasuredOnLayout,
190
- isAnyAnimating,
191
- hasPendingLinkFromSource,
192
- } = params;
193
-
194
- if (!enabled) return null;
195
- if (!hasSharedBoundTag || hasMeasuredOnLayout) return null;
196
- if (!isAnyAnimating) return null;
208
+ if (!params.hasSourceLink) {
209
+ return "capture-source";
210
+ }
197
211
 
198
- return hasPendingLinkFromSource ? "complete-destination" : null;
212
+ return params.shouldRefreshExistingSource ? "refresh-source" : null;
199
213
  };
200
214
 
215
+ export const PREPARE_DESTINATION_MEASUREMENT_INTENT = [
216
+ "complete-destination",
217
+ "refresh-destination",
218
+ ] as const satisfies readonly MeasurementIntent[];
219
+
201
220
  export const resolveGroupActiveMeasurementAction = (params: {
202
221
  enabled: boolean;
203
222
  isEligible: boolean;
@@ -1,16 +1,24 @@
1
1
  import { useAnimatedReaction } from "react-native-reanimated";
2
2
  import { BoundStore } from "../../../stores/bounds";
3
- import type { MaybeMeasureAndStoreParams } from "../types";
3
+ import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
4
4
  import { resolveAutoSourceCaptureSignal } from "./helpers/measurement-rules";
5
5
 
6
6
  export const useAutoSourceMeasurement = (params: {
7
7
  enabled: boolean;
8
8
  sharedBoundTag: string;
9
+ id: BoundaryId;
10
+ group?: string;
9
11
  nextScreenKey?: string;
10
12
  maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
11
13
  }) => {
12
- const { enabled, sharedBoundTag, nextScreenKey, maybeMeasureAndStore } =
13
- params;
14
+ const {
15
+ enabled,
16
+ sharedBoundTag,
17
+ id,
18
+ group,
19
+ nextScreenKey,
20
+ maybeMeasureAndStore,
21
+ } = params;
14
22
  const boundaryPresence = BoundStore.getBoundaryPresence();
15
23
 
16
24
  useAnimatedReaction(
@@ -27,10 +35,18 @@ export const useAutoSourceMeasurement = (params: {
27
35
  if (!enabled) return;
28
36
  if (!nextScreenKey) return;
29
37
  if (!captureSignal || captureSignal === previousCaptureSignal) return;
38
+ const currentGroupActiveId = group
39
+ ? BoundStore.getGroupActiveId(group)
40
+ : null;
41
+ if (group && currentGroupActiveId !== String(id)) {
42
+ return;
43
+ }
30
44
  maybeMeasureAndStore({ intent: "capture-source" });
31
45
  },
32
46
  [
33
47
  enabled,
48
+ id,
49
+ group,
34
50
  nextScreenKey,
35
51
  sharedBoundTag,
36
52
  boundaryPresence,
@@ -3,7 +3,6 @@ import {
3
3
  type AnimatedRef,
4
4
  type MeasuredDimensions,
5
5
  measure,
6
- type SharedValue,
7
6
  type StyleProps,
8
7
  } from "react-native-reanimated";
9
8
  import useStableCallbackValue from "../../../hooks/use-stable-callback-value";
@@ -43,7 +42,6 @@ export const useBoundaryMeasureAndStore = (params: {
43
42
  ancestorKeys: string[];
44
43
  navigatorKey?: string;
45
44
  ancestorNavigatorKeys?: string[];
46
- isAnimating: SharedValue<number>;
47
45
  preparedStyles: StyleProps;
48
46
  measuredAnimatedRef: AnimatedRef<View>;
49
47
  }) => {
@@ -55,7 +53,6 @@ export const useBoundaryMeasureAndStore = (params: {
55
53
  ancestorKeys,
56
54
  navigatorKey,
57
55
  ancestorNavigatorKeys,
58
- isAnimating,
59
56
  preparedStyles,
60
57
  measuredAnimatedRef,
61
58
  } = params;
@@ -73,36 +70,15 @@ export const useBoundaryMeasureAndStore = (params: {
73
70
  resolvePendingSourceKey(sharedBoundTag, preferredSourceScreenKey) ||
74
71
  undefined;
75
72
 
76
- if (intents.captureSource && isAnimating.get()) {
77
- const existing = BoundStore.getSnapshot(
78
- sharedBoundTag,
79
- currentScreenKey,
80
- );
81
- if (existing) {
82
- applyMeasuredBoundsWrites({
83
- sharedBoundTag,
84
- ancestorKeys,
85
- navigatorKey,
86
- ancestorNavigatorKeys,
87
- currentScreenKey,
88
- measured: existing.bounds,
89
- preparedStyles,
90
- shouldSetSource: true,
91
- });
92
- return;
93
- }
94
-
95
- // No cached snapshot while animating.
96
- // Fall through to a live measurement so rapid retargeting still
97
- // captures a valid source link.
98
- }
99
-
100
73
  const hasPendingLink = expectedSourceScreenKey
101
74
  ? BoundStore.hasPendingLinkFromSource(
102
75
  sharedBoundTag,
103
76
  expectedSourceScreenKey,
104
77
  )
105
78
  : BoundStore.hasPendingLink(sharedBoundTag);
79
+ const hasAttachableSourceLink = expectedSourceScreenKey
80
+ ? BoundStore.hasSourceLink(sharedBoundTag, expectedSourceScreenKey)
81
+ : false;
106
82
  const hasSourceLink = BoundStore.hasSourceLink(
107
83
  sharedBoundTag,
108
84
  currentScreenKey,
@@ -117,6 +93,7 @@ export const useBoundaryMeasureAndStore = (params: {
117
93
  hasPendingLink,
118
94
  hasSourceLink,
119
95
  hasDestinationLink,
96
+ hasAttachableSourceLink,
120
97
  });
121
98
 
122
99
  if (!writePlan.writesAny) {
@@ -151,13 +128,7 @@ export const useBoundaryMeasureAndStore = (params: {
151
128
  const hasSnapshotChanged =
152
129
  !existingSnapshot ||
153
130
  !areMeasurementsEqual(existingSnapshot.bounds, correctedMeasured);
154
- const shouldWriteSnapshot =
155
- hasSnapshotChanged &&
156
- (writePlan.registerSnapshot ||
157
- writePlan.captureSource ||
158
- writePlan.completeDestination ||
159
- writePlan.refreshSource ||
160
- writePlan.refreshDestination);
131
+ const shouldWriteSnapshot = hasSnapshotChanged;
161
132
 
162
133
  applyMeasuredBoundsWrites({
163
134
  sharedBoundTag,
@@ -1,25 +1,127 @@
1
- import { useAnimatedReaction } from "react-native-reanimated";
1
+ import { useLayoutEffect } from "react";
2
+ import {
3
+ runOnUI,
4
+ type SharedValue,
5
+ useAnimatedReaction,
6
+ useSharedValue,
7
+ } from "react-native-reanimated";
8
+ import { AnimationStore } from "../../../stores/animation.store";
2
9
  import { BoundStore } from "../../../stores/bounds";
3
10
  import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
4
- import type { MaybeMeasureAndStoreParams } from "../types";
5
- import { resolvePendingDestinationCaptureSignal } from "./helpers/measurement-rules";
11
+ import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
12
+ import {
13
+ resolvePendingDestinationCaptureSignal,
14
+ resolvePendingDestinationRetrySignal,
15
+ } from "./helpers/measurement-rules";
6
16
 
17
+ /**
18
+ * The current v3.4 behavior intentionally favors correctness over efficiency:
19
+ * when destination layout races transition start, this hook may re-measure
20
+ * multiple times to recover a usable pair for `navigation.zoom()`.
21
+ *
22
+ * This works well enough for now, but it is not the ideal architecture. A more
23
+ * complete v4 solution should allow open-animation deferral and broader
24
+ * readiness coordination so we can avoid repeated measurement work while still
25
+ * handling multiple transition scenarios correctly. Until that system exists,
26
+ * `navigation.zoom()` remains fast in practice, just not as performant as it
27
+ * could be.
28
+ *
29
+ * For now, you may notice a slight stutter towards the end of the animation.
30
+ */
7
31
  export const usePendingDestinationMeasurement = (params: {
8
32
  sharedBoundTag: string;
9
33
  enabled: boolean;
34
+ id: BoundaryId;
35
+ group?: string;
36
+ currentScreenKey: string;
10
37
  expectedSourceScreenKey?: string;
38
+ animating: SharedValue<number>;
11
39
  maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
12
40
  }) => {
13
41
  const {
14
42
  sharedBoundTag,
15
43
  enabled,
44
+ id,
45
+ group,
46
+ currentScreenKey,
16
47
  expectedSourceScreenKey,
48
+ animating,
17
49
  maybeMeasureAndStore,
18
50
  } = params;
19
51
 
52
+ const progress = AnimationStore.getValue(currentScreenKey, "progress");
53
+ const closing = AnimationStore.getValue(currentScreenKey, "closing");
54
+
55
+ const retryCount = useSharedValue(0);
56
+ const MAX_RETRIES = 4;
57
+ const RETRY_PROGRESS_BUCKETS = 8;
58
+ const RETRY_PROGRESS_MAX = 1.05;
59
+
60
+ useLayoutEffect(() => {
61
+ if (!enabled) return;
62
+
63
+ runOnUI(() => {
64
+ "worklet";
65
+ if (closing.get()) {
66
+ return;
67
+ }
68
+
69
+ const currentGroupActiveId = group
70
+ ? BoundStore.getGroupActiveId(group)
71
+ : null;
72
+ if (group && currentGroupActiveId !== String(id)) {
73
+ return;
74
+ }
75
+
76
+ const resolvedSourceKey = resolvePendingSourceKey(
77
+ sharedBoundTag,
78
+ expectedSourceScreenKey,
79
+ );
80
+ const hasAttachableSourceLink = resolvedSourceKey
81
+ ? BoundStore.hasPendingLinkFromSource(
82
+ sharedBoundTag,
83
+ resolvedSourceKey,
84
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
85
+ : false;
86
+
87
+ if (!hasAttachableSourceLink) {
88
+ return;
89
+ }
90
+
91
+ if (BoundStore.hasDestinationLink(sharedBoundTag, currentScreenKey)) {
92
+ return;
93
+ }
94
+
95
+ maybeMeasureAndStore({ intent: "complete-destination" });
96
+ })();
97
+ }, [
98
+ enabled,
99
+ id,
100
+ group,
101
+ sharedBoundTag,
102
+ currentScreenKey,
103
+ expectedSourceScreenKey,
104
+ closing,
105
+ maybeMeasureAndStore,
106
+ ]);
107
+
108
+ /**
109
+ * This exessive retry for groups with {target:"bound"} will have to change in v4.
110
+ * .navigation.zoom() is stable and works great for non groups and groups that are non {target: "bound"}.
111
+ *
112
+ * The retry logic is needed for dst screen when we do an initialScrollIndex, the system is competing with the (i assume) useLayoutEffect
113
+ * in the scrollable, causing a race here and giving us wrong measurements. I believe, in simialr fashion to how
114
+ * system.store defers the screen from animating, we could possibly do the same here. Registering it up, once we get valid measurements, we can
115
+ * un defer? Is that the word? Undefer the screen, removing this block compeltely, avoiding any potential flickers ( which currently happens.)
116
+ *
117
+ * You can replicate this bug by dismissing dst, as dst reaches its ending tail (0.01->0.10), if we tap again, we notice a flicker.
118
+ */
20
119
  useAnimatedReaction(
21
120
  () => {
22
121
  "worklet";
122
+ if (closing.get()) {
123
+ return 0;
124
+ }
23
125
  const resolvedSourceKey = resolvePendingSourceKey(
24
126
  sharedBoundTag,
25
127
  expectedSourceScreenKey,
@@ -27,12 +129,16 @@ export const usePendingDestinationMeasurement = (params: {
27
129
  return resolvePendingDestinationCaptureSignal({
28
130
  enabled,
29
131
  resolvedSourceKey,
30
- hasPendingLinkFromSource: resolvedSourceKey
132
+ hasAttachableSourceLink: resolvedSourceKey
31
133
  ? BoundStore.hasPendingLinkFromSource(
32
134
  sharedBoundTag,
33
135
  resolvedSourceKey,
34
- )
136
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
35
137
  : false,
138
+ hasDestinationLink: BoundStore.hasDestinationLink(
139
+ sharedBoundTag,
140
+ currentScreenKey,
141
+ ),
36
142
  });
37
143
  },
38
144
  (captureSignal, previousCaptureSignal) => {
@@ -42,8 +148,76 @@ export const usePendingDestinationMeasurement = (params: {
42
148
  return;
43
149
  }
44
150
 
151
+ const currentGroupActiveId = group
152
+ ? BoundStore.getGroupActiveId(group)
153
+ : null;
154
+
155
+ if (group && currentGroupActiveId !== String(id)) {
156
+ return;
157
+ }
158
+
159
+ maybeMeasureAndStore({ intent: "complete-destination" });
160
+ },
161
+ [
162
+ enabled,
163
+ id,
164
+ group,
165
+ sharedBoundTag,
166
+ expectedSourceScreenKey,
167
+ closing,
168
+ maybeMeasureAndStore,
169
+ ],
170
+ );
171
+
172
+ useAnimatedReaction(
173
+ () => {
174
+ "worklet";
175
+ if (closing.get()) {
176
+ return 0;
177
+ }
178
+ const resolvedSourceKey = resolvePendingSourceKey(
179
+ sharedBoundTag,
180
+ expectedSourceScreenKey,
181
+ );
182
+ return resolvePendingDestinationRetrySignal({
183
+ enabled,
184
+ retryCount: retryCount.get(),
185
+ maxRetries: MAX_RETRIES,
186
+ isAnimating: !!animating.get(),
187
+ hasDestinationLink: BoundStore.hasDestinationLink(
188
+ sharedBoundTag,
189
+ currentScreenKey,
190
+ ),
191
+ progress: progress.get(),
192
+ retryProgressMax: RETRY_PROGRESS_MAX,
193
+ retryProgressBuckets: RETRY_PROGRESS_BUCKETS,
194
+ resolvedSourceKey,
195
+ hasAttachableSourceLink: resolvedSourceKey
196
+ ? BoundStore.hasPendingLinkFromSource(
197
+ sharedBoundTag,
198
+ resolvedSourceKey,
199
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
200
+ : false,
201
+ });
202
+ },
203
+ (captureSignal) => {
204
+ "worklet";
205
+ // if (!group) return;
206
+ if (!enabled) return;
207
+ if (!captureSignal) {
208
+ retryCount.set(0);
209
+ return;
210
+ }
211
+ const currentGroupActiveId = group
212
+ ? BoundStore.getGroupActiveId(group)
213
+ : null;
214
+ if (group && currentGroupActiveId !== String(id)) {
215
+ return;
216
+ }
217
+
218
+ if (retryCount.get() >= MAX_RETRIES) return;
219
+ retryCount.set(retryCount.get() + 1);
45
220
  maybeMeasureAndStore({ intent: "complete-destination" });
46
221
  },
47
- [enabled, sharedBoundTag, expectedSourceScreenKey, maybeMeasureAndStore],
48
222
  );
49
223
  };
@@ -0,0 +1,110 @@
1
+ import { useAnimatedReaction } from "react-native-reanimated";
2
+ import { AnimationStore } from "../../../stores/animation.store";
3
+ import { BoundStore } from "../../../stores/bounds";
4
+ import { GestureStore } from "../../../stores/gesture.store";
5
+ import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
6
+ import {
7
+ PREPARE_DESTINATION_MEASUREMENT_INTENT,
8
+ resolvePrepareSourceMeasurementIntent,
9
+ } from "./helpers/measurement-rules";
10
+
11
+ export const usePreTransitionMeasurement = (params: {
12
+ enabled: boolean;
13
+ sharedBoundTag: string;
14
+ id: BoundaryId;
15
+ group?: string;
16
+ currentScreenKey: string;
17
+ nextScreenKey?: string;
18
+ hasNextScreen: boolean;
19
+ maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
20
+ }) => {
21
+ const {
22
+ enabled,
23
+ sharedBoundTag,
24
+ id,
25
+ group,
26
+ currentScreenKey,
27
+ nextScreenKey,
28
+ hasNextScreen,
29
+ maybeMeasureAndStore,
30
+ } = params;
31
+
32
+ const currentWillAnimate = AnimationStore.getValue(
33
+ currentScreenKey,
34
+ "willAnimate",
35
+ );
36
+ const currentAnimating = AnimationStore.getValue(
37
+ currentScreenKey,
38
+ "animating",
39
+ );
40
+ const currentDragging = GestureStore.getValue(currentScreenKey, "dragging");
41
+ const nextWillAnimate = nextScreenKey
42
+ ? AnimationStore.getValue(nextScreenKey, "willAnimate")
43
+ : null;
44
+ const nextAnimating = nextScreenKey
45
+ ? AnimationStore.getValue(nextScreenKey, "animating")
46
+ : null;
47
+ const nextDragging = nextScreenKey
48
+ ? GestureStore.getValue(nextScreenKey, "dragging")
49
+ : null;
50
+
51
+ useAnimatedReaction(
52
+ () => (hasNextScreen ? (nextWillAnimate?.get() ?? 0) : 0),
53
+ (nextValue, previousValue) => {
54
+ "worklet";
55
+ if (!enabled || !hasNextScreen) return;
56
+ if (nextValue === 0 || nextValue === previousValue) return;
57
+
58
+ const currentGroupActiveId = group
59
+ ? BoundStore.getGroupActiveId(group)
60
+ : null;
61
+
62
+ if (group && currentGroupActiveId !== String(id)) {
63
+ return;
64
+ }
65
+
66
+ const shouldCancelMeasurement =
67
+ !!nextAnimating?.get() && !!nextDragging?.get();
68
+ if (shouldCancelMeasurement) {
69
+ return;
70
+ }
71
+
72
+ const hasSourceLink = BoundStore.hasSourceLink(
73
+ sharedBoundTag,
74
+ currentScreenKey,
75
+ );
76
+
77
+ const intent = resolvePrepareSourceMeasurementIntent({
78
+ hasSourceLink,
79
+ shouldRefreshExistingSource: !!group,
80
+ });
81
+
82
+ if (!intent) {
83
+ return;
84
+ }
85
+
86
+ maybeMeasureAndStore({ intent });
87
+ },
88
+ );
89
+
90
+ useAnimatedReaction(
91
+ () => (!hasNextScreen ? currentWillAnimate.get() : 0),
92
+ (nextValue, previousValue) => {
93
+ "worklet";
94
+ if (!enabled || hasNextScreen) return;
95
+ if (nextValue === 0 || nextValue === previousValue) return;
96
+ const currentGroupActiveId = group
97
+ ? BoundStore.getGroupActiveId(group)
98
+ : null;
99
+ if (group && currentGroupActiveId !== String(id)) return;
100
+
101
+ const shouldCancelMeasurement =
102
+ !!currentAnimating.get() && !!currentDragging.get();
103
+ if (shouldCancelMeasurement) return;
104
+
105
+ maybeMeasureAndStore({
106
+ intent: PREPARE_DESTINATION_MEASUREMENT_INTENT,
107
+ });
108
+ },
109
+ );
110
+ };