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
@@ -1,4 +1,4 @@
1
- import { interpolate } from "react-native-reanimated";
1
+ import { interpolate, makeMutable } from "react-native-reanimated";
2
2
  import {
3
3
  EPSILON,
4
4
  HIDDEN_STYLE,
@@ -17,6 +17,8 @@ import type { BoundsOptions } from "../types/options";
17
17
  import {
18
18
  getZoomAnchor,
19
19
  toNumber,
20
+ ZOOM_BACKGROUND_SCALE,
21
+ ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
20
22
  ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
21
23
  ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
22
24
  ZOOM_DRAG_RESISTANCE,
@@ -33,18 +35,22 @@ import {
33
35
  import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
34
36
 
35
37
  const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
38
+ const UNFOCUSED_ENTER_FADE_END = 1.6;
39
+ const presentedZoomTagByRoute = makeMutable<Record<string, string>>({});
36
40
 
37
- const getSourceBorderRadius = (
38
- resolvedPair: ResolvedTransitionPair,
39
- ): number => {
41
+ /* -------------------------------------------------------------------------- */
42
+ /* LOCAL HELPERS */
43
+ /* -------------------------------------------------------------------------- */
44
+
45
+ function getSourceBorderRadius(resolvedPair: ResolvedTransitionPair): number {
40
46
  "worklet";
41
47
 
42
48
  return typeof resolvedPair.sourceStyles?.borderRadius === "number"
43
49
  ? resolvedPair.sourceStyles.borderRadius
44
50
  : 0;
45
- };
51
+ }
46
52
 
47
- const getZoomContentTarget = ({
53
+ function getZoomContentTarget({
48
54
  explicitTarget,
49
55
  screenLayout,
50
56
  anchor,
@@ -54,7 +60,7 @@ const getZoomContentTarget = ({
54
60
  screenLayout: Layout;
55
61
  anchor: BoundsOptions["anchor"] | undefined;
56
62
  resolvedPair: ResolvedTransitionPair;
57
- }) => {
63
+ }) {
58
64
  "worklet";
59
65
 
60
66
  if (explicitTarget) return explicitTarget;
@@ -90,71 +96,183 @@ const getZoomContentTarget = ({
90
96
  width: screenWidth,
91
97
  height,
92
98
  };
93
- };
99
+ }
100
+
101
+ function resolveDragScaleTuple(
102
+ value:
103
+ | readonly [shrinkMin: number, growMax: number, exponent?: number]
104
+ | undefined,
105
+ ) {
106
+ "worklet";
107
+
108
+ return {
109
+ shrinkMin: value?.[0] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
110
+ growMax: value?.[1] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
111
+ exponent: value?.[2] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
112
+ };
113
+ }
114
+
115
+ function resolveBackgroundScale(value: number | undefined) {
116
+ "worklet";
117
+
118
+ return value ?? ZOOM_BACKGROUND_SCALE;
119
+ }
120
+
121
+ function resolveEffectiveZoomTag(params: {
122
+ resolvedTag: string;
123
+ activeRouteKey?: string;
124
+ entering: boolean;
125
+ animating: boolean;
126
+ activeProgress: number;
127
+ livePairReady: boolean;
128
+ }) {
129
+ "worklet";
130
+
131
+ const {
132
+ resolvedTag,
133
+ activeRouteKey,
134
+ entering,
135
+ animating,
136
+ activeProgress,
137
+ livePairReady,
138
+ } = params;
139
+
140
+ // Only grouped ids need retarget stabilization. Plain ids should keep their
141
+ // normal behavior with no route-level caching.
142
+ if (!activeRouteKey || !resolvedTag.includes(":")) {
143
+ return resolvedTag;
144
+ }
145
+
146
+ const cachedTag = presentedZoomTagByRoute.value[activeRouteKey];
147
+ const isFreshOpenFrame = entering && activeProgress <= 0.05;
148
+ const shouldFreezeDuringEnter = entering && animating && !isFreshOpenFrame;
94
149
 
95
- export const buildZoomStyles = ({
150
+ if (!cachedTag || isFreshOpenFrame) {
151
+ presentedZoomTagByRoute.modify((state) => ({
152
+ ...state,
153
+ [activeRouteKey]: resolvedTag,
154
+ }));
155
+ return resolvedTag;
156
+ }
157
+
158
+ if (shouldFreezeDuringEnter) {
159
+ return cachedTag;
160
+ }
161
+
162
+ // After the enter animation, grouped retargeting can still briefly point at a
163
+ // new active id before that tag has usable bounds. Keep presenting the last
164
+ // good tag until the next one is transition-ready.
165
+ if (cachedTag !== resolvedTag && !livePairReady) {
166
+ return cachedTag;
167
+ }
168
+
169
+ if (cachedTag !== resolvedTag) {
170
+ presentedZoomTagByRoute.modify((state) => ({
171
+ ...state,
172
+ [activeRouteKey]: resolvedTag,
173
+ }));
174
+ }
175
+
176
+ return resolvedTag;
177
+ }
178
+
179
+ /* -------------------------------------------------------------------------- */
180
+ /* BUILD ZOOM STYLES */
181
+ /* -------------------------------------------------------------------------- */
182
+
183
+ export function buildZoomStyles({
96
184
  resolvedTag,
97
185
  zoomOptions,
98
186
  props,
99
- }: BuildZoomStylesParams): ZoomInterpolatedStyle => {
187
+ }: BuildZoomStylesParams): ZoomInterpolatedStyle {
100
188
  "worklet";
101
189
 
102
190
  if (!resolvedTag) return {};
103
191
 
104
- const explicitTarget = zoomOptions?.target;
105
- const debug = zoomOptions?.DEBUG === true;
192
+ /* ------------------------------ Shared Setup ------------------------------ */
106
193
 
194
+ const explicitTarget = zoomOptions?.target;
107
195
  const focused = props.focused;
108
196
  const progress = props.progress;
197
+ const screenLayout = props.layouts.screen;
198
+ const isEnteringTransition = !props.next;
199
+ const activeRouteKey = props.active.route.key;
109
200
  const currentRouteKey = props.current?.route.key;
110
201
  const previousRouteKey = props.previous?.route.key;
111
202
  const nextRouteKey = props.next?.route.key;
112
- const entering = !props.next;
113
- const screenLayout = props.layouts.screen;
114
203
  const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
204
+ const liveResolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
205
+ currentScreenKey: currentRouteKey,
206
+ previousScreenKey: previousRouteKey,
207
+ nextScreenKey: nextRouteKey,
208
+ entering: isEnteringTransition,
209
+ });
210
+ const effectiveTag = resolveEffectiveZoomTag({
211
+ resolvedTag,
212
+ activeRouteKey,
213
+ entering: !!props.active.entering,
214
+ animating: !!props.active.animating,
215
+ activeProgress: props.active.progress,
216
+ livePairReady: !!liveResolvedPair.sourceBounds,
217
+ });
218
+
115
219
  const zoomComputeParams = {
116
- id: resolvedTag,
220
+ id: effectiveTag,
117
221
  previous: props.previous,
118
222
  current: props.current,
119
223
  next: props.next,
120
224
  progress,
121
225
  dimensions: screenLayout,
122
226
  } as const;
227
+
123
228
  const baseRawOptions = {
124
- id: resolvedTag,
229
+ id: effectiveTag,
125
230
  raw: true,
126
231
  scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
127
232
  } as const;
128
233
 
129
- const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
130
- currentScreenKey: currentRouteKey,
131
- previousScreenKey: previousRouteKey,
132
- nextScreenKey: nextRouteKey,
133
- entering,
134
- });
234
+ const resolvedPair =
235
+ effectiveTag === resolvedTag
236
+ ? liveResolvedPair
237
+ : BoundStore.resolveTransitionPair(effectiveTag, {
238
+ currentScreenKey: currentRouteKey,
239
+ previousScreenKey: previousRouteKey,
240
+ nextScreenKey: nextRouteKey,
241
+ entering: isEnteringTransition,
242
+ });
135
243
 
136
244
  const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
137
245
  const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
138
-
139
- const focusedVisibilityStyles = {
140
- [resolvedTag]: VISIBLE_STYLE,
246
+ const sourceVisibilityStyle = {
247
+ [effectiveTag]: VISIBLE_STYLE,
141
248
  } satisfies TransitionInterpolatedStyle;
142
- const focusedContainerStyleId = props.navigationMaskEnabled
249
+ const focusedContentSlot = props.navigationMaskEnabled
143
250
  ? NAVIGATION_MASK_CONTAINER_STYLE_ID
144
251
  : "content";
145
252
 
146
- // To avoid initial flickering, we'll want to hide if there are no source bounds
147
- // But to also avoid scenarios where activeId changes in dst and theres a failed measurement,
148
- // we should only hide if entering and there is no source bounds.
149
- if (!resolvedPair.sourceBounds && props.active.entering) {
253
+ /* --------------------------- Missing Source Guard -------------------------- */
254
+
255
+ // Only the focused entering route should be hidden when source bounds are
256
+ // missing. During grouped retargeting, the unfocused/source route can still be
257
+ // styled by the destination interpolator while the new active member is warming
258
+ // up; hiding there blanks the wrong screen.
259
+ if (focused && !resolvedPair.sourceBounds && props.active.entering) {
150
260
  return {
151
- [focusedContainerStyleId]: HIDDEN_STYLE,
261
+ [focusedContentSlot]: HIDDEN_STYLE,
152
262
  };
153
263
  }
154
264
 
265
+ /* --------------------------- Gesture / Drag Values ------------------------- */
266
+
155
267
  const normX = props.active.gesture.normX;
156
268
  const normY = props.active.gesture.normY;
157
269
  const initialDirection = props.active.gesture.direction;
270
+ const isHorizontalDismiss =
271
+ initialDirection === "horizontal" ||
272
+ initialDirection === "horizontal-inverted";
273
+ const isVerticalDismiss =
274
+ initialDirection === "vertical" || initialDirection === "vertical-inverted";
275
+
158
276
  const dragX = normalizedToTranslation({
159
277
  normalized: normX,
160
278
  dimension: screenLayout.width,
@@ -165,35 +283,40 @@ export const buildZoomStyles = ({
165
283
  dimension: screenLayout.height,
166
284
  resistance: ZOOM_DRAG_RESISTANCE,
167
285
  });
168
- const dragXScale =
169
- initialDirection === "horizontal" ||
170
- initialDirection === "horizontal-inverted"
171
- ? resolveDirectionalDragScale({
172
- normalized: normX,
173
- dismissDirection:
174
- initialDirection === "horizontal-inverted"
175
- ? "negative"
176
- : "positive",
177
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
178
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
179
- exponent: 2,
180
- })
181
- : IDENTITY_DRAG_SCALE_OUTPUT[0];
182
- const dragYScale =
183
- initialDirection === "vertical" || initialDirection === "vertical-inverted"
184
- ? resolveDirectionalDragScale({
185
- normalized: normY,
186
- dismissDirection:
187
- initialDirection === "vertical-inverted" ? "negative" : "positive",
188
- shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
189
- growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
190
- exponent: 2,
191
- })
192
- : IDENTITY_DRAG_SCALE_OUTPUT[1];
286
+ const horizontalDragScale = resolveDragScaleTuple(
287
+ zoomOptions?.horizontalDragScale,
288
+ );
289
+ const verticalDragScale = resolveDragScaleTuple(
290
+ zoomOptions?.verticalDragScale,
291
+ );
292
+ const backgroundScale = resolveBackgroundScale(zoomOptions?.backgroundScale);
293
+
294
+ const dragXScale = isHorizontalDismiss
295
+ ? resolveDirectionalDragScale({
296
+ normalized: normX,
297
+ dismissDirection:
298
+ initialDirection === "horizontal-inverted" ? "negative" : "positive",
299
+ shrinkMin: horizontalDragScale.shrinkMin,
300
+ growMax: horizontalDragScale.growMax,
301
+ exponent: horizontalDragScale.exponent,
302
+ })
303
+ : IDENTITY_DRAG_SCALE_OUTPUT[0];
304
+ const dragYScale = isVerticalDismiss
305
+ ? resolveDirectionalDragScale({
306
+ normalized: normY,
307
+ dismissDirection:
308
+ initialDirection === "vertical-inverted" ? "negative" : "positive",
309
+ shrinkMin: verticalDragScale.shrinkMin,
310
+ growMax: verticalDragScale.growMax,
311
+ exponent: verticalDragScale.exponent,
312
+ })
313
+ : IDENTITY_DRAG_SCALE_OUTPUT[1];
193
314
  const dragScale = combineScales(dragXScale, dragYScale);
194
315
 
316
+ /* ----------------------------- Focused Screen ----------------------------- */
317
+
195
318
  if (focused) {
196
- const contentTarget = getZoomContentTarget({
319
+ const focusedContentTarget = getZoomContentTarget({
197
320
  explicitTarget,
198
321
  screenLayout,
199
322
  anchor: ZOOM_SHARED_OPTIONS.anchor,
@@ -206,7 +329,7 @@ export const buildZoomStyles = ({
206
329
  ...baseRawOptions,
207
330
  anchor: resolvedZoomAnchor,
208
331
  method: "content",
209
- target: contentTarget,
332
+ target: focusedContentTarget,
210
333
  },
211
334
  resolvedPair,
212
335
  ) as Record<string, unknown>;
@@ -224,8 +347,8 @@ export const buildZoomStyles = ({
224
347
  ) as Record<string, unknown>;
225
348
 
226
349
  const focusedFade = props.active?.closing
227
- ? interpolate(progress, [0.6, 1], [0, debug ? 0.5 : 1], "clamp")
228
- : interpolate(progress, [0, 0.5], [0, debug ? 0.5 : 1], "clamp");
350
+ ? interpolate(progress, [0.6, 1], [0, 1], "clamp")
351
+ : interpolate(progress, [0, 0.5], [0, 1], "clamp");
229
352
 
230
353
  /**
231
354
  * This is also how swiftui handles their navigation zoom.
@@ -247,6 +370,7 @@ export const buildZoomStyles = ({
247
370
  const contentScale = toNumber(contentRaw.scale, 1) * dragScale;
248
371
  const maskTranslateX = toNumber(maskRaw.translateX) + dragX - left;
249
372
  const maskTranslateY = toNumber(maskRaw.translateY) + dragY - top;
373
+
250
374
  const focusedContentStyle = {
251
375
  opacity: focusedFade,
252
376
  transform: [
@@ -259,10 +383,10 @@ export const buildZoomStyles = ({
259
383
  };
260
384
 
261
385
  const focusedStyles: ZoomInterpolatedStyle = {
262
- [focusedContainerStyleId]: {
386
+ [focusedContentSlot]: {
263
387
  style: focusedContentStyle,
264
388
  },
265
- ...focusedVisibilityStyles,
389
+ ...sourceVisibilityStyle,
266
390
  };
267
391
 
268
392
  if (props.navigationMaskEnabled) {
@@ -283,22 +407,32 @@ export const buildZoomStyles = ({
283
407
  return focusedStyles;
284
408
  }
285
409
 
286
- const unfocusedFade = props.active?.closing
287
- ? interpolate(progress, [1.6, 2], [1, debug ? 1 : 0], "clamp")
288
- : interpolate(progress, [1, 1.5], [1, debug ? 1 : 0], "clamp");
410
+ /* ---------------------------- Unfocused Screen ---------------------------- */
289
411
 
290
- const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
412
+ const unfocusedFade = props.active?.closing
413
+ ? interpolate(progress, [1.9, 2], [1, 0], "clamp")
414
+ : interpolate(progress, [1, 2], [1, 0], "clamp");
415
+ const unfocusedScale = interpolate(
416
+ progress,
417
+ [1, 2],
418
+ [1, backgroundScale],
419
+ "clamp",
420
+ );
291
421
  const isUnfocusedIdle = props.active.settled === 1;
292
- const shouldHideUnfocusedIdle = isUnfocusedIdle && !debug;
293
- const elementTarget =
294
- explicitTarget !== undefined || resolvedPair.destinationBounds
295
- ? getZoomContentTarget({
296
- explicitTarget,
297
- screenLayout,
298
- anchor: ZOOM_SHARED_OPTIONS.anchor,
299
- resolvedPair,
300
- })
301
- : ("fullscreen" as const);
422
+ const shouldHideUnfocusedIdle = isUnfocusedIdle;
423
+ const didSourceComponentVisiblyHide =
424
+ !props.active.closing && unfocusedFade <= EPSILON;
425
+
426
+ const shouldResetUnfocusedElement =
427
+ !props.active.closing &&
428
+ (props.active.logicallySettled || didSourceComponentVisiblyHide);
429
+
430
+ const unfocusedElementTarget = getZoomContentTarget({
431
+ explicitTarget,
432
+ screenLayout,
433
+ anchor: ZOOM_SHARED_OPTIONS.anchor,
434
+ resolvedPair,
435
+ });
302
436
 
303
437
  const elementRaw = computeBoundStyles(
304
438
  zoomComputeParams,
@@ -307,10 +441,11 @@ export const buildZoomStyles = ({
307
441
  anchor: resolvedZoomAnchor,
308
442
  method: "transform",
309
443
  space: "relative",
310
- target: elementTarget,
444
+ target: unfocusedElementTarget,
311
445
  },
312
446
  resolvedPair,
313
447
  ) as Record<string, unknown>;
448
+
314
449
  const boundTargetCenterX =
315
450
  explicitTarget === "bound" && resolvedPair.destinationBounds
316
451
  ? resolvedPair.destinationBounds.pageX +
@@ -321,16 +456,18 @@ export const buildZoomStyles = ({
321
456
  ? resolvedPair.destinationBounds.pageY +
322
457
  resolvedPair.destinationBounds.height / 2
323
458
  : undefined;
459
+
324
460
  const elementCenterX =
325
461
  boundTargetCenterX ??
326
- (typeof elementTarget === "object"
327
- ? elementTarget.pageX + elementTarget.width / 2
462
+ (typeof unfocusedElementTarget === "object"
463
+ ? unfocusedElementTarget.pageX + unfocusedElementTarget.width / 2
328
464
  : screenLayout.width / 2);
329
465
  const elementCenterY =
330
466
  boundTargetCenterY ??
331
- (typeof elementTarget === "object"
332
- ? elementTarget.pageY + elementTarget.height / 2
467
+ (typeof unfocusedElementTarget === "object"
468
+ ? unfocusedElementTarget.pageY + unfocusedElementTarget.height / 2
333
469
  : screenLayout.height / 2);
470
+
334
471
  const scaleShiftX = computeCenterScaleShift({
335
472
  center: elementCenterX,
336
473
  containerCenter: screenLayout.width / 2,
@@ -341,6 +478,7 @@ export const buildZoomStyles = ({
341
478
  containerCenter: screenLayout.height / 2,
342
479
  scale: dragScale,
343
480
  });
481
+
344
482
  const compensatedGestureX = composeCompensatedTranslation({
345
483
  gesture: dragX,
346
484
  parentScale: unfocusedScale,
@@ -353,12 +491,14 @@ export const buildZoomStyles = ({
353
491
  centerShift: scaleShiftY,
354
492
  epsilon: EPSILON,
355
493
  });
494
+
356
495
  const elementTranslateX =
357
496
  toNumber(elementRaw.translateX) + compensatedGestureX;
358
497
  const elementTranslateY =
359
498
  toNumber(elementRaw.translateY) + compensatedGestureY;
360
499
  const elementScaleX = toNumber(elementRaw.scaleX, 1) * dragScale;
361
500
  const elementScaleY = toNumber(elementRaw.scaleY, 1) * dragScale;
501
+
362
502
  const resolvedElementStyle = shouldHideUnfocusedIdle
363
503
  ? {
364
504
  transform: [
@@ -374,31 +514,19 @@ export const buildZoomStyles = ({
374
514
  : {
375
515
  transform: [
376
516
  {
377
- translateX:
378
- props.active.logicallySettled && !props.active.closing
379
- ? 0
380
- : elementTranslateX,
517
+ translateX: shouldResetUnfocusedElement ? 0 : elementTranslateX,
381
518
  },
382
519
  {
383
- translateY:
384
- props.active.logicallySettled && !props.active.closing
385
- ? 0
386
- : elementTranslateY,
520
+ translateY: shouldResetUnfocusedElement ? 0 : elementTranslateY,
387
521
  },
388
522
  {
389
- scaleX:
390
- props.active.logicallySettled && !props.active.closing
391
- ? 1
392
- : elementScaleX,
523
+ scaleX: shouldResetUnfocusedElement ? 1 : elementScaleX,
393
524
  },
394
525
  {
395
- scaleY:
396
- props.active.logicallySettled && !props.active.closing
397
- ? 1
398
- : elementScaleY,
526
+ scaleY: shouldResetUnfocusedElement ? 1 : elementScaleY,
399
527
  },
400
528
  ],
401
- opacity: debug ? 0.5 : unfocusedFade,
529
+ opacity: unfocusedFade,
402
530
  zIndex: 9999,
403
531
  elevation: 9999,
404
532
  };
@@ -409,8 +537,8 @@ export const buildZoomStyles = ({
409
537
  transform: [{ scale: unfocusedScale }],
410
538
  },
411
539
  },
412
- [resolvedTag]: {
540
+ [effectiveTag]: {
413
541
  style: resolvedElementStyle,
414
542
  },
415
543
  };
416
- };
544
+ }
@@ -8,6 +8,8 @@ export const ZOOM_SHARED_OPTIONS = Object.freeze({
8
8
  export const ZOOM_DRAG_RESISTANCE = 0.4;
9
9
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MIN = 0.25;
10
10
  export const ZOOM_DRAG_DIRECTIONAL_SCALE_MAX = 1.06;
11
+ export const ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT = 2;
12
+ export const ZOOM_BACKGROUND_SCALE = 0.9375;
11
13
 
12
14
  export const ZOOM_MASK_OUTSET = Object.freeze({
13
15
  top: 0,
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useDeferredMeasurementTrigger = void 0;
7
- var _react = require("react");
8
- var _reactNativeReanimated = require("react-native-reanimated");
9
- const useDeferredMeasurementTrigger = params => {
10
- const {
11
- enabled,
12
- isAnimating,
13
- canFlush,
14
- onFlush
15
- } = params;
16
- const hasPendingMeasurement = (0, _reactNativeReanimated.useSharedValue)(false);
17
- const clearPendingMeasurement = (0, _react.useCallback)(() => {
18
- "worklet";
19
-
20
- hasPendingMeasurement.value = false;
21
- }, [hasPendingMeasurement]);
22
- const queueOrFlushMeasurement = (0, _react.useCallback)(() => {
23
- "worklet";
24
-
25
- if (!enabled) return;
26
- if (isAnimating.value) {
27
- hasPendingMeasurement.value = true;
28
- return;
29
- }
30
- hasPendingMeasurement.value = false;
31
- onFlush();
32
- }, [enabled, isAnimating, hasPendingMeasurement, onFlush]);
33
- (0, _reactNativeReanimated.useAnimatedReaction)(() => {
34
- "worklet";
35
-
36
- if (!enabled) return false;
37
- if (!hasPendingMeasurement.value) return false;
38
- if (isAnimating.value) return false;
39
- return canFlush ? canFlush() : true;
40
- }, (shouldFlush, previousShouldFlush) => {
41
- "worklet";
42
-
43
- if (!enabled) return;
44
- if (!shouldFlush || shouldFlush === previousShouldFlush) return;
45
- hasPendingMeasurement.value = false;
46
- onFlush();
47
- }, [enabled, isAnimating, hasPendingMeasurement, canFlush, onFlush]);
48
- return {
49
- clearPendingMeasurement,
50
- queueOrFlushMeasurement
51
- };
52
- };
53
- exports.useDeferredMeasurementTrigger = useDeferredMeasurementTrigger;
54
- //# sourceMappingURL=use-deferred-measurement-trigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNativeReanimated","useDeferredMeasurementTrigger","params","enabled","isAnimating","canFlush","onFlush","hasPendingMeasurement","useSharedValue","clearPendingMeasurement","useCallback","value","queueOrFlushMeasurement","useAnimatedReaction","shouldFlush","previousShouldFlush","exports"],"sourceRoot":"../../../../../../src","sources":["shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAMO,MAAME,6BAA6B,GAAIC,MAK7C,IAAK;EACL,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC1D,MAAMK,qBAAqB,GAAG,IAAAC,qCAAc,EAAC,KAAK,CAAC;EAEnD,MAAMC,uBAAuB,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACjD,SAAS;;IACTH,qBAAqB,CAACI,KAAK,GAAG,KAAK;EACpC,CAAC,EAAE,CAACJ,qBAAqB,CAAC,CAAC;EAE3B,MAAMK,uBAAuB,GAAG,IAAAF,kBAAW,EAAC,MAAM;IACjD,SAAS;;IACT,IAAI,CAACP,OAAO,EAAE;IAEd,IAAIC,WAAW,CAACO,KAAK,EAAE;MACtBJ,qBAAqB,CAACI,KAAK,GAAG,IAAI;MAClC;IACD;IAEAJ,qBAAqB,CAACI,KAAK,GAAG,KAAK;IACnCL,OAAO,CAAC,CAAC;EACV,CAAC,EAAE,CAACH,OAAO,EAAEC,WAAW,EAAEG,qBAAqB,EAAED,OAAO,CAAC,CAAC;EAE1D,IAAAO,0CAAmB,EAClB,MAAM;IACL,SAAS;;IACT,IAAI,CAACV,OAAO,EAAE,OAAO,KAAK;IAC1B,IAAI,CAACI,qBAAqB,CAACI,KAAK,EAAE,OAAO,KAAK;IAC9C,IAAIP,WAAW,CAACO,KAAK,EAAE,OAAO,KAAK;IACnC,OAAON,QAAQ,GAAGA,QAAQ,CAAC,CAAC,GAAG,IAAI;EACpC,CAAC,EACD,CAACS,WAAW,EAAEC,mBAAmB,KAAK;IACrC,SAAS;;IACT,IAAI,CAACZ,OAAO,EAAE;IACd,IAAI,CAACW,WAAW,IAAIA,WAAW,KAAKC,mBAAmB,EAAE;IAEzDR,qBAAqB,CAACI,KAAK,GAAG,KAAK;IACnCL,OAAO,CAAC,CAAC;EACV,CAAC,EACD,CAACH,OAAO,EAAEC,WAAW,EAAEG,qBAAqB,EAAEF,QAAQ,EAAEC,OAAO,CAChE,CAAC;EAED,OAAO;IACNG,uBAAuB;IACvBG;EACD,CAAC;AACF,CAAC;AAACI,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}