react-native-screen-transitions 4.0.0-alpha.5 → 4.0.0-alpha.7

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 (287) hide show
  1. package/lib/commonjs/components/boundary/components/boundary-lifecycle.js +36 -0
  2. package/lib/commonjs/components/boundary/components/boundary-lifecycle.js.map +1 -0
  3. package/lib/commonjs/components/boundary/components/boundary-target.js +1 -0
  4. package/lib/commonjs/components/boundary/components/boundary-target.js.map +1 -1
  5. package/lib/commonjs/components/boundary/create-boundary-component.js +1 -0
  6. package/lib/commonjs/components/boundary/create-boundary-component.js.map +1 -1
  7. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +1 -13
  8. package/lib/commonjs/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  9. package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js +9 -2
  10. package/lib/commonjs/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  11. package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js +3 -2
  12. package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  13. package/lib/commonjs/components/boundary/hooks/use-measurer.js +9 -2
  14. package/lib/commonjs/components/boundary/hooks/use-measurer.js.map +1 -1
  15. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js +5 -12
  16. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  17. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +25 -43
  18. package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  19. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +13 -0
  20. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +1 -0
  21. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +8 -31
  22. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
  23. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +14 -19
  24. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  25. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -1
  26. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  27. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +19 -48
  28. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  29. package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js +6 -2
  30. package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  31. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  32. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  33. package/lib/commonjs/components/boundary/providers/boundary-root.provider.js +19 -17
  34. package/lib/commonjs/components/boundary/providers/boundary-root.provider.js.map +1 -1
  35. package/lib/commonjs/components/boundary/utils/refresh-signals.js +19 -5
  36. package/lib/commonjs/components/boundary/utils/refresh-signals.js.map +1 -1
  37. package/lib/commonjs/components/screen-container/layers/backdrop.js +11 -7
  38. package/lib/commonjs/components/screen-container/layers/backdrop.js.map +1 -1
  39. package/lib/commonjs/components/screen-lifecycle/hooks/helpers/close-interception-rules.js +32 -0
  40. package/lib/commonjs/components/screen-lifecycle/hooks/helpers/close-interception-rules.js.map +1 -0
  41. package/lib/commonjs/components/screen-lifecycle/hooks/use-close-completion.js +27 -0
  42. package/lib/commonjs/components/screen-lifecycle/hooks/use-close-completion.js.map +1 -0
  43. package/lib/commonjs/components/screen-lifecycle/hooks/use-close-transition-intent.js +61 -86
  44. package/lib/commonjs/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
  45. package/lib/commonjs/components/screen-lifecycle/hooks/use-transition-start-controller.js +1 -5
  46. package/lib/commonjs/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
  47. package/lib/commonjs/components/screen-lifecycle/index.js +9 -6
  48. package/lib/commonjs/components/screen-lifecycle/index.js.map +1 -1
  49. package/lib/commonjs/hooks/navigation/use-navigation-helpers.js +30 -13
  50. package/lib/commonjs/hooks/navigation/use-navigation-helpers.js.map +1 -1
  51. package/lib/commonjs/providers/helpers/measured-bounds-writes.js +1 -2
  52. package/lib/commonjs/providers/helpers/measured-bounds-writes.js.map +1 -1
  53. package/lib/commonjs/providers/screen/gestures/hooks/use-screen-gesture-config.js +9 -2
  54. package/lib/commonjs/providers/screen/gestures/hooks/use-screen-gesture-config.js.map +1 -1
  55. package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-lifecycle.js +4 -5
  56. package/lib/commonjs/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
  57. package/lib/commonjs/providers/screen/gestures/pan/behavior/use-pan-behavior.js +2 -3
  58. package/lib/commonjs/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
  59. package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -5
  60. package/lib/commonjs/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  61. package/lib/commonjs/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -3
  62. package/lib/commonjs/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
  63. package/lib/commonjs/providers/screen/gestures/shared/policy.js +9 -5
  64. package/lib/commonjs/providers/screen/gestures/shared/policy.js.map +1 -1
  65. package/lib/commonjs/providers/screen/styles/helpers/create-interpolator-scope.js +40 -0
  66. package/lib/commonjs/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
  67. package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js +5 -10
  68. package/lib/commonjs/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  69. package/lib/commonjs/providers/stack/blank-stack-state/blank-stack-controller.js +7 -9
  70. package/lib/commonjs/providers/stack/blank-stack-state/blank-stack-controller.js.map +1 -1
  71. package/lib/commonjs/stores/bounds/internals/links.js +1 -1
  72. package/lib/commonjs/stores/bounds/internals/links.js.map +1 -1
  73. package/lib/commonjs/stores/system.store.js +1 -2
  74. package/lib/commonjs/stores/system.store.js.map +1 -1
  75. package/lib/commonjs/utils/animation/animate-to-progress.js +0 -22
  76. package/lib/commonjs/utils/animation/animate-to-progress.js.map +1 -1
  77. package/lib/commonjs/utils/navigation/close-action-replay.js +22 -0
  78. package/lib/commonjs/utils/navigation/close-action-replay.js.map +1 -0
  79. package/lib/module/components/boundary/components/boundary-lifecycle.js +32 -0
  80. package/lib/module/components/boundary/components/boundary-lifecycle.js.map +1 -0
  81. package/lib/module/components/boundary/components/boundary-target.js +1 -0
  82. package/lib/module/components/boundary/components/boundary-target.js.map +1 -1
  83. package/lib/module/components/boundary/create-boundary-component.js +1 -0
  84. package/lib/module/components/boundary/create-boundary-component.js.map +1 -1
  85. package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +1 -13
  86. package/lib/module/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
  87. package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js +9 -2
  88. package/lib/module/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
  89. package/lib/module/components/boundary/hooks/use-boundary-measurement.js +3 -2
  90. package/lib/module/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
  91. package/lib/module/components/boundary/hooks/use-measurer.js +9 -2
  92. package/lib/module/components/boundary/hooks/use-measurer.js.map +1 -1
  93. package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js +5 -12
  94. package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
  95. package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +27 -45
  96. package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
  97. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +8 -0
  98. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +1 -0
  99. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +8 -32
  100. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
  101. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +15 -20
  102. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +1 -1
  103. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +3 -1
  104. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  105. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +19 -48
  106. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +1 -1
  107. package/lib/module/components/boundary/portal/components/boundary-portal/index.js +6 -2
  108. package/lib/module/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
  109. package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -1
  110. package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
  111. package/lib/module/components/boundary/providers/boundary-root.provider.js +20 -18
  112. package/lib/module/components/boundary/providers/boundary-root.provider.js.map +1 -1
  113. package/lib/module/components/boundary/utils/refresh-signals.js +19 -5
  114. package/lib/module/components/boundary/utils/refresh-signals.js.map +1 -1
  115. package/lib/module/components/screen-container/layers/backdrop.js +12 -8
  116. package/lib/module/components/screen-container/layers/backdrop.js.map +1 -1
  117. package/lib/module/components/screen-lifecycle/hooks/helpers/close-interception-rules.js +26 -0
  118. package/lib/module/components/screen-lifecycle/hooks/helpers/close-interception-rules.js.map +1 -0
  119. package/lib/module/components/screen-lifecycle/hooks/use-close-completion.js +22 -0
  120. package/lib/module/components/screen-lifecycle/hooks/use-close-completion.js.map +1 -0
  121. package/lib/module/components/screen-lifecycle/hooks/use-close-transition-intent.js +61 -85
  122. package/lib/module/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
  123. package/lib/module/components/screen-lifecycle/hooks/use-transition-start-controller.js +1 -5
  124. package/lib/module/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
  125. package/lib/module/components/screen-lifecycle/index.js +9 -6
  126. package/lib/module/components/screen-lifecycle/index.js.map +1 -1
  127. package/lib/module/hooks/navigation/use-navigation-helpers.js +30 -13
  128. package/lib/module/hooks/navigation/use-navigation-helpers.js.map +1 -1
  129. package/lib/module/providers/helpers/measured-bounds-writes.js +1 -2
  130. package/lib/module/providers/helpers/measured-bounds-writes.js.map +1 -1
  131. package/lib/module/providers/screen/gestures/hooks/use-screen-gesture-config.js +9 -2
  132. package/lib/module/providers/screen/gestures/hooks/use-screen-gesture-config.js.map +1 -1
  133. package/lib/module/providers/screen/gestures/pan/behavior/pan-lifecycle.js +4 -5
  134. package/lib/module/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
  135. package/lib/module/providers/screen/gestures/pan/behavior/use-pan-behavior.js +2 -3
  136. package/lib/module/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
  137. package/lib/module/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -5
  138. package/lib/module/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
  139. package/lib/module/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -3
  140. package/lib/module/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
  141. package/lib/module/providers/screen/gestures/shared/policy.js +9 -5
  142. package/lib/module/providers/screen/gestures/shared/policy.js.map +1 -1
  143. package/lib/module/providers/screen/styles/helpers/create-interpolator-scope.js +35 -0
  144. package/lib/module/providers/screen/styles/helpers/create-interpolator-scope.js.map +1 -0
  145. package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js +5 -10
  146. package/lib/module/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
  147. package/lib/module/providers/stack/blank-stack-state/blank-stack-controller.js +7 -9
  148. package/lib/module/providers/stack/blank-stack-state/blank-stack-controller.js.map +1 -1
  149. package/lib/module/stores/bounds/internals/links.js +1 -1
  150. package/lib/module/stores/bounds/internals/links.js.map +1 -1
  151. package/lib/module/stores/system.store.js +1 -2
  152. package/lib/module/stores/system.store.js.map +1 -1
  153. package/lib/module/utils/animation/animate-to-progress.js +0 -22
  154. package/lib/module/utils/animation/animate-to-progress.js.map +1 -1
  155. package/lib/module/utils/navigation/close-action-replay.js +16 -0
  156. package/lib/module/utils/navigation/close-action-replay.js.map +1 -0
  157. package/lib/typescript/components/boundary/components/boundary-lifecycle.d.ts +18 -0
  158. package/lib/typescript/components/boundary/components/boundary-lifecycle.d.ts.map +1 -0
  159. package/lib/typescript/components/boundary/components/boundary-target.d.ts.map +1 -1
  160. package/lib/typescript/components/boundary/create-boundary-component.d.ts.map +1 -1
  161. package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts +1 -2
  162. package/lib/typescript/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
  163. package/lib/typescript/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
  164. package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts +3 -2
  165. package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
  166. package/lib/typescript/components/boundary/hooks/use-measurer.d.ts +3 -2
  167. package/lib/typescript/components/boundary/hooks/use-measurer.d.ts.map +1 -1
  168. package/lib/typescript/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
  169. package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts +5 -1
  170. package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
  171. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts +4 -0
  172. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts.map +1 -0
  173. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts +4 -17
  174. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +1 -1
  175. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +3 -1
  176. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -1
  177. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +3 -1
  178. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  179. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts +5 -9
  180. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +1 -1
  181. package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts +3 -1
  182. package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
  183. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +2 -1
  184. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
  185. package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts +2 -1
  186. package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
  187. package/lib/typescript/components/boundary/types.d.ts +6 -0
  188. package/lib/typescript/components/boundary/types.d.ts.map +1 -1
  189. package/lib/typescript/components/boundary/utils/refresh-signals.d.ts +1 -0
  190. package/lib/typescript/components/boundary/utils/refresh-signals.d.ts.map +1 -1
  191. package/lib/typescript/components/screen-container/layers/backdrop.d.ts.map +1 -1
  192. package/lib/typescript/components/screen-lifecycle/hooks/helpers/close-interception-rules.d.ts +28 -0
  193. package/lib/typescript/components/screen-lifecycle/hooks/helpers/close-interception-rules.d.ts.map +1 -0
  194. package/lib/typescript/components/screen-lifecycle/hooks/use-close-completion.d.ts +7 -0
  195. package/lib/typescript/components/screen-lifecycle/hooks/use-close-completion.d.ts.map +1 -0
  196. package/lib/typescript/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts +2 -7
  197. package/lib/typescript/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts.map +1 -1
  198. package/lib/typescript/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts +1 -3
  199. package/lib/typescript/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts.map +1 -1
  200. package/lib/typescript/components/screen-lifecycle/index.d.ts.map +1 -1
  201. package/lib/typescript/hooks/navigation/use-navigation-helpers.d.ts +1 -0
  202. package/lib/typescript/hooks/navigation/use-navigation-helpers.d.ts.map +1 -1
  203. package/lib/typescript/navigators/react-navigation/index.d.ts +1 -1
  204. package/lib/typescript/providers/screen/gestures/hooks/use-screen-gesture-config.d.ts.map +1 -1
  205. package/lib/typescript/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts +1 -1
  206. package/lib/typescript/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts.map +1 -1
  207. package/lib/typescript/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts.map +1 -1
  208. package/lib/typescript/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts +1 -1
  209. package/lib/typescript/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
  210. package/lib/typescript/providers/screen/gestures/pinch/behavior/use-pinch-behavior.d.ts.map +1 -1
  211. package/lib/typescript/providers/screen/gestures/shared/policy.d.ts +2 -1
  212. package/lib/typescript/providers/screen/gestures/shared/policy.d.ts.map +1 -1
  213. package/lib/typescript/providers/screen/gestures/types.d.ts +2 -0
  214. package/lib/typescript/providers/screen/gestures/types.d.ts.map +1 -1
  215. package/lib/typescript/providers/screen/styles/helpers/create-interpolator-scope.d.ts +9 -0
  216. package/lib/typescript/providers/screen/styles/helpers/create-interpolator-scope.d.ts.map +1 -0
  217. package/lib/typescript/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
  218. package/lib/typescript/providers/stack/blank-stack-state/blank-stack-controller.d.ts.map +1 -1
  219. package/lib/typescript/stores/system.store.d.ts +1 -2
  220. package/lib/typescript/stores/system.store.d.ts.map +1 -1
  221. package/lib/typescript/utils/animation/animate-to-progress.d.ts +1 -2
  222. package/lib/typescript/utils/animation/animate-to-progress.d.ts.map +1 -1
  223. package/lib/typescript/utils/navigation/close-action-replay.d.ts +4 -0
  224. package/lib/typescript/utils/navigation/close-action-replay.d.ts.map +1 -0
  225. package/package.json +1 -1
  226. package/src/components/boundary/components/boundary-lifecycle.tsx +53 -0
  227. package/src/components/boundary/components/boundary-target.tsx +1 -0
  228. package/src/components/boundary/create-boundary-component.tsx +1 -0
  229. package/src/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +0 -14
  230. package/src/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +13 -2
  231. package/src/components/boundary/hooks/use-boundary-measurement.ts +7 -2
  232. package/src/components/boundary/hooks/use-measurer.ts +11 -1
  233. package/src/components/boundary/portal/components/boundary-portal/components/host.tsx +13 -11
  234. package/src/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +44 -55
  235. package/src/components/boundary/portal/components/boundary-portal/helpers/local-measurement.ts +10 -0
  236. package/src/components/boundary/portal/components/boundary-portal/helpers/offset-style.ts +11 -55
  237. package/src/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +20 -24
  238. package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +6 -0
  239. package/src/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +20 -68
  240. package/src/components/boundary/portal/components/boundary-portal/index.tsx +19 -3
  241. package/src/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +3 -2
  242. package/src/components/boundary/providers/boundary-root.provider.tsx +29 -20
  243. package/src/components/boundary/types.ts +9 -0
  244. package/src/components/boundary/utils/refresh-signals.ts +39 -6
  245. package/src/components/screen-container/layers/backdrop.tsx +11 -7
  246. package/src/components/screen-lifecycle/hooks/helpers/close-interception-rules.ts +66 -0
  247. package/src/components/screen-lifecycle/hooks/use-close-completion.ts +25 -0
  248. package/src/components/screen-lifecycle/hooks/use-close-transition-intent.ts +68 -108
  249. package/src/components/screen-lifecycle/hooks/use-transition-start-controller.ts +0 -12
  250. package/src/components/screen-lifecycle/index.tsx +8 -4
  251. package/src/hooks/navigation/use-navigation-helpers.ts +40 -12
  252. package/src/providers/helpers/measured-bounds-writes.ts +1 -1
  253. package/src/providers/screen/gestures/hooks/use-screen-gesture-config.ts +9 -1
  254. package/src/providers/screen/gestures/pan/behavior/pan-lifecycle.ts +4 -6
  255. package/src/providers/screen/gestures/pan/behavior/use-pan-behavior.ts +1 -3
  256. package/src/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +4 -6
  257. package/src/providers/screen/gestures/pinch/behavior/use-pinch-behavior.ts +2 -8
  258. package/src/providers/screen/gestures/shared/policy.ts +17 -6
  259. package/src/providers/screen/gestures/types.ts +2 -0
  260. package/src/providers/screen/styles/helpers/create-interpolator-scope.ts +45 -0
  261. package/src/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +8 -12
  262. package/src/providers/stack/blank-stack-state/blank-stack-controller.ts +7 -7
  263. package/src/stores/bounds/internals/links.ts +1 -1
  264. package/src/stores/system.store.ts +1 -2
  265. package/src/utils/animation/animate-to-progress.ts +0 -23
  266. package/src/utils/navigation/close-action-replay.ts +25 -0
  267. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/active-pair.js +0 -30
  268. package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/active-pair.js.map +0 -1
  269. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js +0 -47
  270. package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +0 -1
  271. package/lib/commonjs/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -21
  272. package/lib/commonjs/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
  273. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/active-pair.js +0 -25
  274. package/lib/module/components/boundary/portal/components/boundary-portal/helpers/active-pair.js.map +0 -1
  275. package/lib/module/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js +0 -40
  276. package/lib/module/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.js.map +0 -1
  277. package/lib/module/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js +0 -16
  278. package/lib/module/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.js.map +0 -1
  279. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/active-pair.d.ts +0 -9
  280. package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/active-pair.d.ts.map +0 -1
  281. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.d.ts +0 -9
  282. package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.d.ts.map +0 -1
  283. package/lib/typescript/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts +0 -2
  284. package/lib/typescript/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.d.ts.map +0 -1
  285. package/src/components/boundary/portal/components/boundary-portal/helpers/active-pair.ts +0 -36
  286. package/src/components/boundary/portal/components/boundary-portal/stores/host-bounds.store.ts +0 -45
  287. package/src/providers/screen/animation/helpers/accessors/use-build-bounds-accessor.tsx +0 -15
@@ -3,7 +3,10 @@ import type { View } from "react-native";
3
3
  import type { AnimatedRef } from "react-native-reanimated";
4
4
  import type { BoundTag } from "../../../stores/bounds/types";
5
5
  import { prepareStyleForBounds } from "../../../utils/bounds/helpers/styles/styles";
6
- import type { BoundaryConfigProps } from "../types";
6
+ import type {
7
+ BoundaryConfigProps,
8
+ BoundaryLocalMeasurementValue,
9
+ } from "../types";
7
10
  import { useBoundaryPresence } from "./lifecycles/use-boundary-presence";
8
11
  import { useInitialDestinationMeasurement } from "./lifecycles/use-initial-destination-measurement";
9
12
  import { useInitialSourceMeasurement } from "./lifecycles/use-initial-source-measurement";
@@ -23,6 +26,7 @@ interface UseBoundaryMeasurementParams {
23
26
  style?: unknown;
24
27
  handoff: boolean;
25
28
  escapeClipping: boolean;
29
+ localMeasurement: BoundaryLocalMeasurementValue;
26
30
  config: BoundaryConfigProps;
27
31
  }
28
32
 
@@ -40,6 +44,7 @@ export const useBoundaryMeasurement = ({
40
44
  style,
41
45
  handoff,
42
46
  escapeClipping,
47
+ localMeasurement,
43
48
  config,
44
49
  }: UseBoundaryMeasurementParams) => {
45
50
  const { anchor, scaleMode, target, method } = config;
@@ -58,6 +63,7 @@ export const useBoundaryMeasurement = ({
58
63
  measuredAnimatedRef: measuredRef,
59
64
  handoff,
60
65
  escapeClipping,
66
+ localMeasurement,
61
67
  });
62
68
 
63
69
  // Presence and source capture must not depend on this screen owning an
@@ -81,7 +87,6 @@ export const useBoundaryMeasurement = ({
81
87
  useInitialDestinationMeasurement({
82
88
  boundTag,
83
89
  enabled: runtimeEnabled,
84
- escapeClipping,
85
90
  measureBoundary,
86
91
  });
87
92
 
@@ -8,7 +8,7 @@ import type { BoundTag } from "../../../stores/bounds/types";
8
8
  import { ScrollStore } from "../../../stores/scroll.store";
9
9
  import { SystemStore } from "../../../stores/system.store";
10
10
  import { getVisibilityBlockOffset } from "../../../utils/visibility-block-offset";
11
- import type { MeasureBoundary } from "../types";
11
+ import type { BoundaryLocalMeasurementValue, MeasureBoundary } from "../types";
12
12
  import {
13
13
  attachScrollSnapshotToMeasuredBounds,
14
14
  correctMeasuredBoundsForVisibilityGate,
@@ -24,6 +24,7 @@ interface UseMeasurerParams {
24
24
  measuredAnimatedRef: AnimatedRef<View>;
25
25
  handoff: boolean;
26
26
  escapeClipping: boolean;
27
+ localMeasurement: BoundaryLocalMeasurementValue;
27
28
  }
28
29
 
29
30
  export const useMeasurer = ({
@@ -34,6 +35,7 @@ export const useMeasurer = ({
34
35
  measuredAnimatedRef,
35
36
  handoff,
36
37
  escapeClipping,
38
+ localMeasurement,
37
39
  }: UseMeasurerParams): MeasureBoundary => {
38
40
  const { width: viewportWidth, height: viewportHeight } =
39
41
  useWindowDimensions();
@@ -66,6 +68,13 @@ export const useMeasurer = ({
66
68
  viewportHeight,
67
69
  });
68
70
 
71
+ if (escapeClipping && target.type === "source") {
72
+ localMeasurement.set({
73
+ bounds: measured,
74
+ pairKey: target.pairKey,
75
+ });
76
+ }
77
+
69
78
  /**
70
79
  * - Destination Pass -
71
80
  * Be strict while lifecycle start is blocked for destination capture.
@@ -112,6 +121,7 @@ export const useMeasurer = ({
112
121
  measuredAnimatedRef,
113
122
  handoff,
114
123
  escapeClipping,
124
+ localMeasurement,
115
125
  viewportWidth,
116
126
  viewportHeight,
117
127
  scrollState,
@@ -8,7 +8,6 @@ import {
8
8
  } from "react-native";
9
9
  import Animated from "react-native-reanimated";
10
10
  import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
11
- import { useScreenSlots } from "../../../../../../providers/screen/styles";
12
11
  import { PORTAL_POINTER_EVENTS } from "../../../teleport";
13
12
  import { useHostMeasurement } from "../hooks/use-host-measurement";
14
13
  import { registerHost, unregisterHost } from "../stores/host-registry.store";
@@ -34,20 +33,17 @@ function HostImpl({ fallback = false, style }: HostImplProps) {
34
33
  }
35
34
 
36
35
  const hostKey = fallback ? screenKey : generatedHostKeyRef.current;
37
- const capturesScroll = !fallback;
38
36
  const activeBoundaryHosts = useActivePortalBoundaryHosts(hostKey);
39
- const { visibilityBlocked } = useScreenSlots();
37
+
40
38
  const { height: viewportHeight, width: viewportWidth } =
41
39
  useWindowDimensions();
42
40
 
41
+ const measurementKey = activeBoundaryHosts.length
42
+ ? activeBoundaryHosts.map((host) => host.portalHostName).join("|")
43
+ : null;
44
+
43
45
  const measurement = useHostMeasurement({
44
- capturesScroll,
45
- enabled: activeBoundaryHosts.length > 0,
46
- hostKey,
47
- screenKey,
48
- visibilityBlocked,
49
- viewportHeight,
50
- viewportWidth,
46
+ measurementKey,
51
47
  });
52
48
 
53
49
  useLayoutEffect(() => {
@@ -71,7 +67,13 @@ function HostImpl({ fallback = false, style }: HostImplProps) {
71
67
  { width: viewportWidth, height: viewportHeight },
72
68
  ]}
73
69
  >
74
- <PortalBoundaryHost host={host} style={StyleSheet.absoluteFill} />
70
+ <PortalBoundaryHost
71
+ host={host}
72
+ hostBounds={measurement.hostBounds}
73
+ hostMeasurementKey={measurementKey}
74
+ measuredHostKey={measurement.measuredKey}
75
+ style={StyleSheet.absoluteFill}
76
+ />
75
77
  </View>
76
78
  ));
77
79
 
@@ -1,4 +1,4 @@
1
- import { memo, useCallback } from "react";
1
+ import { memo } from "react";
2
2
  import {
3
3
  I18nManager,
4
4
  type StyleProp,
@@ -6,97 +6,86 @@ import {
6
6
  type ViewStyle,
7
7
  } from "react-native";
8
8
  import Animated, {
9
+ type MeasuredDimensions,
10
+ type SharedValue,
11
+ useAnimatedReaction,
9
12
  useAnimatedStyle,
10
- useFrameCallback,
11
- useSharedValue,
12
13
  } from "react-native-reanimated";
13
14
  import { NO_STYLES } from "../../../../../../constants";
14
15
  import { composeSlotStyleWithLocalTransform } from "../../../../../../providers/screen/styles/helpers/compose-slot-style";
15
- import { getLink } from "../../../../../../stores/bounds/internals/links";
16
- import { SystemStore } from "../../../../../../stores/system.store";
17
- import type { ScrollMeasuredDimensions } from "../../../../utils/measured-bounds";
18
16
  import { NativePortalHost, PORTAL_POINTER_EVENTS } from "../../../teleport";
17
+ import { resolveBoundaryLocalMeasurement } from "../helpers/local-measurement";
19
18
  import { resolvePortalOffsetStyle } from "../helpers/offset-style";
20
- import { getPortalHostBounds } from "../stores/host-bounds.store";
21
19
  import type { ActivePortalBoundaryHost } from "../stores/portal-boundary-host.store";
22
20
 
23
21
  const AnimatedPortalBoundaryHost = NativePortalHost
24
22
  ? Animated.createAnimatedComponent(NativePortalHost)
25
23
  : null;
26
24
 
25
+ const getCurrentBoundaryBounds = (host: ActivePortalBoundaryHost) => {
26
+ "worklet";
27
+ return resolveBoundaryLocalMeasurement(
28
+ host.localMeasurement.get(),
29
+ host.pairKey,
30
+ );
31
+ };
32
+
27
33
  type PortalBoundaryHostProps = {
28
34
  host: ActivePortalBoundaryHost;
35
+ hostBounds: SharedValue<MeasuredDimensions | null>;
36
+ hostMeasurementKey: string | null;
37
+ measuredHostKey: SharedValue<string | null>;
29
38
  style?: StyleProp<ViewStyle>;
30
39
  };
31
40
 
32
41
  export const PortalBoundaryHost = memo(function PortalBoundaryHost({
33
42
  host,
43
+ hostBounds,
44
+ hostMeasurementKey,
45
+ measuredHostKey,
34
46
  style,
35
47
  }: PortalBoundaryHostProps) {
36
- const geometryReadyFrames = useSharedValue(0);
37
- const { unblockLifecycleStart } = SystemStore.getBag(host.screenKey).actions;
38
-
39
- const handleFrame = useCallback(() => {
40
- "worklet";
41
- if (host.portalHostReady.get()) {
42
- return;
43
- }
44
-
45
- const link = getLink(host.pairKey, host.boundaryId);
46
- const hasSource = !!link?.source;
47
- const hasHostBounds = getPortalHostBounds(host.hostKey) !== null;
48
- const hasSlot = host.slotsMap.get()[host.boundaryId] !== undefined;
49
- const hasGeometry = hasSource && hasHostBounds && hasSlot;
50
-
51
- if (!hasGeometry) {
52
- geometryReadyFrames.set(0);
53
- return;
54
- }
55
-
56
- if (geometryReadyFrames.get() === 0) {
57
- // Give the source frame, host offset, and slot style one UI frame to
58
- // reach native before Teleport targets this receiver.
59
- geometryReadyFrames.set(1);
60
- return;
61
- }
62
-
63
- host.portalHostReady.set(true);
64
- unblockLifecycleStart();
65
- }, [geometryReadyFrames, host, unblockLifecycleStart]);
66
-
67
- useFrameCallback(handleFrame, true);
48
+ useAnimatedReaction(
49
+ () => {
50
+ "worklet";
51
+ return (
52
+ getCurrentBoundaryBounds(host) !== null &&
53
+ hostBounds.get() !== null &&
54
+ !!hostMeasurementKey &&
55
+ measuredHostKey.get() === hostMeasurementKey
56
+ );
57
+ },
58
+ (ready) => {
59
+ "worklet";
60
+ if (ready) {
61
+ host.portalHostReady.set(true);
62
+ }
63
+ },
64
+ );
68
65
 
69
66
  const hostStyle = useAnimatedStyle(() => {
70
67
  "worklet";
71
- // Strict per-member lookup - a fallback member's source rect would
72
- // misplace this host's teleported content.
73
- const link = getLink(host.pairKey, host.boundaryId);
74
- if (!link?.source) {
68
+ const boundaryBounds = getCurrentBoundaryBounds(host);
69
+ if (!boundaryBounds) {
75
70
  return NO_STYLES;
76
71
  }
77
72
 
78
- const sourceBounds = link.source.bounds as ScrollMeasuredDimensions;
79
- const isCrossScreenPortal = link.source.screenKey !== host.screenKey;
80
-
81
73
  return resolvePortalOffsetStyle({
82
- bounds: sourceBounds,
83
- hostKey: host.hostKey,
84
- placement: isCrossScreenPortal ? "cross-screen" : "same-screen",
74
+ bounds: boundaryBounds,
75
+ hostBounds: hostBounds.get(),
85
76
  });
86
77
  });
87
78
 
88
79
  const contentFrameStyle = useAnimatedStyle(() => {
89
80
  "worklet";
90
- const link = getLink(host.pairKey, host.boundaryId);
91
- if (!link?.source) {
81
+ const boundaryBounds = getCurrentBoundaryBounds(host);
82
+ if (!boundaryBounds) {
92
83
  return NO_STYLES;
93
84
  }
94
85
 
95
- const sourceBounds = link.source.bounds as ScrollMeasuredDimensions;
96
-
97
86
  return {
98
- height: sourceBounds.height,
99
- width: sourceBounds.width,
87
+ height: boundaryBounds.height,
88
+ width: boundaryBounds.width,
100
89
  };
101
90
  });
102
91
  const slotStyle = useAnimatedStyle(() => {
@@ -0,0 +1,10 @@
1
+ import type { ScreenPairKey } from "../../../../../../stores/bounds/types";
2
+ import type { BoundaryLocalMeasurement } from "../../../../types";
3
+
4
+ export const resolveBoundaryLocalMeasurement = (
5
+ measurement: BoundaryLocalMeasurement | null,
6
+ pairKey: ScreenPairKey,
7
+ ) => {
8
+ "worklet";
9
+ return measurement?.pairKey === pairKey ? measurement.bounds : null;
10
+ };
@@ -1,69 +1,25 @@
1
- import type { StyleProps } from "react-native-reanimated";
2
- import { getClampedScrollAxisDelta } from "../../../../../../stores/scroll.store";
3
- import type { ScrollMeasuredDimensions } from "../../../../utils/measured-bounds";
4
- import { getPortalHostBounds } from "../stores/host-bounds.store";
5
-
6
- /**
7
- * The two portal coordinate cases we support:
8
- *
9
- * - same-screen: source and host live on the same screen; re-base the stored
10
- * host frame onto the source measurement's scroll snapshot.
11
- * - cross-screen: source and host live on different screens; the host is the
12
- * replacement coordinate space, so destination scroll is inherited naturally
13
- * from host placement instead of manually propagated.
14
- */
15
- export type PortalOffsetPlacement = "same-screen" | "cross-screen";
1
+ import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
16
2
 
17
3
  type ResolvePortalOffsetStyleParams = {
18
- /** Source rect, carrying the scroll snapshot taken at measure time. */
19
- bounds: ScrollMeasuredDimensions;
20
- hostKey: string;
21
- placement: PortalOffsetPlacement;
4
+ bounds: MeasuredDimensions;
5
+ hostBounds: MeasuredDimensions | null;
22
6
  };
23
7
 
24
8
  export const resolvePortalOffsetStyle = ({
25
9
  bounds,
26
- hostKey,
27
- placement,
10
+ hostBounds,
28
11
  }: ResolvePortalOffsetStyleParams): StyleProps => {
29
12
  "worklet";
30
- const hostBounds = getPortalHostBounds(hostKey);
31
- const boundsScrollSnapshot = bounds.scroll ?? null;
32
- const hostBoundsScrollSnapshot = hostBounds?.scroll ?? null;
33
-
34
- // same-screen re-bases the static host frame onto the source scroll snapshot.
35
- // Cross-screen hosts are the chosen replacement coordinate space, so their
36
- // destination scroll is represented by where the host itself is mounted.
37
- const alignHostToBoundsScroll = placement === "same-screen";
38
-
39
- const hostSnapshotDeltaX = alignHostToBoundsScroll
40
- ? getClampedScrollAxisDelta(
41
- boundsScrollSnapshot,
42
- hostBoundsScrollSnapshot,
43
- "horizontal",
44
- )
45
- : 0;
46
- const hostSnapshotDeltaY = alignHostToBoundsScroll
47
- ? getClampedScrollAxisDelta(
48
- boundsScrollSnapshot,
49
- hostBoundsScrollSnapshot,
50
- "vertical",
51
- )
52
- : 0;
53
-
54
- // Without registered host bounds the host frame is the origin, so the source
55
- // page position becomes the offset directly.
56
- const adjustedHostPageX = hostBounds
57
- ? hostBounds.pageX - hostSnapshotDeltaX
58
- : 0;
59
- const adjustedHostPageY = hostBounds
60
- ? hostBounds.pageY - hostSnapshotDeltaY
61
- : 0;
13
+ // Both values are measured in page coordinates. Subtracting the host origin
14
+ // gives the boundary's local position inside that host, independent of which
15
+ // scroll container owns either view.
16
+ const hostPageX = hostBounds?.pageX ?? 0;
17
+ const hostPageY = hostBounds?.pageY ?? 0;
62
18
 
63
19
  return {
64
20
  transform: [
65
- { translateY: bounds.pageY - adjustedHostPageY },
66
- { translateX: bounds.pageX - adjustedHostPageX },
21
+ { translateY: bounds.pageY - hostPageY },
22
+ { translateX: bounds.pageX - hostPageX },
67
23
  ],
68
24
  };
69
25
  };
@@ -1,9 +1,10 @@
1
- import { useCallback, useLayoutEffect, useRef, useState } from "react";
1
+ import { useCallback, useLayoutEffect, useState } from "react";
2
2
  import { type SharedValue, useAnimatedReaction } from "react-native-reanimated";
3
3
  import { scheduleOnRN } from "react-native-worklets";
4
4
  import { getPairKeyForSource } from "../../../../../../stores/bounds/internals/links";
5
5
  import type { ScreenPairKey } from "../../../../../../stores/bounds/types";
6
6
  import type { NormalizedTransitionInterpolatedStyle } from "../../../../../../types/animation.types";
7
+ import type { BoundaryLocalMeasurementValue } from "../../../../types";
7
8
  import { createBoundaryPortalHostName } from "../../../utils/naming";
8
9
  import {
9
10
  mountPortalBoundaryHost,
@@ -14,44 +15,39 @@ type UseActivePortalBoundaryHostParams = {
14
15
  boundaryId: string;
15
16
  currentScreenKey: string;
16
17
  escapeHostKey?: string;
18
+ localMeasurement: BoundaryLocalMeasurementValue;
17
19
  portalHostName: SharedValue<string | null>;
18
20
  portalHostReady: SharedValue<boolean>;
19
21
  slotsMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
20
22
  };
21
23
 
22
- type ActivePortal = {
23
- pairKey: ScreenPairKey;
24
- };
25
-
26
24
  export const useActivePortalBoundaryHost = ({
27
25
  boundaryId,
28
26
  currentScreenKey,
29
27
  escapeHostKey,
28
+ localMeasurement,
30
29
  portalHostName,
31
30
  portalHostReady,
32
31
  slotsMap,
33
32
  }: UseActivePortalBoundaryHostParams) => {
34
- const [activePortal, setActivePortal] = useState<ActivePortal | null>(null);
35
- const activePairKeyRef = useRef<ScreenPairKey | null>(null);
36
-
37
- const updateActivePortal = useCallback((pairKey: ScreenPairKey | null) => {
38
- if (activePairKeyRef.current === pairKey) {
39
- return;
40
- }
33
+ const [activePairKey, setActivePairKey] = useState<ScreenPairKey | null>(
34
+ null,
35
+ );
41
36
 
42
- activePairKeyRef.current = pairKey;
43
- setActivePortal(pairKey ? { pairKey } : null);
37
+ const updateActivePairKey = useCallback((pairKey: ScreenPairKey | null) => {
38
+ setActivePairKey(pairKey);
44
39
  }, []);
45
40
 
46
41
  useAnimatedReaction(
47
42
  () => {
48
43
  "worklet";
49
- const isBoundaryAnimating = slotsMap.get()[boundaryId] !== undefined;
50
- if (!isBoundaryAnimating) {
44
+ const pairKey = getPairKeyForSource(boundaryId, currentScreenKey);
45
+ const measurement = localMeasurement.get();
46
+ if (!pairKey || measurement?.pairKey !== pairKey) {
51
47
  return null;
52
48
  }
53
49
 
54
- return getPairKeyForSource(boundaryId, currentScreenKey);
50
+ return pairKey;
55
51
  },
56
52
  (pairKey, previousPairKey) => {
57
53
  "worklet";
@@ -59,12 +55,12 @@ export const useActivePortalBoundaryHost = ({
59
55
  return;
60
56
  }
61
57
 
62
- scheduleOnRN(updateActivePortal, pairKey);
58
+ scheduleOnRN(updateActivePairKey, pairKey);
63
59
  },
64
60
  );
65
61
 
66
62
  useLayoutEffect(() => {
67
- if (!activePortal || !escapeHostKey) {
63
+ if (!activePairKey || !escapeHostKey) {
68
64
  portalHostName.set(null);
69
65
  portalHostReady.set(false);
70
66
  return;
@@ -73,16 +69,16 @@ export const useActivePortalBoundaryHost = ({
73
69
  const nextPortalHostName = createBoundaryPortalHostName(
74
70
  escapeHostKey,
75
71
  boundaryId,
76
- activePortal.pairKey,
72
+ activePairKey,
77
73
  );
78
74
 
79
75
  mountPortalBoundaryHost({
80
76
  boundaryId,
81
77
  hostKey: escapeHostKey,
82
- pairKey: activePortal.pairKey,
78
+ localMeasurement,
79
+ pairKey: activePairKey,
83
80
  portalHostName: nextPortalHostName,
84
81
  portalHostReady,
85
- screenKey: currentScreenKey,
86
82
  slotsMap,
87
83
  });
88
84
  portalHostName.set(nextPortalHostName);
@@ -93,10 +89,10 @@ export const useActivePortalBoundaryHost = ({
93
89
  unmountPortalBoundaryHostByName(nextPortalHostName);
94
90
  };
95
91
  }, [
96
- activePortal,
92
+ activePairKey,
97
93
  boundaryId,
98
- currentScreenKey,
99
94
  escapeHostKey,
95
+ localMeasurement,
100
96
  portalHostName,
101
97
  portalHostReady,
102
98
  slotsMap,
@@ -1,6 +1,7 @@
1
1
  import { useAnimatedProps, useSharedValue } from "react-native-reanimated";
2
2
  import { useDescriptorsStore } from "../../../../../../providers/screen/descriptors";
3
3
  import { useScreenSlots } from "../../../../../../providers/screen/styles";
4
+ import type { BoundaryLocalMeasurementValue } from "../../../../types";
4
5
  import { PORTAL_HOST_NAME_RESET_VALUE } from "../../../utils/naming";
5
6
  import { isTeleportEnabled } from "../../../utils/teleport-control";
6
7
  import { useActiveHostKey } from "../stores/host-registry.store";
@@ -8,10 +9,12 @@ import { useActivePortalBoundaryHost } from "./use-active-portal-boundary-host";
8
9
 
9
10
  interface UseBoundaryPortalAttachmentParams {
10
11
  boundaryId: string;
12
+ localMeasurement: BoundaryLocalMeasurementValue;
11
13
  }
12
14
 
13
15
  export const useBoundaryPortalAttachment = ({
14
16
  boundaryId,
17
+ localMeasurement,
15
18
  }: UseBoundaryPortalAttachmentParams) => {
16
19
  const currentScreenKey = useDescriptorsStore(
17
20
  (s) => s.derivations.currentScreenKey,
@@ -25,6 +28,7 @@ export const useBoundaryPortalAttachment = ({
25
28
  boundaryId,
26
29
  currentScreenKey,
27
30
  escapeHostKey,
31
+ localMeasurement,
28
32
  portalHostName,
29
33
  portalHostReady,
30
34
  slotsMap,
@@ -39,10 +43,12 @@ export const useBoundaryPortalAttachment = ({
39
43
  teleport,
40
44
  ...slotProps
41
45
  } = slot?.props ?? {};
46
+
42
47
  const shouldAttach =
43
48
  slot !== undefined &&
44
49
  isTeleportEnabled(teleport) &&
45
50
  portalHostReady.get();
51
+
46
52
  const hostName = shouldAttach
47
53
  ? portalHostName.get()
48
54
  : PORTAL_HOST_NAME_RESET_VALUE;
@@ -1,61 +1,37 @@
1
- import { useLayoutEffect } from "react";
2
1
  import type { View } from "react-native";
3
2
  import {
4
3
  cancelAnimation,
4
+ type MeasuredDimensions,
5
5
  measure,
6
- type SharedValue,
7
6
  useAnimatedReaction,
8
7
  useAnimatedRef,
9
8
  useSharedValue,
10
9
  withDelay,
11
10
  withTiming,
12
11
  } from "react-native-reanimated";
13
- import { scheduleOnUI } from "react-native-worklets";
14
- import { ScrollStore } from "../../../../../../stores/scroll.store";
15
- import { getVisibilityBlockOffset } from "../../../../../../utils/visibility-block-offset";
16
- import {
17
- adjustedMeasuredBoundsForOverscrollDeltas,
18
- correctMeasuredBoundsForVisibilityGate,
19
- } from "../../../../utils/measured-bounds";
20
- import {
21
- clearPortalHostBounds,
22
- setPortalHostBounds,
23
- } from "../stores/host-bounds.store";
24
12
 
25
13
  const HOST_MEASUREMENT_RETRY_DELAY_MS = 16;
26
14
 
27
15
  type UseHostMeasurementParams = {
28
- capturesScroll: boolean;
29
- enabled: boolean;
30
- hostKey: string;
31
- screenKey: string;
32
- visibilityBlocked: SharedValue<boolean>;
33
- viewportHeight: number;
34
- viewportWidth: number;
16
+ measurementKey: string | null;
35
17
  };
36
18
 
37
19
  export const useHostMeasurement = ({
38
- capturesScroll,
39
- enabled,
40
- hostKey,
41
- screenKey,
42
- visibilityBlocked,
43
- viewportHeight,
44
- viewportWidth,
20
+ measurementKey,
45
21
  }: UseHostMeasurementParams) => {
46
22
  const hostRef = useAnimatedRef<View>();
47
- const scrollMetadata = ScrollStore.getValue(screenKey, "metadata");
48
- const hasMeasuredHost = useSharedValue(false);
23
+ const hostBounds = useSharedValue<MeasuredDimensions | null>(null);
24
+ const measuredKey = useSharedValue<string | null>(null);
49
25
  const retryToken = useSharedValue(0);
50
26
 
51
27
  useAnimatedReaction(
52
28
  () => {
53
29
  "worklet";
54
- if (!enabled) {
30
+ if (!measurementKey) {
55
31
  return null;
56
32
  }
57
33
 
58
- return [hasMeasuredHost.get(), retryToken.get()] as const;
34
+ return [measurementKey, measuredKey.get(), retryToken.get()] as const;
59
35
  },
60
36
  (state) => {
61
37
  "worklet";
@@ -64,9 +40,8 @@ export const useHostMeasurement = ({
64
40
  return;
65
41
  }
66
42
 
67
- const [hasAlreadyMeasured] = state;
68
-
69
- if (!enabled || hasAlreadyMeasured) {
43
+ const [requestedKey, completedKey] = state;
44
+ if (requestedKey === completedKey) {
70
45
  return;
71
46
  }
72
47
 
@@ -85,23 +60,7 @@ export const useHostMeasurement = ({
85
60
 
86
61
  cancelAnimation(retryToken);
87
62
 
88
- // A measurement taken mid rubber-band would bake the transient
89
- // overscroll displacement into the host frame. Store the at-rest
90
- // position instead; clamped scroll deltas share that basis.
91
- const currentScroll = scrollMetadata.get();
92
- const overscrollNormalized = capturesScroll
93
- ? adjustedMeasuredBoundsForOverscrollDeltas(measured, currentScroll)
94
- : measured;
95
-
96
- const correctedMeasured = correctMeasuredBoundsForVisibilityGate({
97
- measured: overscrollNormalized,
98
- visibilityBlocked: visibilityBlocked.get(),
99
- visibilityBlockOffset: getVisibilityBlockOffset(viewportHeight),
100
- viewportWidth,
101
- viewportHeight,
102
- });
103
-
104
- if (correctedMeasured.width <= 0 || correctedMeasured.height <= 0) {
63
+ if (measured.width <= 0 || measured.height <= 0) {
105
64
  cancelAnimation(retryToken);
106
65
  retryToken.set(
107
66
  withDelay(
@@ -112,27 +71,20 @@ export const useHostMeasurement = ({
112
71
  return;
113
72
  }
114
73
 
115
- setPortalHostBounds(hostKey, {
116
- x: correctedMeasured.x,
117
- y: correctedMeasured.y,
118
- width: correctedMeasured.width,
119
- height: correctedMeasured.height,
120
- pageX: correctedMeasured.pageX,
121
- pageY: correctedMeasured.pageY,
122
- scroll: capturesScroll ? currentScroll : null,
74
+ hostBounds.set({
75
+ x: measured.x,
76
+ y: measured.y,
77
+ width: measured.width,
78
+ height: measured.height,
79
+ pageX: measured.pageX,
80
+ pageY: measured.pageY,
123
81
  });
124
-
125
- hasMeasuredHost.set(true);
82
+ measuredKey.set(requestedKey);
126
83
  },
127
84
  );
128
-
129
- useLayoutEffect(() => {
130
- return () => {
131
- scheduleOnUI(clearPortalHostBounds, hostKey);
132
- };
133
- }, [hostKey]);
134
-
135
85
  return {
86
+ hostBounds,
136
87
  hostRef,
88
+ measuredKey,
137
89
  };
138
90
  };