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
@@ -0,0 +1,185 @@
1
+ import { NO_STYLES } from "../../../../constants";
2
+ import type {
3
+ NormalizedTransitionInterpolatedStyle,
4
+ NormalizedTransitionSlotStyle,
5
+ } from "../../../../types/animation.types";
6
+
7
+ export type StyleKeySet = Record<string, true>;
8
+
9
+ type StyleKeyMeta = {
10
+ keys: StyleKeySet;
11
+ hasAny: boolean;
12
+ };
13
+
14
+ const IDENTITY_TRANSFORM = [
15
+ { translateX: 0 },
16
+ { translateY: 0 },
17
+ { scaleX: 1 },
18
+ { scaleY: 1 },
19
+ ] as const;
20
+
21
+ const ALWAYS_RESET_STYLE_VALUES = {
22
+ zIndex: 0,
23
+ elevation: 0,
24
+ } as const;
25
+
26
+ const hasAnyKeys = (record: Record<string, unknown>) => {
27
+ "worklet";
28
+ for (const _key in record) {
29
+ return true;
30
+ }
31
+ return false;
32
+ };
33
+
34
+ const collectStyleKeyMeta = (
35
+ record?: Record<string, unknown>,
36
+ ): StyleKeyMeta => {
37
+ "worklet";
38
+ const keys: StyleKeySet = {};
39
+ let hasAny = false;
40
+
41
+ if (!record) {
42
+ return { keys, hasAny };
43
+ }
44
+
45
+ for (const key in record) {
46
+ keys[key] = true;
47
+ hasAny = true;
48
+ }
49
+
50
+ return { keys, hasAny };
51
+ };
52
+
53
+ const collectRelevantSlotIds = ({
54
+ currentStylesMap,
55
+ fallbackStylesMap,
56
+ previousStyleKeysBySlot,
57
+ }: {
58
+ currentStylesMap: NormalizedTransitionInterpolatedStyle;
59
+ fallbackStylesMap: NormalizedTransitionInterpolatedStyle;
60
+ previousStyleKeysBySlot: Record<string, StyleKeySet>;
61
+ }) => {
62
+ "worklet";
63
+ const slotIds: Record<string, true> = {};
64
+
65
+ for (const slotId in currentStylesMap) {
66
+ slotIds[slotId] = true;
67
+ }
68
+
69
+ for (const slotId in fallbackStylesMap) {
70
+ slotIds[slotId] = true;
71
+ }
72
+
73
+ for (const slotId in previousStyleKeysBySlot) {
74
+ slotIds[slotId] = true;
75
+ }
76
+
77
+ return slotIds;
78
+ };
79
+
80
+ const buildUnsetPatch = ({
81
+ previousKeys,
82
+ currentKeys,
83
+ }: {
84
+ previousKeys: StyleKeySet;
85
+ currentKeys: StyleKeySet;
86
+ }) => {
87
+ "worklet";
88
+ const unsetPatch: Record<string, any> = {};
89
+
90
+ for (const key in previousKeys) {
91
+ if (currentKeys[key]) continue;
92
+
93
+ if (key === "transform") {
94
+ unsetPatch.transform = IDENTITY_TRANSFORM;
95
+ continue;
96
+ }
97
+
98
+ if (key in ALWAYS_RESET_STYLE_VALUES) {
99
+ unsetPatch[key] =
100
+ ALWAYS_RESET_STYLE_VALUES[
101
+ key as keyof typeof ALWAYS_RESET_STYLE_VALUES
102
+ ];
103
+ continue;
104
+ }
105
+
106
+ unsetPatch[key] = undefined;
107
+ }
108
+
109
+ return unsetPatch;
110
+ };
111
+
112
+ export const buildResolvedStyleMap = ({
113
+ currentStylesMap,
114
+ fallbackStylesMap,
115
+ previousStyleKeysBySlot,
116
+ }: {
117
+ currentStylesMap: NormalizedTransitionInterpolatedStyle;
118
+ fallbackStylesMap: NormalizedTransitionInterpolatedStyle;
119
+ previousStyleKeysBySlot: Record<string, StyleKeySet>;
120
+ }): {
121
+ resolvedStylesMap: NormalizedTransitionInterpolatedStyle;
122
+ nextPreviousStyleKeysBySlot: Record<string, StyleKeySet>;
123
+ } => {
124
+ "worklet";
125
+ const resolvedStylesMap: NormalizedTransitionInterpolatedStyle = {};
126
+ const nextPreviousStyleKeysBySlot: Record<string, StyleKeySet> = {};
127
+
128
+ const slotIds = collectRelevantSlotIds({
129
+ currentStylesMap,
130
+ fallbackStylesMap,
131
+ previousStyleKeysBySlot,
132
+ });
133
+
134
+ for (const slotId in slotIds) {
135
+ const slot = currentStylesMap[slotId] ?? fallbackStylesMap[slotId];
136
+ const baseStyle = slot?.style as Record<string, unknown> | undefined;
137
+ const { keys: currentKeys, hasAny: hasCurrentStyleKeys } =
138
+ collectStyleKeyMeta(baseStyle);
139
+
140
+ const unsetPatch = buildUnsetPatch({
141
+ previousKeys: previousStyleKeysBySlot[slotId] ?? {},
142
+ currentKeys,
143
+ });
144
+
145
+ const hasUnsetPatch = hasAnyKeys(unsetPatch);
146
+ const hasProps = slot?.props !== undefined;
147
+
148
+ if (!slot && !hasUnsetPatch) {
149
+ continue;
150
+ }
151
+
152
+ const resolvedStyle =
153
+ hasCurrentStyleKeys || hasUnsetPatch
154
+ ? {
155
+ ...unsetPatch,
156
+ ...(slot?.style ?? NO_STYLES),
157
+ }
158
+ : undefined;
159
+
160
+ if (resolvedStyle === undefined && !hasProps) {
161
+ continue;
162
+ }
163
+
164
+ const resolvedSlot = {} as NormalizedTransitionSlotStyle;
165
+
166
+ if (resolvedStyle !== undefined) {
167
+ resolvedSlot.style = resolvedStyle;
168
+ }
169
+
170
+ if (hasProps) {
171
+ resolvedSlot.props = slot?.props;
172
+ }
173
+
174
+ resolvedStylesMap[slotId] = resolvedSlot;
175
+
176
+ if (hasCurrentStyleKeys) {
177
+ nextPreviousStyleKeysBySlot[slotId] = currentKeys;
178
+ }
179
+ }
180
+
181
+ return {
182
+ resolvedStylesMap,
183
+ nextPreviousStyleKeysBySlot,
184
+ };
185
+ };
@@ -0,0 +1,31 @@
1
+ import { NO_STYLES } from "../../../../constants";
2
+ import type {
3
+ NormalizedTransitionInterpolatedStyle,
4
+ TransitionInterpolatedStyle,
5
+ } from "../../../../types/animation.types";
6
+ import { normalizeInterpolatedStyle } from "../../../../utils/normalize-interpolated-style";
7
+
8
+ export type ResolvedInterpolatedStyleOutput = {
9
+ stylesMap: NormalizedTransitionInterpolatedStyle;
10
+ wasLegacy: boolean;
11
+ };
12
+
13
+ export const resolveInterpolatedStyleOutput = (
14
+ raw: TransitionInterpolatedStyle | null | undefined,
15
+ ): ResolvedInterpolatedStyleOutput => {
16
+ "worklet";
17
+
18
+ if (raw == null || typeof raw !== "object") {
19
+ return {
20
+ stylesMap: NO_STYLES,
21
+ wasLegacy: false,
22
+ };
23
+ }
24
+
25
+ const { result, wasLegacy } = normalizeInterpolatedStyle(raw);
26
+
27
+ return {
28
+ stylesMap: result,
29
+ wasLegacy,
30
+ };
31
+ };
@@ -0,0 +1,44 @@
1
+ import {
2
+ NAVIGATION_MASK_CONTAINER_STYLE_ID,
3
+ NAVIGATION_MASK_ELEMENT_STYLE_ID,
4
+ } from "../../../../constants";
5
+ import type { NormalizedTransitionInterpolatedStyle } from "../../../../types/animation.types";
6
+
7
+ const LAYER_STYLE_SLOT_IDS = {
8
+ content: true,
9
+ backdrop: true,
10
+ surface: true,
11
+ [NAVIGATION_MASK_ELEMENT_STYLE_ID]: true,
12
+ [NAVIGATION_MASK_CONTAINER_STYLE_ID]: true,
13
+ } as const;
14
+
15
+ const isLayerStyleSlotId = (slotId: string) => {
16
+ "worklet";
17
+ // biome-ignore lint/suspicious/noPrototypeBuiltins: <Typescript lib target is ES2020>
18
+ return Object.prototype.hasOwnProperty.call(LAYER_STYLE_SLOT_IDS, slotId);
19
+ };
20
+
21
+ export const splitNormalizedStyleMaps = (
22
+ stylesMap: NormalizedTransitionInterpolatedStyle,
23
+ ): {
24
+ layerStylesMap: NormalizedTransitionInterpolatedStyle;
25
+ elementStylesMap: NormalizedTransitionInterpolatedStyle;
26
+ } => {
27
+ "worklet";
28
+ const layerStylesMap: NormalizedTransitionInterpolatedStyle = {};
29
+ const elementStylesMap: NormalizedTransitionInterpolatedStyle = {};
30
+
31
+ for (const slotId in stylesMap) {
32
+ if (isLayerStyleSlotId(slotId)) {
33
+ layerStylesMap[slotId] = stylesMap[slotId];
34
+ continue;
35
+ }
36
+
37
+ elementStylesMap[slotId] = stylesMap[slotId];
38
+ }
39
+
40
+ return {
41
+ layerStylesMap,
42
+ elementStylesMap,
43
+ };
44
+ };
@@ -0,0 +1,5 @@
1
+ export {
2
+ ScreenStylesContext,
3
+ ScreenStylesProvider,
4
+ useScreenStyles,
5
+ } from "./styles.provider";
@@ -4,26 +4,25 @@ import {
4
4
  useDerivedValue,
5
5
  useSharedValue,
6
6
  } from "react-native-reanimated";
7
- import { NO_STYLES } from "../../constants";
8
- import type { NormalizedTransitionInterpolatedStyle } from "../../types/animation.types";
9
- import createProvider from "../../utils/create-provider";
10
- import { logger } from "../../utils/logger";
11
- import { useScreenAnimationContext } from "./animation";
7
+ import { NO_STYLES } from "../../../constants";
8
+ import type { NormalizedTransitionInterpolatedStyle } from "../../../types/animation.types";
9
+ import createProvider from "../../../utils/create-provider";
10
+ import { logger } from "../../../utils/logger";
11
+ import { useScreenAnimationContext } from "../animation";
12
12
  import {
13
- PASS_THROUGH_STYLE_OUTPUT,
14
- resolveEffectiveResolutionMode,
15
- resolveInterpolatedStyleOutput,
16
- type ScreenStyleResolutionMode,
17
- } from "./helpers/resolve-interpolated-style-output";
13
+ buildResolvedStyleMap,
14
+ type StyleKeySet,
15
+ } from "./helpers/build-resolved-style-map";
16
+ import { resolveInterpolatedStyleOutput } from "./helpers/resolve-interpolated-style-output";
17
+ import { splitNormalizedStyleMaps } from "./helpers/split-normalized-style-maps";
18
18
 
19
19
  type Props = {
20
20
  children: ReactNode;
21
21
  };
22
22
 
23
23
  type ScreenStylesContextValue = {
24
- stylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
25
- ancestorStylesMaps: SharedValue<NormalizedTransitionInterpolatedStyle>[];
26
- resolutionMode: SharedValue<ScreenStyleResolutionMode>;
24
+ layerStylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
25
+ elementStylesMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
27
26
  };
28
27
 
29
28
  export const {
@@ -34,7 +33,7 @@ export const {
34
33
  guarded: true,
35
34
  })<Props, ScreenStylesContextValue>(
36
35
  ({ children }): { value: ScreenStylesContextValue; children: ReactNode } => {
37
- const parentCtx = useContext(ScreenStylesContext);
36
+ const parentContext = useContext(ScreenStylesContext);
38
37
 
39
38
  const {
40
39
  screenInterpolatorProps,
@@ -43,16 +42,15 @@ export const {
43
42
  boundsAccessor,
44
43
  } = useScreenAnimationContext();
45
44
 
46
- /**
47
- * Tracks when user starts a gesture while another screen is still closing.
48
- * This persists until both the gesture ends AND the closing animation completes.
49
- */
50
45
  const isGesturingDuringCloseAnimation = useSharedValue(false);
51
46
  const hasWarnedLegacy = useSharedValue(false);
47
+ const previousElementStyleKeysBySlot = useSharedValue<
48
+ Record<string, StyleKeySet>
49
+ >({});
52
50
 
53
- const styleResolution = useDerivedValue<{
54
- stylesMap: NormalizedTransitionInterpolatedStyle;
55
- resolutionMode: ScreenStyleResolutionMode;
51
+ const rawStyleResolution = useDerivedValue<{
52
+ layerStylesMap: NormalizedTransitionInterpolatedStyle;
53
+ elementStylesMap: NormalizedTransitionInterpolatedStyle;
56
54
  }>(() => {
57
55
  "worklet";
58
56
  const props = screenInterpolatorProps.value;
@@ -71,21 +69,17 @@ export const {
71
69
  const isInGestureMode =
72
70
  isDragging || isGesturingDuringCloseAnimation.value;
73
71
 
74
- // Select interpolator
75
- // - If in gesture mode, use current screen's interpolator since we're driving
76
- // the animation from this screen (dragging back to dismiss next).
77
72
  const interpolator = isInGestureMode
78
73
  ? currentInterpolator
79
74
  : (nextInterpolator ?? currentInterpolator);
80
75
 
81
76
  if (!interpolator) {
82
- return PASS_THROUGH_STYLE_OUTPUT;
77
+ return {
78
+ layerStylesMap: NO_STYLES,
79
+ elementStylesMap: NO_STYLES,
80
+ };
83
81
  }
84
82
 
85
- // Build effective props with corrected progress
86
- // - Gesture mode: use current.progress only (avoids jumps during drag)
87
- // - Normal: use derived progress as-is
88
-
89
83
  let effectiveProgress = progress;
90
84
  let effectiveNext = next;
91
85
 
@@ -102,8 +96,10 @@ export const {
102
96
  bounds: boundsAccessor,
103
97
  });
104
98
 
105
- const { stylesMap, resolutionMode, wasLegacy } =
106
- resolveInterpolatedStyleOutput(raw);
99
+ const { stylesMap, wasLegacy } = resolveInterpolatedStyleOutput(raw);
100
+
101
+ const { layerStylesMap, elementStylesMap } =
102
+ splitNormalizedStyleMaps(stylesMap);
107
103
 
108
104
  if (__DEV__ && wasLegacy && !hasWarnedLegacy.value) {
109
105
  hasWarnedLegacy.value = true;
@@ -114,11 +110,8 @@ export const {
114
110
  }
115
111
 
116
112
  return {
117
- stylesMap,
118
- resolutionMode: resolveEffectiveResolutionMode({
119
- resolutionMode,
120
- isSettled: current.settled === 1,
121
- }),
113
+ layerStylesMap,
114
+ elementStylesMap,
122
115
  };
123
116
  } catch (err) {
124
117
  if (__DEV__) {
@@ -127,37 +120,42 @@ export const {
127
120
  err,
128
121
  );
129
122
  }
123
+
130
124
  return {
131
- stylesMap: NO_STYLES as NormalizedTransitionInterpolatedStyle,
132
- resolutionMode: "live" as const,
125
+ layerStylesMap: NO_STYLES,
126
+ elementStylesMap: NO_STYLES,
133
127
  };
134
128
  }
135
129
  });
136
130
 
137
- const stylesMap = useDerivedValue<NormalizedTransitionInterpolatedStyle>(
138
- () => {
131
+ const layerStylesMap =
132
+ useDerivedValue<NormalizedTransitionInterpolatedStyle>(() => {
139
133
  "worklet";
140
- return styleResolution.value.stylesMap;
141
- },
142
- );
134
+ return rawStyleResolution.value.layerStylesMap;
135
+ });
143
136
 
144
- const resolutionMode = useDerivedValue<ScreenStyleResolutionMode>(() => {
145
- "worklet";
146
- return styleResolution.value.resolutionMode;
147
- });
137
+ const elementStylesMap =
138
+ useDerivedValue<NormalizedTransitionInterpolatedStyle>(() => {
139
+ "worklet";
140
+ const { resolvedStylesMap, nextPreviousStyleKeysBySlot } =
141
+ buildResolvedStyleMap({
142
+ currentStylesMap: rawStyleResolution.value.elementStylesMap,
143
+ fallbackStylesMap:
144
+ parentContext?.elementStylesMap.value ?? NO_STYLES,
145
+ previousStyleKeysBySlot: previousElementStyleKeysBySlot.value,
146
+ });
148
147
 
149
- const value = useMemo<ScreenStylesContextValue>(() => {
150
- // Build ancestor chain: [parent, grandparent, great-grandparent, ...]
151
- const ancestorStylesMaps = parentCtx
152
- ? [parentCtx.stylesMap, ...parentCtx.ancestorStylesMaps]
153
- : [];
148
+ previousElementStyleKeysBySlot.value = nextPreviousStyleKeysBySlot;
154
149
 
150
+ return resolvedStylesMap;
151
+ });
152
+
153
+ const value = useMemo<ScreenStylesContextValue>(() => {
155
154
  return {
156
- stylesMap,
157
- ancestorStylesMaps,
158
- resolutionMode,
155
+ layerStylesMap,
156
+ elementStylesMap,
159
157
  };
160
- }, [resolutionMode, stylesMap, parentCtx]);
158
+ }, [elementStylesMap, layerStylesMap]);
161
159
 
162
160
  return { value, children };
163
161
  },
@@ -7,31 +7,40 @@ import { createStore } from "../utils/create-store";
7
7
 
8
8
  export type AnimationStoreMap = {
9
9
  progress: SharedValue<number>;
10
+ willAnimate: SharedValue<number>;
10
11
  animating: SharedValue<number>;
11
12
  closing: SharedValue<number>;
12
13
  entering: SharedValue<number>;
14
+ settled: SharedValue<number>;
15
+ logicallySettled: SharedValue<number>;
13
16
  };
14
17
 
15
18
  function createAnimationBag(): AnimationStoreMap {
16
19
  return {
17
20
  progress: makeMutable(0),
21
+ willAnimate: makeMutable(0),
18
22
  closing: makeMutable(0),
19
23
  animating: makeMutable(0),
20
24
  entering: makeMutable(0),
25
+ settled: makeMutable(1),
26
+ logicallySettled: makeMutable(1),
21
27
  };
22
28
  }
23
29
 
24
30
  /**
25
31
  * Route-keyed screen transition state for the public animation lifecycle. These
26
- * shared values track the current progress and whether a screen is entering,
27
- * closing, or actively animating.
32
+ * shared values track the current progress, whether a transition is about to
33
+ * begin, and whether a screen is entering, closing, or actively animating.
28
34
  */
29
35
  export const AnimationStore = createStore<AnimationStoreMap>({
30
36
  createBag: createAnimationBag,
31
37
  disposeBag: (bag) => {
32
38
  cancelAnimation(bag.progress);
39
+ cancelAnimation(bag.willAnimate);
33
40
  cancelAnimation(bag.animating);
34
41
  cancelAnimation(bag.closing);
35
42
  cancelAnimation(bag.entering);
43
+ cancelAnimation(bag.settled);
44
+ cancelAnimation(bag.logicallySettled);
36
45
  },
37
46
  });
@@ -204,6 +204,22 @@ const findLatestPendingIndex = (
204
204
  return -1;
205
205
  };
206
206
 
207
+ const findLatestSourceIndex = (
208
+ stack: TagLink[],
209
+ expectedSourceScreenKey?: ScreenKey,
210
+ ): number => {
211
+ "worklet";
212
+ if (!expectedSourceScreenKey) return -1;
213
+
214
+ for (let i = stack.length - 1; i >= 0; i--) {
215
+ if (matchesScreenKey(stack[i].source, expectedSourceScreenKey)) {
216
+ return i;
217
+ }
218
+ }
219
+
220
+ return -1;
221
+ };
222
+
207
223
  function setLinkDestination(
208
224
  tag: TagID,
209
225
  screenKey: ScreenKey,
@@ -221,12 +237,13 @@ function setLinkDestination(
221
237
  const stack = tagState?.linkStack;
222
238
  if (!stack || stack.length === 0) return state;
223
239
 
224
- const targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
240
+ let targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
241
+ if (targetIndex === -1) {
242
+ targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
243
+ }
225
244
  if (targetIndex === -1) return state;
226
245
 
227
246
  const targetLink = stack[targetIndex];
228
- if (targetLink.destination !== null) return state;
229
-
230
247
  targetLink.destination = {
231
248
  screenKey,
232
249
  ancestorKeys,
@@ -272,6 +289,10 @@ function updateLinkDestination(
272
289
  targetIndex = findLatestPendingIndex(stack, expectedSourceScreenKey);
273
290
  }
274
291
 
292
+ if (targetIndex === -1) {
293
+ targetIndex = findLatestSourceIndex(stack, expectedSourceScreenKey);
294
+ }
295
+
275
296
  if (targetIndex === -1) {
276
297
  return state;
277
298
  }
@@ -1,4 +1,3 @@
1
- import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
1
  import { matchesScreenKey } from "../helpers/matching";
3
2
  import type {
4
3
  ResolvedTransitionPair,
@@ -8,7 +7,6 @@ import type {
8
7
  TagLink,
9
8
  TagState,
10
9
  } from "../types";
11
- import { getSnapshot } from "./registry";
12
10
  import { debugResolverLog, registry } from "./state";
13
11
 
14
12
  const findLatestLink = (
@@ -67,30 +65,6 @@ function findPendingLinkBySource(
67
65
  );
68
66
  }
69
67
 
70
- function getSnapshotBoundsByPriority(
71
- tag: TagID,
72
- keys: (ScreenKey | undefined)[],
73
- ): {
74
- bounds: MeasuredDimensions;
75
- styles: StyleProps;
76
- screenKey: ScreenKey;
77
- } | null {
78
- "worklet";
79
- for (let i = 0; i < keys.length; i++) {
80
- const key = keys[i];
81
- if (!key) continue;
82
- const snapshot = getSnapshot(tag, key);
83
- if (!snapshot) continue;
84
- return {
85
- bounds: snapshot.bounds,
86
- styles: snapshot.styles,
87
- screenKey: key,
88
- };
89
- }
90
-
91
- return null;
92
- }
93
-
94
68
  function resolveTransitionPair(
95
69
  tag: TagID,
96
70
  context: ResolveTransitionContext,
@@ -153,53 +127,12 @@ function resolveTransitionPair(
153
127
  }
154
128
  }
155
129
 
156
- let sourceBounds = matchedLink?.source?.bounds ?? null;
157
- let destinationBounds = matchedLink?.destination?.bounds ?? null;
158
- let sourceStyles = matchedLink?.source?.styles ?? null;
159
- let destinationStyles = matchedLink?.destination?.styles ?? null;
160
- let sourceScreenKey = matchedLink?.source?.screenKey ?? null;
161
- let destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
162
- let usedSnapshotSource = false;
163
- let usedSnapshotDestination = false;
164
-
165
- const sourceFallbackKeys = context.entering
166
- ? [
167
- context.previousScreenKey,
168
- context.currentScreenKey,
169
- context.nextScreenKey,
170
- ]
171
- : [
172
- context.currentScreenKey,
173
- context.previousScreenKey,
174
- context.nextScreenKey,
175
- ];
176
-
177
- const destinationFallbackKeys = context.entering
178
- ? [context.currentScreenKey, context.nextScreenKey]
179
- : [context.nextScreenKey, context.currentScreenKey];
180
-
181
- if (!sourceBounds) {
182
- const sourceSnapshot = getSnapshotBoundsByPriority(tag, sourceFallbackKeys);
183
- if (sourceSnapshot) {
184
- sourceBounds = sourceSnapshot.bounds;
185
- sourceStyles = sourceSnapshot.styles;
186
- sourceScreenKey = sourceSnapshot.screenKey;
187
- usedSnapshotSource = true;
188
- }
189
- }
190
-
191
- if (!destinationBounds) {
192
- const destinationSnapshot = getSnapshotBoundsByPriority(
193
- tag,
194
- destinationFallbackKeys,
195
- );
196
- if (destinationSnapshot) {
197
- destinationBounds = destinationSnapshot.bounds;
198
- destinationStyles = destinationSnapshot.styles;
199
- destinationScreenKey = destinationSnapshot.screenKey;
200
- usedSnapshotDestination = true;
201
- }
202
- }
130
+ const sourceBounds = matchedLink?.source?.bounds ?? null;
131
+ const destinationBounds = matchedLink?.destination?.bounds ?? null;
132
+ const sourceStyles = matchedLink?.source?.styles ?? null;
133
+ const destinationStyles = matchedLink?.destination?.styles ?? null;
134
+ const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
135
+ const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
203
136
 
204
137
  if (!sourceBounds || !destinationBounds) {
205
138
  debugResolverLog(
@@ -217,8 +150,6 @@ function resolveTransitionPair(
217
150
  sourceScreenKey,
218
151
  destinationScreenKey,
219
152
  usedPending,
220
- usedSnapshotSource,
221
- usedSnapshotDestination,
222
153
  };
223
154
  }
224
155
 
@@ -48,8 +48,6 @@ export type ResolvedTransitionPair = {
48
48
  sourceScreenKey: ScreenKey | null;
49
49
  destinationScreenKey: ScreenKey | null;
50
50
  usedPending: boolean;
51
- usedSnapshotSource: boolean;
52
- usedSnapshotDestination: boolean;
53
51
  };
54
52
 
55
53
  export type SnapshotEntry = Snapshot & {