react-native-screen-transitions 3.4.0-alpha.6 → 3.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/README.md +136 -46
  2. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
  3. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  4. package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +1 -1
  5. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +41 -0
  6. package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
  7. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +193 -0
  8. package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
  9. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  10. package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  11. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +53 -43
  12. package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  13. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  14. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  15. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +8 -26
  16. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  17. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +84 -2
  18. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  19. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +67 -0
  20. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
  21. package/lib/commonjs/shared/components/create-boundary-component/index.js +27 -216
  22. package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
  23. package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js +63 -0
  24. package/lib/commonjs/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
  25. package/lib/commonjs/shared/components/create-transition-aware-component.js +37 -39
  26. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  27. package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +1 -1
  28. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  29. package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  30. package/lib/commonjs/shared/components/screen-container/index.js +8 -12
  31. package/lib/commonjs/shared/components/screen-container/index.js.map +1 -1
  32. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +11 -9
  33. package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
  34. package/lib/commonjs/shared/components/screen-container/layers/content.js +4 -4
  35. package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
  36. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
  37. package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  38. package/lib/commonjs/shared/components/screen-container/layers/surface-container.js +4 -4
  39. package/lib/commonjs/shared/components/screen-container/layers/surface-container.js.map +1 -1
  40. package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
  41. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  42. package/lib/commonjs/shared/constants.js +18 -2
  43. package/lib/commonjs/shared/constants.js.map +1 -1
  44. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
  45. package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  46. package/lib/commonjs/shared/index.js +6 -0
  47. package/lib/commonjs/shared/index.js.map +1 -1
  48. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
  49. package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  50. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  51. package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  52. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  53. package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  54. package/lib/commonjs/shared/providers/screen/screen-composer.js +1 -1
  55. package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
  56. package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js +144 -0
  57. package/lib/commonjs/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
  58. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +28 -0
  59. package/lib/commonjs/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
  60. package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +39 -0
  61. package/lib/commonjs/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
  62. package/lib/commonjs/shared/providers/screen/styles/index.js +25 -0
  63. package/lib/commonjs/shared/providers/screen/styles/index.js.map +1 -0
  64. package/lib/commonjs/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +37 -39
  65. package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -0
  66. package/lib/commonjs/shared/stores/animation.store.js +9 -3
  67. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  68. package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -2
  69. package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
  70. package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -48
  71. package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
  72. package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
  73. package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
  74. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +6 -12
  75. package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  76. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js +21 -10
  77. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -1
  78. package/lib/commonjs/shared/utils/bounds/zoom/build.js +158 -52
  79. package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
  80. package/lib/commonjs/shared/utils/bounds/zoom/config.js +3 -1
  81. package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
  82. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +27 -45
  83. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  84. package/lib/module/component-stack/navigators/create-component-stack-navigator.js +1 -1
  85. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +36 -0
  86. package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -0
  87. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +188 -0
  88. package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -0
  89. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
  90. package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
  91. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +51 -41
  92. package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
  93. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
  94. package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
  95. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +8 -26
  96. package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
  97. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +86 -4
  98. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
  99. package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js +62 -0
  100. package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +1 -0
  101. package/lib/module/shared/components/create-boundary-component/index.js +23 -215
  102. package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
  103. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js +56 -0
  104. package/lib/module/shared/components/create-boundary-component/providers/boundary-owner.provider.js.map +1 -0
  105. package/lib/module/shared/components/create-transition-aware-component.js +39 -41
  106. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  107. package/lib/module/shared/components/overlay/variations/float-overlay.js +1 -1
  108. package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -1
  109. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
  110. package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
  111. package/lib/module/shared/components/screen-container/index.js +8 -12
  112. package/lib/module/shared/components/screen-container/index.js.map +1 -1
  113. package/lib/module/shared/components/screen-container/layers/backdrop.js +11 -9
  114. package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
  115. package/lib/module/shared/components/screen-container/layers/content.js +4 -4
  116. package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
  117. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +4 -4
  118. package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
  119. package/lib/module/shared/components/screen-container/layers/surface-container.js +4 -4
  120. package/lib/module/shared/components/screen-container/layers/surface-container.js.map +1 -1
  121. package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
  122. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  123. package/lib/module/shared/constants.js +17 -1
  124. package/lib/module/shared/constants.js.map +1 -1
  125. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
  126. package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
  127. package/lib/module/shared/index.js +1 -1
  128. package/lib/module/shared/index.js.map +1 -1
  129. package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
  130. package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
  131. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
  132. package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
  133. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
  134. package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
  135. package/lib/module/shared/providers/screen/screen-composer.js +1 -1
  136. package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
  137. package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js +139 -0
  138. package/lib/module/shared/providers/screen/styles/helpers/build-resolved-style-map.js.map +1 -0
  139. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js +23 -0
  140. package/lib/module/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.js.map +1 -0
  141. package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js +34 -0
  142. package/lib/module/shared/providers/screen/styles/helpers/split-normalized-style-maps.js.map +1 -0
  143. package/lib/module/shared/providers/screen/styles/index.js +4 -0
  144. package/lib/module/shared/providers/screen/styles/index.js.map +1 -0
  145. package/lib/module/shared/providers/screen/{styles.provider.js → styles/styles.provider.js} +38 -40
  146. package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -0
  147. package/lib/module/shared/stores/animation.store.js +9 -3
  148. package/lib/module/shared/stores/animation.store.js.map +1 -1
  149. package/lib/module/shared/stores/bounds/internals/registry.js +18 -2
  150. package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
  151. package/lib/module/shared/stores/bounds/internals/resolver.js +7 -48
  152. package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
  153. package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
  154. package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
  155. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +7 -13
  156. package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
  157. package/lib/module/shared/utils/bounds/helpers/style-composers.js +21 -10
  158. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -1
  159. package/lib/module/shared/utils/bounds/zoom/build.js +159 -52
  160. package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
  161. package/lib/module/shared/utils/bounds/zoom/config.js +2 -0
  162. package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
  163. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +9 -15
  164. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
  165. package/lib/typescript/blank-stack/types.d.ts +6 -4
  166. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  167. package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -1
  168. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts +209 -0
  169. package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -0
  170. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts +8 -0
  171. package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -0
  172. package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
  173. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +16 -11
  174. package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
  175. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
  176. package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
  177. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +2 -9
  178. package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
  179. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +6 -1
  180. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
  181. package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts +12 -0
  182. package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +1 -0
  183. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +224 -14
  184. package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
  185. package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts +35 -0
  186. package/lib/typescript/shared/components/create-boundary-component/providers/boundary-owner.provider.d.ts.map +1 -0
  187. package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
  188. package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
  189. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  190. package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
  191. package/lib/typescript/shared/components/screen-container/index.d.ts.map +1 -1
  192. package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
  193. package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
  194. package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
  195. package/lib/typescript/shared/constants.d.ts +34 -0
  196. package/lib/typescript/shared/constants.d.ts.map +1 -1
  197. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
  198. package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
  199. package/lib/typescript/shared/index.d.ts +210 -3
  200. package/lib/typescript/shared/index.d.ts.map +1 -1
  201. package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
  202. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
  203. package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
  204. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
  205. package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
  206. package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts +11 -0
  207. package/lib/typescript/shared/providers/screen/styles/helpers/build-resolved-style-map.d.ts.map +1 -0
  208. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts +7 -0
  209. package/lib/typescript/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.d.ts.map +1 -0
  210. package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts +6 -0
  211. package/lib/typescript/shared/providers/screen/styles/helpers/split-normalized-style-maps.d.ts.map +1 -0
  212. package/lib/typescript/shared/providers/screen/styles/index.d.ts +2 -0
  213. package/lib/typescript/shared/providers/screen/styles/index.d.ts.map +1 -0
  214. package/lib/typescript/shared/providers/screen/{styles.provider.d.ts → styles/styles.provider.d.ts} +3 -5
  215. package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -0
  216. package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
  217. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  218. package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
  219. package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
  220. package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
  221. package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
  222. package/lib/typescript/shared/types/animation.types.d.ts +14 -9
  223. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  224. package/lib/typescript/shared/types/bounds.types.d.ts +34 -1
  225. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  226. package/lib/typescript/shared/types/index.d.ts +1 -1
  227. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  228. package/lib/typescript/shared/types/screen.types.d.ts +2 -4
  229. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  230. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
  231. package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
  232. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts +1 -11
  233. package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
  234. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
  235. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +1 -1
  236. package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
  237. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +2 -0
  238. package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
  239. package/package.json +1 -1
  240. package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +37 -80
  241. package/src/blank-stack/types.ts +7 -4
  242. package/src/component-stack/navigators/create-component-stack-navigator.tsx +1 -1
  243. package/src/shared/components/create-boundary-component/components/boundary-target.tsx +47 -0
  244. package/src/shared/components/create-boundary-component/create-boundary-component.tsx +249 -0
  245. package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
  246. package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +68 -59
  247. package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
  248. package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +11 -44
  249. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +165 -6
  250. package/src/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.ts +107 -0
  251. package/src/shared/components/create-boundary-component/index.tsx +23 -254
  252. package/src/shared/components/create-boundary-component/providers/boundary-owner.provider.tsx +109 -0
  253. package/src/shared/components/create-boundary-component/types.ts +1 -2
  254. package/src/shared/components/create-transition-aware-component.tsx +43 -52
  255. package/src/shared/components/overlay/variations/float-overlay.tsx +1 -1
  256. package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
  257. package/src/shared/components/screen-container/index.tsx +10 -13
  258. package/src/shared/components/screen-container/layers/backdrop.tsx +10 -13
  259. package/src/shared/components/screen-container/layers/content.tsx +4 -4
  260. package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +6 -4
  261. package/src/shared/components/screen-container/layers/surface-container.tsx +4 -4
  262. package/src/shared/components/screen-lifecycle/index.tsx +1 -4
  263. package/src/shared/constants.ts +12 -0
  264. package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
  265. package/src/shared/index.ts +1 -1
  266. package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
  267. package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
  268. package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
  269. package/src/shared/providers/screen/screen-composer.tsx +1 -1
  270. package/src/shared/providers/screen/styles/helpers/build-resolved-style-map.ts +185 -0
  271. package/src/shared/providers/screen/styles/helpers/resolve-interpolated-style-output.ts +31 -0
  272. package/src/shared/providers/screen/styles/helpers/split-normalized-style-maps.ts +44 -0
  273. package/src/shared/providers/screen/styles/index.tsx +5 -0
  274. package/src/shared/providers/screen/{styles.provider.tsx → styles/styles.provider.tsx} +54 -56
  275. package/src/shared/stores/animation.store.ts +11 -2
  276. package/src/shared/stores/bounds/internals/registry.ts +24 -3
  277. package/src/shared/stores/bounds/internals/resolver.ts +6 -75
  278. package/src/shared/stores/bounds/types.ts +0 -2
  279. package/src/shared/types/animation.types.ts +16 -10
  280. package/src/shared/types/bounds.types.ts +34 -1
  281. package/src/shared/types/index.ts +0 -1
  282. package/src/shared/types/screen.types.ts +2 -4
  283. package/src/shared/utils/animation/animate-to-progress.ts +11 -1
  284. package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +3 -12
  285. package/src/shared/utils/bounds/helpers/style-composers.ts +11 -0
  286. package/src/shared/utils/bounds/zoom/build.ts +228 -100
  287. package/src/shared/utils/bounds/zoom/config.ts +2 -0
  288. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
  289. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  290. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
  291. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  292. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
  293. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  294. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
  295. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  296. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -57
  297. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  298. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
  299. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  300. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +0 -45
  301. package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
  302. package/lib/commonjs/shared/hooks/animation/use-associated-style.js +0 -234
  303. package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +0 -1
  304. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -50
  305. package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
  306. package/lib/commonjs/shared/providers/screen/styles.provider.js.map +0 -1
  307. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
  308. package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
  309. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
  310. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
  311. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
  312. package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
  313. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
  314. package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
  315. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -52
  316. package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
  317. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
  318. package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
  319. package/lib/module/shared/components/screen-container/deferred-visibility-host.js +0 -40
  320. package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +0 -1
  321. package/lib/module/shared/hooks/animation/use-associated-style.js +0 -229
  322. package/lib/module/shared/hooks/animation/use-associated-style.js.map +0 -1
  323. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +0 -44
  324. package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +0 -1
  325. package/lib/module/shared/providers/screen/styles.provider.js.map +0 -1
  326. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
  327. package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
  328. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
  329. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
  330. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
  331. package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
  332. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
  333. package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
  334. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -12
  335. package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
  336. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
  337. package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
  338. package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts +0 -14
  339. package/lib/typescript/shared/components/screen-container/deferred-visibility-host.d.ts.map +0 -1
  340. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts +0 -32
  341. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +0 -1
  342. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +0 -14
  343. package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +0 -1
  344. package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +0 -1
  345. package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
  346. package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
  347. package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
  348. package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
  349. package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -86
  350. package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
  351. package/src/shared/components/screen-container/deferred-visibility-host.tsx +0 -44
  352. package/src/shared/hooks/animation/use-associated-style.ts +0 -297
  353. package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +0 -61
@@ -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
-
116
- const direct = tagPresence[nextScreenKey];
117
- if (direct && direct.count > 0) return nextScreenKey;
118
119
 
119
- for (const screenKey in tagPresence) {
120
- const entry = tagPresence[screenKey];
121
- if (entry.ancestorKeys?.includes(nextScreenKey)) {
122
- return nextScreenKey;
123
- }
124
- }
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;
125
142
 
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,39 +195,23 @@ 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
+ }): MeasurementIntent | null => {
185
206
  "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
-
197
- if (!isAnyAnimating) {
198
- return "snapshot-only";
199
- }
200
-
201
- return hasPendingLinkFromSource
202
- ? ["snapshot-only", "complete-destination"]
203
- : "snapshot-only";
207
+ return params.hasSourceLink ? null : "capture-source";
204
208
  };
205
209
 
210
+ export const PREPARE_DESTINATION_MEASUREMENT_INTENT = [
211
+ "complete-destination",
212
+ "refresh-destination",
213
+ ] as const satisfies readonly MeasurementIntent[];
214
+
206
215
  export const resolveGroupActiveMeasurementAction = (params: {
207
216
  enabled: boolean;
208
217
  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,10 +3,10 @@ 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";
9
+ import { useLayoutAnchorContext } from "../../../providers/layout-anchor.provider";
10
10
  import { BoundStore } from "../../../stores/bounds";
11
11
  import { applyMeasuredBoundsWrites } from "../../../stores/bounds/helpers/apply-measured-bounds-writes";
12
12
  import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
@@ -16,11 +16,6 @@ import {
16
16
  resolveMeasurementWritePlan,
17
17
  } from "./helpers/measurement-rules";
18
18
 
19
- type LayoutAnchor = {
20
- correctMeasurement: (measured: MeasuredDimensions) => MeasuredDimensions;
21
- isMeasurementInViewport?: (measured: MeasuredDimensions) => boolean;
22
- } | null;
23
-
24
19
  const SNAPSHOT_EPSILON = 0.5;
25
20
 
26
21
  const areMeasurementsEqual = (
@@ -47,10 +42,8 @@ export const useBoundaryMeasureAndStore = (params: {
47
42
  ancestorKeys: string[];
48
43
  navigatorKey?: string;
49
44
  ancestorNavigatorKeys?: string[];
50
- isAnimating: SharedValue<number>;
51
45
  preparedStyles: StyleProps;
52
- animatedRef: AnimatedRef<View>;
53
- layoutAnchor: LayoutAnchor;
46
+ measuredAnimatedRef: AnimatedRef<View>;
54
47
  }) => {
55
48
  const {
56
49
  enabled,
@@ -60,12 +53,12 @@ export const useBoundaryMeasureAndStore = (params: {
60
53
  ancestorKeys,
61
54
  navigatorKey,
62
55
  ancestorNavigatorKeys,
63
- isAnimating,
64
56
  preparedStyles,
65
- animatedRef,
66
- layoutAnchor,
57
+ measuredAnimatedRef,
67
58
  } = params;
68
59
 
60
+ const layoutAnchor = useLayoutAnchorContext();
61
+
69
62
  return useStableCallbackValue(
70
63
  ({ intent }: MaybeMeasureAndStoreParams = {}) => {
71
64
  "worklet";
@@ -77,36 +70,15 @@ export const useBoundaryMeasureAndStore = (params: {
77
70
  resolvePendingSourceKey(sharedBoundTag, preferredSourceScreenKey) ||
78
71
  undefined;
79
72
 
80
- if (intents.captureSource && isAnimating.get()) {
81
- const existing = BoundStore.getSnapshot(
82
- sharedBoundTag,
83
- currentScreenKey,
84
- );
85
- if (existing) {
86
- applyMeasuredBoundsWrites({
87
- sharedBoundTag,
88
- ancestorKeys,
89
- navigatorKey,
90
- ancestorNavigatorKeys,
91
- currentScreenKey,
92
- measured: existing.bounds,
93
- preparedStyles,
94
- shouldSetSource: true,
95
- });
96
- return;
97
- }
98
-
99
- // No cached snapshot while animating.
100
- // Fall through to a live measurement so rapid retargeting still
101
- // captures a valid source link.
102
- }
103
-
104
73
  const hasPendingLink = expectedSourceScreenKey
105
74
  ? BoundStore.hasPendingLinkFromSource(
106
75
  sharedBoundTag,
107
76
  expectedSourceScreenKey,
108
77
  )
109
78
  : BoundStore.hasPendingLink(sharedBoundTag);
79
+ const hasAttachableSourceLink = expectedSourceScreenKey
80
+ ? BoundStore.hasSourceLink(sharedBoundTag, expectedSourceScreenKey)
81
+ : false;
110
82
  const hasSourceLink = BoundStore.hasSourceLink(
111
83
  sharedBoundTag,
112
84
  currentScreenKey,
@@ -121,13 +93,14 @@ export const useBoundaryMeasureAndStore = (params: {
121
93
  hasPendingLink,
122
94
  hasSourceLink,
123
95
  hasDestinationLink,
96
+ hasAttachableSourceLink,
124
97
  });
125
98
 
126
99
  if (!writePlan.writesAny) {
127
100
  return;
128
101
  }
129
102
 
130
- const measured = measure(animatedRef);
103
+ const measured = measure(measuredAnimatedRef);
131
104
  if (!measured) return;
132
105
 
133
106
  const correctedMeasured = layoutAnchor
@@ -155,13 +128,7 @@ export const useBoundaryMeasureAndStore = (params: {
155
128
  const hasSnapshotChanged =
156
129
  !existingSnapshot ||
157
130
  !areMeasurementsEqual(existingSnapshot.bounds, correctedMeasured);
158
- const shouldWriteSnapshot =
159
- hasSnapshotChanged &&
160
- (writePlan.registerSnapshot ||
161
- writePlan.captureSource ||
162
- writePlan.completeDestination ||
163
- writePlan.refreshSource ||
164
- writePlan.refreshDestination);
131
+ const shouldWriteSnapshot = hasSnapshotChanged;
165
132
 
166
133
  applyMeasuredBoundsWrites({
167
134
  sharedBoundTag,
@@ -1,25 +1,102 @@
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
 
7
17
  export const usePendingDestinationMeasurement = (params: {
8
18
  sharedBoundTag: string;
9
19
  enabled: boolean;
20
+ id: BoundaryId;
21
+ group?: string;
22
+ currentScreenKey: string;
10
23
  expectedSourceScreenKey?: string;
24
+ animating: SharedValue<number>;
11
25
  maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
12
26
  }) => {
13
27
  const {
14
28
  sharedBoundTag,
15
29
  enabled,
30
+ id,
31
+ group,
32
+ currentScreenKey,
16
33
  expectedSourceScreenKey,
34
+ animating,
17
35
  maybeMeasureAndStore,
18
36
  } = params;
19
37
 
38
+ const progress = AnimationStore.getValue(currentScreenKey, "progress");
39
+ const closing = AnimationStore.getValue(currentScreenKey, "closing");
40
+
41
+ const retryCount = useSharedValue(0);
42
+ const MAX_RETRIES = 4;
43
+ const RETRY_PROGRESS_BUCKETS = 8;
44
+ const RETRY_PROGRESS_MAX = 1.05;
45
+
46
+ useLayoutEffect(() => {
47
+ if (!enabled) return;
48
+
49
+ runOnUI(() => {
50
+ "worklet";
51
+ if (closing.get()) {
52
+ return;
53
+ }
54
+
55
+ const currentGroupActiveId = group
56
+ ? BoundStore.getGroupActiveId(group)
57
+ : null;
58
+ if (group && currentGroupActiveId !== String(id)) {
59
+ return;
60
+ }
61
+
62
+ const resolvedSourceKey = resolvePendingSourceKey(
63
+ sharedBoundTag,
64
+ expectedSourceScreenKey,
65
+ );
66
+ const hasAttachableSourceLink = resolvedSourceKey
67
+ ? BoundStore.hasPendingLinkFromSource(
68
+ sharedBoundTag,
69
+ resolvedSourceKey,
70
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
71
+ : false;
72
+
73
+ if (!hasAttachableSourceLink) {
74
+ return;
75
+ }
76
+
77
+ if (BoundStore.hasDestinationLink(sharedBoundTag, currentScreenKey)) {
78
+ return;
79
+ }
80
+
81
+ maybeMeasureAndStore({ intent: "complete-destination" });
82
+ })();
83
+ }, [
84
+ enabled,
85
+ id,
86
+ group,
87
+ sharedBoundTag,
88
+ currentScreenKey,
89
+ expectedSourceScreenKey,
90
+ closing,
91
+ maybeMeasureAndStore,
92
+ ]);
93
+
20
94
  useAnimatedReaction(
21
95
  () => {
22
96
  "worklet";
97
+ if (closing.get()) {
98
+ return 0;
99
+ }
23
100
  const resolvedSourceKey = resolvePendingSourceKey(
24
101
  sharedBoundTag,
25
102
  expectedSourceScreenKey,
@@ -27,12 +104,16 @@ export const usePendingDestinationMeasurement = (params: {
27
104
  return resolvePendingDestinationCaptureSignal({
28
105
  enabled,
29
106
  resolvedSourceKey,
30
- hasPendingLinkFromSource: resolvedSourceKey
107
+ hasAttachableSourceLink: resolvedSourceKey
31
108
  ? BoundStore.hasPendingLinkFromSource(
32
109
  sharedBoundTag,
33
110
  resolvedSourceKey,
34
- )
111
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
35
112
  : false,
113
+ hasDestinationLink: BoundStore.hasDestinationLink(
114
+ sharedBoundTag,
115
+ currentScreenKey,
116
+ ),
36
117
  });
37
118
  },
38
119
  (captureSignal, previousCaptureSignal) => {
@@ -41,9 +122,87 @@ export const usePendingDestinationMeasurement = (params: {
41
122
  if (!captureSignal || captureSignal === previousCaptureSignal) {
42
123
  return;
43
124
  }
125
+ const currentGroupActiveId = group
126
+ ? BoundStore.getGroupActiveId(group)
127
+ : null;
128
+ if (group && currentGroupActiveId !== String(id)) {
129
+ return;
130
+ }
131
+
132
+ maybeMeasureAndStore({ intent: "complete-destination" });
133
+ },
134
+ [
135
+ enabled,
136
+ id,
137
+ group,
138
+ sharedBoundTag,
139
+ expectedSourceScreenKey,
140
+ closing,
141
+ maybeMeasureAndStore,
142
+ ],
143
+ );
144
+
145
+ useAnimatedReaction(
146
+ () => {
147
+ "worklet";
148
+ if (closing.get()) {
149
+ return 0;
150
+ }
151
+ const resolvedSourceKey = resolvePendingSourceKey(
152
+ sharedBoundTag,
153
+ expectedSourceScreenKey,
154
+ );
155
+ return resolvePendingDestinationRetrySignal({
156
+ enabled,
157
+ retryCount: retryCount.get(),
158
+ maxRetries: MAX_RETRIES,
159
+ isAnimating: !!animating.get(),
160
+ hasDestinationLink: BoundStore.hasDestinationLink(
161
+ sharedBoundTag,
162
+ currentScreenKey,
163
+ ),
164
+ progress: progress.get(),
165
+ retryProgressMax: RETRY_PROGRESS_MAX,
166
+ retryProgressBuckets: RETRY_PROGRESS_BUCKETS,
167
+ resolvedSourceKey,
168
+ hasAttachableSourceLink: resolvedSourceKey
169
+ ? BoundStore.hasPendingLinkFromSource(
170
+ sharedBoundTag,
171
+ resolvedSourceKey,
172
+ ) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
173
+ : false,
174
+ });
175
+ },
176
+ (captureSignal) => {
177
+ "worklet";
178
+ if (!enabled) return;
179
+ if (!captureSignal) {
180
+ retryCount.set(0);
181
+ return;
182
+ }
183
+ const currentGroupActiveId = group
184
+ ? BoundStore.getGroupActiveId(group)
185
+ : null;
186
+ if (group && currentGroupActiveId !== String(id)) {
187
+ return;
188
+ }
44
189
 
190
+ if (retryCount.get() >= MAX_RETRIES) return;
191
+ retryCount.set(retryCount.get() + 1);
45
192
  maybeMeasureAndStore({ intent: "complete-destination" });
46
193
  },
47
- [enabled, sharedBoundTag, expectedSourceScreenKey, maybeMeasureAndStore],
194
+ [
195
+ enabled,
196
+ id,
197
+ group,
198
+ sharedBoundTag,
199
+ currentScreenKey,
200
+ expectedSourceScreenKey,
201
+ progress,
202
+ animating,
203
+ closing,
204
+ maybeMeasureAndStore,
205
+ retryCount,
206
+ ],
48
207
  );
49
208
  };