react-native-screen-transitions 3.0.0-beta.1 → 3.0.0-beta.11

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 (429) hide show
  1. package/README.md +60 -5
  2. package/lib/commonjs/blank-stack/components/Overlay.js +20 -6
  3. package/lib/commonjs/blank-stack/components/Overlay.js.map +1 -1
  4. package/lib/commonjs/blank-stack/components/Screens.js +5 -5
  5. package/lib/commonjs/blank-stack/components/Screens.js.map +1 -1
  6. package/lib/commonjs/blank-stack/components/StackView.js +14 -8
  7. package/lib/commonjs/blank-stack/components/StackView.js.map +1 -1
  8. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js +5 -9
  9. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  10. package/lib/commonjs/blank-stack/index.js +7 -0
  11. package/lib/commonjs/blank-stack/index.js.map +1 -1
  12. package/lib/commonjs/native-stack/views/NativeStackView.native.js +4 -3
  13. package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
  14. package/lib/commonjs/shared/components/controllers/screen-lifecycle.js +25 -11
  15. package/lib/commonjs/shared/components/controllers/screen-lifecycle.js.map +1 -1
  16. package/lib/commonjs/shared/components/create-transition-aware-component.js +11 -14
  17. package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
  18. package/lib/commonjs/shared/components/root-transition-aware.js +1 -1
  19. package/lib/commonjs/shared/components/root-transition-aware.js.map +1 -1
  20. package/lib/commonjs/shared/configs/presets.js +20 -9
  21. package/lib/commonjs/shared/configs/presets.js.map +1 -1
  22. package/lib/commonjs/shared/constants.js +0 -1
  23. package/lib/commonjs/shared/constants.js.map +1 -1
  24. package/lib/commonjs/shared/hooks/animation/use-associated-style.js +9 -10
  25. package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
  26. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +10 -25
  27. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
  28. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +48 -36
  29. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  30. package/lib/commonjs/shared/hooks/gestures/use-parent-gesture-registry.js +1 -1
  31. package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js +1 -1
  32. package/lib/commonjs/shared/hooks/reanimated/use-shared-value-state.js.map +1 -0
  33. package/lib/commonjs/shared/hooks/use-stable-callback-value.js +7 -1
  34. package/lib/commonjs/shared/hooks/use-stable-callback-value.js.map +1 -1
  35. package/lib/commonjs/shared/hooks/use-stable-callback.js.map +1 -1
  36. package/lib/commonjs/shared/providers/{gestures.js → gestures.provider.js} +7 -4
  37. package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -0
  38. package/lib/commonjs/shared/providers/{keys.js → keys.provider.js} +1 -1
  39. package/lib/commonjs/shared/providers/keys.provider.js.map +1 -0
  40. package/lib/commonjs/shared/providers/register-bounds.provider.js +207 -0
  41. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -0
  42. package/lib/commonjs/shared/providers/{screen-transition-provider.js → screen-transition.provider.js} +4 -4
  43. package/lib/commonjs/shared/providers/{screen-transition-provider.js.map → screen-transition.provider.js.map} +1 -1
  44. package/lib/commonjs/shared/providers/{transition-styles.js → transition-styles.provider.js} +7 -9
  45. package/lib/commonjs/shared/providers/transition-styles.provider.js.map +1 -0
  46. package/lib/commonjs/shared/stores/{animation-store.js → animation.store.js} +13 -4
  47. package/lib/commonjs/shared/stores/animation.store.js.map +1 -0
  48. package/lib/commonjs/shared/stores/bounds.store.js +141 -0
  49. package/lib/commonjs/shared/stores/bounds.store.js.map +1 -0
  50. package/lib/commonjs/shared/stores/{gesture-store.js → gesture.store.js} +11 -1
  51. package/lib/commonjs/shared/stores/gesture.store.js.map +1 -0
  52. package/lib/commonjs/shared/types/{core.js → animation.types.js} +1 -1
  53. package/lib/commonjs/shared/types/animation.types.js.map +1 -0
  54. package/lib/commonjs/shared/types/{bounds.js → bounds.types.js} +1 -1
  55. package/lib/commonjs/shared/types/bounds.types.js.map +1 -0
  56. package/lib/commonjs/shared/types/{animation.js → core.types.js} +1 -1
  57. package/lib/commonjs/shared/types/{animation.js.map → core.types.js.map} +1 -1
  58. package/lib/commonjs/shared/types/{gesture.js → gesture.types.js} +1 -1
  59. package/lib/commonjs/shared/types/gesture.types.js.map +1 -0
  60. package/lib/commonjs/shared/types/utils.types.js +2 -0
  61. package/lib/commonjs/shared/types/{core.js.map → utils.types.js.map} +1 -1
  62. package/lib/commonjs/shared/utils/animation/derivations.js +1 -7
  63. package/lib/commonjs/shared/utils/animation/derivations.js.map +1 -1
  64. package/lib/commonjs/shared/utils/bounds/helpers/geometry.js.map +1 -0
  65. package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js +19 -0
  66. package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -0
  67. package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -0
  68. package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +1 -0
  69. package/lib/commonjs/shared/utils/bounds/index.js +45 -35
  70. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  71. package/lib/commonjs/shared/utils/bounds/types/builder.js.map +1 -0
  72. package/lib/commonjs/shared/utils/bounds/{_types/builder.js.map → types/geometry.js.map} +1 -1
  73. package/lib/commonjs/shared/utils/create-provider.js +51 -0
  74. package/lib/commonjs/shared/utils/create-provider.js.map +1 -0
  75. package/lib/commonjs/shared/utils/gesture/apply-offset-rules.js +1 -1
  76. package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js +1 -1
  77. package/lib/commonjs/shared/utils/reset-stores-for-screen.js +17 -0
  78. package/lib/commonjs/shared/utils/reset-stores-for-screen.js.map +1 -0
  79. package/lib/module/blank-stack/components/Overlay.js +20 -6
  80. package/lib/module/blank-stack/components/Overlay.js.map +1 -1
  81. package/lib/module/blank-stack/components/Screens.js +4 -4
  82. package/lib/module/blank-stack/components/Screens.js.map +1 -1
  83. package/lib/module/blank-stack/components/StackView.js +12 -7
  84. package/lib/module/blank-stack/components/StackView.js.map +1 -1
  85. package/lib/module/blank-stack/hooks/use-overlay-animation.js +5 -9
  86. package/lib/module/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  87. package/lib/module/blank-stack/index.js +1 -0
  88. package/lib/module/blank-stack/index.js.map +1 -1
  89. package/lib/module/native-stack/views/NativeStackView.native.js +3 -2
  90. package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
  91. package/lib/module/shared/components/controllers/screen-lifecycle.js +24 -10
  92. package/lib/module/shared/components/controllers/screen-lifecycle.js.map +1 -1
  93. package/lib/module/shared/components/create-transition-aware-component.js +11 -14
  94. package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
  95. package/lib/module/shared/components/root-transition-aware.js +1 -1
  96. package/lib/module/shared/components/root-transition-aware.js.map +1 -1
  97. package/lib/module/shared/configs/presets.js +20 -9
  98. package/lib/module/shared/configs/presets.js.map +1 -1
  99. package/lib/module/shared/constants.js +0 -1
  100. package/lib/module/shared/constants.js.map +1 -1
  101. package/lib/module/shared/hooks/animation/use-associated-style.js +9 -10
  102. package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
  103. package/lib/module/shared/hooks/animation/use-screen-animation.js +7 -22
  104. package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
  105. package/lib/module/shared/hooks/gestures/use-build-gestures.js +46 -34
  106. package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  107. package/lib/module/shared/hooks/gestures/use-parent-gesture-registry.js +1 -1
  108. package/lib/module/shared/hooks/gestures/use-parent-gesture-registry.js.map +1 -1
  109. package/lib/module/shared/hooks/gestures/use-scroll-registry.js +1 -1
  110. package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
  111. package/lib/module/shared/hooks/reanimated/use-shared-value-state.js.map +1 -0
  112. package/lib/module/shared/hooks/use-stable-callback-value.js +8 -2
  113. package/lib/module/shared/hooks/use-stable-callback-value.js.map +1 -1
  114. package/lib/module/shared/hooks/use-stable-callback.js.map +1 -1
  115. package/lib/module/shared/providers/{gestures.js → gestures.provider.js} +7 -4
  116. package/lib/module/shared/providers/gestures.provider.js.map +1 -0
  117. package/lib/module/shared/providers/{keys.js → keys.provider.js} +1 -1
  118. package/lib/module/shared/providers/keys.provider.js.map +1 -0
  119. package/lib/module/shared/providers/register-bounds.provider.js +202 -0
  120. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -0
  121. package/lib/module/shared/providers/{screen-transition-provider.js → screen-transition.provider.js} +4 -4
  122. package/lib/module/shared/providers/{screen-transition-provider.js.map → screen-transition.provider.js.map} +1 -1
  123. package/lib/module/shared/providers/{transition-styles.js → transition-styles.provider.js} +6 -9
  124. package/lib/module/shared/providers/transition-styles.provider.js.map +1 -0
  125. package/lib/module/shared/stores/animation.store.js +44 -0
  126. package/lib/module/shared/stores/animation.store.js.map +1 -0
  127. package/lib/module/shared/stores/bounds.store.js +137 -0
  128. package/lib/module/shared/stores/bounds.store.js.map +1 -0
  129. package/lib/module/shared/stores/{gesture-store.js → gesture.store.js} +12 -2
  130. package/lib/module/shared/stores/gesture.store.js.map +1 -0
  131. package/lib/module/shared/types/animation.types.js +4 -0
  132. package/lib/module/shared/types/animation.types.js.map +1 -0
  133. package/lib/module/shared/types/bounds.types.js +4 -0
  134. package/lib/module/shared/types/bounds.types.js.map +1 -0
  135. package/lib/module/shared/types/core.types.js +4 -0
  136. package/lib/{commonjs/shared/types/bounds.js.map → module/shared/types/core.types.js.map} +1 -1
  137. package/lib/module/shared/types/{gesture.js → gesture.types.js} +1 -1
  138. package/lib/module/shared/types/gesture.types.js.map +1 -0
  139. package/lib/module/shared/types/utils.types.js +2 -0
  140. package/lib/{commonjs/shared/types/utils.js.map → module/shared/types/utils.types.js.map} +1 -1
  141. package/lib/module/shared/utils/animation/derivations.js +1 -7
  142. package/lib/module/shared/utils/animation/derivations.js.map +1 -1
  143. package/lib/module/shared/utils/bounds/helpers/geometry.js.map +1 -0
  144. package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js +14 -0
  145. package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -0
  146. package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -0
  147. package/lib/module/shared/utils/bounds/helpers/styles.js.map +1 -0
  148. package/lib/module/shared/utils/bounds/index.js +45 -35
  149. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  150. package/lib/module/shared/utils/bounds/types/builder.js.map +1 -0
  151. package/lib/module/shared/utils/bounds/{_types/builder.js.map → types/geometry.js.map} +1 -1
  152. package/lib/module/shared/utils/create-provider.js +46 -0
  153. package/lib/module/shared/utils/create-provider.js.map +1 -0
  154. package/lib/module/shared/utils/gesture/apply-offset-rules.js +1 -1
  155. package/lib/module/shared/utils/gesture/apply-offset-rules.js.map +1 -1
  156. package/lib/module/shared/utils/gesture/check-gesture-activation.js +1 -1
  157. package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
  158. package/lib/module/shared/utils/reset-stores-for-screen.js +13 -0
  159. package/lib/module/shared/utils/reset-stores-for-screen.js.map +1 -0
  160. package/lib/typescript/blank-stack/components/Overlay.d.ts.map +1 -1
  161. package/lib/typescript/blank-stack/components/Screens.d.ts +2 -3
  162. package/lib/typescript/blank-stack/components/Screens.d.ts.map +1 -1
  163. package/lib/typescript/blank-stack/components/StackView.d.ts.map +1 -1
  164. package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts +1 -1
  165. package/lib/typescript/blank-stack/hooks/use-overlay-animation.d.ts.map +1 -1
  166. package/lib/typescript/blank-stack/index.d.ts +1 -0
  167. package/lib/typescript/blank-stack/index.d.ts.map +1 -1
  168. package/lib/typescript/blank-stack/types.d.ts +6 -2
  169. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  170. package/lib/typescript/native-stack/types.d.ts +1 -1
  171. package/lib/typescript/native-stack/types.d.ts.map +1 -1
  172. package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  173. package/lib/typescript/shared/components/controllers/screen-lifecycle.d.ts.map +1 -1
  174. package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
  175. package/lib/typescript/shared/configs/index.d.ts +15 -9
  176. package/lib/typescript/shared/configs/index.d.ts.map +1 -1
  177. package/lib/typescript/shared/configs/presets.d.ts +10 -4
  178. package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
  179. package/lib/typescript/shared/constants.d.ts +6 -6
  180. package/lib/typescript/shared/constants.d.ts.map +1 -1
  181. package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
  182. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts +2 -2
  183. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
  184. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +5 -2
  185. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  186. package/lib/typescript/shared/hooks/reanimated/use-shared-value-state.d.ts.map +1 -0
  187. package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
  188. package/lib/typescript/shared/hooks/use-stable-callback.d.ts.map +1 -1
  189. package/lib/typescript/shared/index.d.ts +25 -18
  190. package/lib/typescript/shared/index.d.ts.map +1 -1
  191. package/lib/typescript/shared/providers/{gestures.d.ts → gestures.provider.d.ts} +5 -3
  192. package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -0
  193. package/lib/typescript/shared/providers/{keys.d.ts → keys.provider.d.ts} +2 -2
  194. package/lib/typescript/shared/providers/keys.provider.d.ts.map +1 -0
  195. package/lib/typescript/shared/providers/register-bounds.provider.d.ts +17 -0
  196. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -0
  197. package/lib/typescript/shared/providers/{screen-transition-provider.d.ts → screen-transition.provider.d.ts} +2 -2
  198. package/lib/typescript/shared/providers/{screen-transition-provider.d.ts.map → screen-transition.provider.d.ts.map} +1 -1
  199. package/lib/typescript/shared/providers/transition-styles.provider.d.ts +14 -0
  200. package/lib/typescript/shared/providers/transition-styles.provider.d.ts.map +1 -0
  201. package/lib/typescript/shared/stores/{animation-store.d.ts → animation.store.d.ts} +6 -4
  202. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -0
  203. package/lib/typescript/shared/stores/bounds.store.d.ts +29 -0
  204. package/lib/typescript/shared/stores/bounds.store.d.ts.map +1 -0
  205. package/lib/typescript/shared/stores/{gesture-store.d.ts → gesture.store.d.ts} +3 -3
  206. package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -0
  207. package/lib/typescript/shared/types/{animation.d.ts → animation.types.d.ts} +48 -20
  208. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -0
  209. package/lib/typescript/shared/types/{bounds.d.ts → bounds.types.d.ts} +4 -4
  210. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -0
  211. package/lib/typescript/shared/types/{core.d.ts → core.types.d.ts} +3 -3
  212. package/lib/typescript/shared/types/core.types.d.ts.map +1 -0
  213. package/lib/typescript/shared/types/{gesture.d.ts → gesture.types.d.ts} +1 -1
  214. package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -0
  215. package/lib/typescript/shared/types/{utils.d.ts → utils.types.d.ts} +1 -1
  216. package/lib/typescript/shared/types/utils.types.d.ts.map +1 -0
  217. package/lib/typescript/shared/utils/animation/derivations.d.ts +2 -4
  218. package/lib/typescript/shared/utils/animation/derivations.d.ts.map +1 -1
  219. package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts +2 -2
  220. package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts.map +1 -1
  221. package/lib/typescript/shared/utils/bounds/constants.d.ts +3 -3
  222. package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -1
  223. package/lib/typescript/shared/utils/bounds/{_utils → helpers}/geometry.d.ts +3 -3
  224. package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts.map +1 -0
  225. package/lib/typescript/shared/utils/bounds/helpers/is-bounds-equal.d.ts.map +1 -0
  226. package/lib/typescript/shared/utils/bounds/{_utils → helpers}/style-composers.d.ts +2 -2
  227. package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -0
  228. package/lib/typescript/shared/utils/bounds/{_utils → helpers}/styles.d.ts +1 -1
  229. package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +1 -0
  230. package/lib/typescript/shared/utils/bounds/index.d.ts +3 -4
  231. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  232. package/lib/typescript/shared/utils/bounds/{_types → types}/builder.d.ts +13 -34
  233. package/lib/typescript/shared/utils/bounds/types/builder.d.ts.map +1 -0
  234. package/lib/typescript/shared/utils/bounds/types/geometry.d.ts.map +1 -0
  235. package/lib/typescript/shared/utils/create-provider.d.ts +14 -0
  236. package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -0
  237. package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts +2 -2
  238. package/lib/typescript/shared/utils/gesture/apply-offset-rules.d.ts.map +1 -1
  239. package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +2 -2
  240. package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
  241. package/lib/typescript/shared/utils/gesture/reset-gesture-values.d.ts +2 -2
  242. package/lib/typescript/shared/utils/gesture/reset-gesture-values.d.ts.map +1 -1
  243. package/lib/typescript/shared/utils/gesture/velocity.d.ts +1 -1
  244. package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts +6 -0
  245. package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts.map +1 -0
  246. package/package.json +1 -1
  247. package/src/blank-stack/components/Overlay.tsx +25 -5
  248. package/src/blank-stack/components/Screens.tsx +6 -6
  249. package/src/blank-stack/components/StackView.tsx +11 -5
  250. package/src/blank-stack/hooks/use-overlay-animation.tsx +6 -21
  251. package/src/blank-stack/index.ts +1 -0
  252. package/src/blank-stack/types.ts +6 -2
  253. package/src/native-stack/types.ts +1 -1
  254. package/src/native-stack/views/NativeStackView.native.tsx +4 -2
  255. package/src/shared/components/controllers/screen-lifecycle.tsx +26 -11
  256. package/src/shared/components/create-transition-aware-component.tsx +23 -27
  257. package/src/shared/components/root-transition-aware.tsx +1 -1
  258. package/src/shared/configs/presets.ts +31 -17
  259. package/src/shared/constants.ts +6 -7
  260. package/src/shared/hooks/animation/use-associated-style.tsx +8 -9
  261. package/src/shared/hooks/animation/use-screen-animation.tsx +8 -26
  262. package/src/shared/hooks/gestures/use-build-gestures.tsx +66 -38
  263. package/src/shared/hooks/gestures/use-parent-gesture-registry.tsx +1 -1
  264. package/src/shared/hooks/gestures/use-scroll-registry.tsx +2 -2
  265. package/src/shared/hooks/{use-stable-callback-value.tsx → use-stable-callback-value.ts} +10 -1
  266. package/src/shared/index.ts +4 -1
  267. package/src/shared/providers/{gestures.tsx → gestures.provider.tsx} +17 -8
  268. package/src/shared/providers/{keys.tsx → keys.provider.tsx} +1 -1
  269. package/src/shared/providers/register-bounds.provider.tsx +284 -0
  270. package/src/shared/providers/{screen-transition-provider.tsx → screen-transition.provider.tsx} +3 -3
  271. package/src/shared/providers/{transition-styles.tsx → transition-styles.provider.tsx} +13 -14
  272. package/src/shared/stores/{animation-store.ts → animation.store.ts} +20 -4
  273. package/src/shared/stores/bounds.store.ts +166 -0
  274. package/src/shared/stores/{gesture-store.ts → gesture.store.ts} +17 -3
  275. package/src/shared/types/{animation.ts → animation.types.ts} +60 -19
  276. package/src/shared/types/{bounds.ts → bounds.types.ts} +3 -3
  277. package/src/shared/types/{core.ts → core.types.ts} +10 -2
  278. package/src/shared/utils/animation/derivations.ts +2 -8
  279. package/src/shared/utils/animation/start-screen-transition.ts +2 -2
  280. package/src/shared/utils/bounds/constants.ts +3 -3
  281. package/src/shared/utils/bounds/{_utils → helpers}/geometry.ts +3 -3
  282. package/src/shared/utils/bounds/{_utils → helpers}/is-bounds-equal.ts +3 -3
  283. package/src/shared/utils/bounds/{_utils → helpers}/style-composers.ts +2 -2
  284. package/src/shared/utils/bounds/{_utils → helpers}/styles.ts +1 -1
  285. package/src/shared/utils/bounds/index.ts +53 -55
  286. package/src/shared/utils/bounds/{_types → types}/builder.ts +19 -37
  287. package/src/shared/utils/create-provider.tsx +71 -0
  288. package/src/shared/utils/gesture/apply-offset-rules.ts +2 -2
  289. package/src/shared/utils/gesture/check-gesture-activation.ts +2 -2
  290. package/src/shared/utils/gesture/reset-gesture-values.ts +2 -2
  291. package/src/shared/utils/gesture/velocity.ts +1 -1
  292. package/src/shared/utils/reset-stores-for-screen.ts +11 -0
  293. package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js +0 -131
  294. package/lib/commonjs/shared/hooks/bounds/use-bound-registry.js.map +0 -1
  295. package/lib/commonjs/shared/hooks/use-shared-value-state.js.map +0 -1
  296. package/lib/commonjs/shared/providers/gestures.js.map +0 -1
  297. package/lib/commonjs/shared/providers/keys.js.map +0 -1
  298. package/lib/commonjs/shared/providers/transition-styles.js.map +0 -1
  299. package/lib/commonjs/shared/providers/utils/create-provider.js +0 -39
  300. package/lib/commonjs/shared/providers/utils/create-provider.js.map +0 -1
  301. package/lib/commonjs/shared/stores/animation-store.js.map +0 -1
  302. package/lib/commonjs/shared/stores/bound-store/_utils.js +0 -118
  303. package/lib/commonjs/shared/stores/bound-store/_utils.js.map +0 -1
  304. package/lib/commonjs/shared/stores/bound-store/index.js +0 -116
  305. package/lib/commonjs/shared/stores/bound-store/index.js.map +0 -1
  306. package/lib/commonjs/shared/stores/gesture-store.js.map +0 -1
  307. package/lib/commonjs/shared/stores/navigator-dismiss-state.js +0 -23
  308. package/lib/commonjs/shared/stores/navigator-dismiss-state.js.map +0 -1
  309. package/lib/commonjs/shared/stores/utils/reset-stores-for-screen.js +0 -19
  310. package/lib/commonjs/shared/stores/utils/reset-stores-for-screen.js.map +0 -1
  311. package/lib/commonjs/shared/types/gesture.js.map +0 -1
  312. package/lib/commonjs/shared/types/utils.js +0 -2
  313. package/lib/commonjs/shared/utils/bounds/_types/geometry.js.map +0 -1
  314. package/lib/commonjs/shared/utils/bounds/_types/get-bounds.js +0 -6
  315. package/lib/commonjs/shared/utils/bounds/_types/get-bounds.js.map +0 -1
  316. package/lib/commonjs/shared/utils/bounds/_utils/flatten-styles.js +0 -27
  317. package/lib/commonjs/shared/utils/bounds/_utils/flatten-styles.js.map +0 -1
  318. package/lib/commonjs/shared/utils/bounds/_utils/geometry.js.map +0 -1
  319. package/lib/commonjs/shared/utils/bounds/_utils/get-bounds.js +0 -49
  320. package/lib/commonjs/shared/utils/bounds/_utils/get-bounds.js.map +0 -1
  321. package/lib/commonjs/shared/utils/bounds/_utils/is-bounds-equal.js +0 -19
  322. package/lib/commonjs/shared/utils/bounds/_utils/is-bounds-equal.js.map +0 -1
  323. package/lib/commonjs/shared/utils/bounds/_utils/style-composers.js.map +0 -1
  324. package/lib/commonjs/shared/utils/bounds/_utils/styles.js.map +0 -1
  325. package/lib/module/shared/hooks/bounds/use-bound-registry.js +0 -125
  326. package/lib/module/shared/hooks/bounds/use-bound-registry.js.map +0 -1
  327. package/lib/module/shared/hooks/use-shared-value-state.js.map +0 -1
  328. package/lib/module/shared/providers/gestures.js.map +0 -1
  329. package/lib/module/shared/providers/keys.js.map +0 -1
  330. package/lib/module/shared/providers/transition-styles.js.map +0 -1
  331. package/lib/module/shared/providers/utils/create-provider.js +0 -33
  332. package/lib/module/shared/providers/utils/create-provider.js.map +0 -1
  333. package/lib/module/shared/stores/animation-store.js +0 -33
  334. package/lib/module/shared/stores/animation-store.js.map +0 -1
  335. package/lib/module/shared/stores/bound-store/_utils.js +0 -113
  336. package/lib/module/shared/stores/bound-store/_utils.js.map +0 -1
  337. package/lib/module/shared/stores/bound-store/index.js +0 -112
  338. package/lib/module/shared/stores/bound-store/index.js.map +0 -1
  339. package/lib/module/shared/stores/gesture-store.js.map +0 -1
  340. package/lib/module/shared/stores/navigator-dismiss-state.js +0 -19
  341. package/lib/module/shared/stores/navigator-dismiss-state.js.map +0 -1
  342. package/lib/module/shared/stores/utils/reset-stores-for-screen.js +0 -15
  343. package/lib/module/shared/stores/utils/reset-stores-for-screen.js.map +0 -1
  344. package/lib/module/shared/types/animation.js +0 -4
  345. package/lib/module/shared/types/animation.js.map +0 -1
  346. package/lib/module/shared/types/bounds.js +0 -4
  347. package/lib/module/shared/types/bounds.js.map +0 -1
  348. package/lib/module/shared/types/core.js +0 -4
  349. package/lib/module/shared/types/core.js.map +0 -1
  350. package/lib/module/shared/types/gesture.js.map +0 -1
  351. package/lib/module/shared/types/utils.js +0 -2
  352. package/lib/module/shared/types/utils.js.map +0 -1
  353. package/lib/module/shared/utils/bounds/_types/geometry.js.map +0 -1
  354. package/lib/module/shared/utils/bounds/_types/get-bounds.js +0 -4
  355. package/lib/module/shared/utils/bounds/_types/get-bounds.js.map +0 -1
  356. package/lib/module/shared/utils/bounds/_utils/flatten-styles.js +0 -23
  357. package/lib/module/shared/utils/bounds/_utils/flatten-styles.js.map +0 -1
  358. package/lib/module/shared/utils/bounds/_utils/geometry.js.map +0 -1
  359. package/lib/module/shared/utils/bounds/_utils/get-bounds.js +0 -44
  360. package/lib/module/shared/utils/bounds/_utils/get-bounds.js.map +0 -1
  361. package/lib/module/shared/utils/bounds/_utils/is-bounds-equal.js +0 -14
  362. package/lib/module/shared/utils/bounds/_utils/is-bounds-equal.js.map +0 -1
  363. package/lib/module/shared/utils/bounds/_utils/style-composers.js.map +0 -1
  364. package/lib/module/shared/utils/bounds/_utils/styles.js.map +0 -1
  365. package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts +0 -17
  366. package/lib/typescript/shared/hooks/bounds/use-bound-registry.d.ts.map +0 -1
  367. package/lib/typescript/shared/hooks/use-shared-value-state.d.ts.map +0 -1
  368. package/lib/typescript/shared/providers/gestures.d.ts.map +0 -1
  369. package/lib/typescript/shared/providers/keys.d.ts.map +0 -1
  370. package/lib/typescript/shared/providers/transition-styles.d.ts +0 -11
  371. package/lib/typescript/shared/providers/transition-styles.d.ts.map +0 -1
  372. package/lib/typescript/shared/providers/utils/create-provider.d.ts +0 -32
  373. package/lib/typescript/shared/providers/utils/create-provider.d.ts.map +0 -1
  374. package/lib/typescript/shared/stores/animation-store.d.ts.map +0 -1
  375. package/lib/typescript/shared/stores/bound-store/_utils.d.ts +0 -24
  376. package/lib/typescript/shared/stores/bound-store/_utils.d.ts.map +0 -1
  377. package/lib/typescript/shared/stores/bound-store/index.d.ts +0 -22
  378. package/lib/typescript/shared/stores/bound-store/index.d.ts.map +0 -1
  379. package/lib/typescript/shared/stores/gesture-store.d.ts.map +0 -1
  380. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts +0 -7
  381. package/lib/typescript/shared/stores/navigator-dismiss-state.d.ts.map +0 -1
  382. package/lib/typescript/shared/stores/utils/reset-stores-for-screen.d.ts +0 -6
  383. package/lib/typescript/shared/stores/utils/reset-stores-for-screen.d.ts.map +0 -1
  384. package/lib/typescript/shared/types/animation.d.ts.map +0 -1
  385. package/lib/typescript/shared/types/bounds.d.ts.map +0 -1
  386. package/lib/typescript/shared/types/core.d.ts.map +0 -1
  387. package/lib/typescript/shared/types/gesture.d.ts.map +0 -1
  388. package/lib/typescript/shared/types/utils.d.ts.map +0 -1
  389. package/lib/typescript/shared/utils/bounds/_types/builder.d.ts.map +0 -1
  390. package/lib/typescript/shared/utils/bounds/_types/geometry.d.ts.map +0 -1
  391. package/lib/typescript/shared/utils/bounds/_types/get-bounds.d.ts +0 -10
  392. package/lib/typescript/shared/utils/bounds/_types/get-bounds.d.ts.map +0 -1
  393. package/lib/typescript/shared/utils/bounds/_utils/flatten-styles.d.ts +0 -2
  394. package/lib/typescript/shared/utils/bounds/_utils/flatten-styles.d.ts.map +0 -1
  395. package/lib/typescript/shared/utils/bounds/_utils/geometry.d.ts.map +0 -1
  396. package/lib/typescript/shared/utils/bounds/_utils/get-bounds.d.ts +0 -4
  397. package/lib/typescript/shared/utils/bounds/_utils/get-bounds.d.ts.map +0 -1
  398. package/lib/typescript/shared/utils/bounds/_utils/is-bounds-equal.d.ts.map +0 -1
  399. package/lib/typescript/shared/utils/bounds/_utils/style-composers.d.ts.map +0 -1
  400. package/lib/typescript/shared/utils/bounds/_utils/styles.d.ts.map +0 -1
  401. package/src/shared/hooks/bounds/use-bound-registry.tsx +0 -153
  402. package/src/shared/providers/utils/create-provider.ts +0 -64
  403. package/src/shared/stores/bound-store/_utils.ts +0 -161
  404. package/src/shared/stores/bound-store/index.ts +0 -125
  405. package/src/shared/stores/navigator-dismiss-state.ts +0 -17
  406. package/src/shared/stores/utils/reset-stores-for-screen.ts +0 -13
  407. package/src/shared/utils/bounds/_types/get-bounds.ts +0 -10
  408. package/src/shared/utils/bounds/_utils/flatten-styles.ts +0 -21
  409. package/src/shared/utils/bounds/_utils/get-bounds.ts +0 -54
  410. /package/lib/commonjs/shared/hooks/{use-shared-value-state.js → reanimated/use-shared-value-state.js} +0 -0
  411. /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/geometry.js +0 -0
  412. /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/style-composers.js +0 -0
  413. /package/lib/commonjs/shared/utils/bounds/{_utils → helpers}/styles.js +0 -0
  414. /package/lib/commonjs/shared/utils/bounds/{_types → types}/builder.js +0 -0
  415. /package/lib/commonjs/shared/utils/bounds/{_types → types}/geometry.js +0 -0
  416. /package/lib/module/shared/hooks/{use-shared-value-state.js → reanimated/use-shared-value-state.js} +0 -0
  417. /package/lib/module/shared/utils/bounds/{_utils → helpers}/geometry.js +0 -0
  418. /package/lib/module/shared/utils/bounds/{_utils → helpers}/style-composers.js +0 -0
  419. /package/lib/module/shared/utils/bounds/{_utils → helpers}/styles.js +0 -0
  420. /package/lib/module/shared/utils/bounds/{_types → types}/builder.js +0 -0
  421. /package/lib/module/shared/utils/bounds/{_types → types}/geometry.js +0 -0
  422. /package/lib/typescript/shared/hooks/{use-shared-value-state.d.ts → reanimated/use-shared-value-state.d.ts} +0 -0
  423. /package/lib/typescript/shared/utils/bounds/{_utils → helpers}/is-bounds-equal.d.ts +0 -0
  424. /package/lib/typescript/shared/utils/bounds/{_types → types}/geometry.d.ts +0 -0
  425. /package/src/shared/hooks/{use-shared-value-state.ts → reanimated/use-shared-value-state.ts} +0 -0
  426. /package/src/shared/hooks/{use-stable-callback.tsx → use-stable-callback.ts} +0 -0
  427. /package/src/shared/types/{gesture.ts → gesture.types.ts} +0 -0
  428. /package/src/shared/types/{utils.ts → utils.types.ts} +0 -0
  429. /package/src/shared/utils/bounds/{_types → types}/geometry.ts +0 -0
@@ -5,14 +5,16 @@ import type {
5
5
  WithTimingConfig,
6
6
  } from "react-native-reanimated";
7
7
  import type { EdgeInsets } from "react-native-safe-area-context";
8
- import type { BoundEntry, BoundsAccessor } from "./bounds";
9
- import type { Layout } from "./core";
10
- import type { GestureValues } from "./gesture";
8
+ import type { BoundsAccessor } from "./bounds.types";
9
+ import type { Layout } from "./core.types";
10
+ import type { GestureValues } from "./gesture.types";
11
11
 
12
12
  export interface OverlayInterpolationProps {
13
13
  progress: number;
14
14
  layouts: {
15
- /** The `width` and `height` of the screen container. */
15
+ /**
16
+ * The `width` and `height` of the screen container.
17
+ */
16
18
  screen: Layout;
17
19
  };
18
20
  insets: EdgeInsets;
@@ -23,37 +25,74 @@ export type ScreenTransitionState = {
23
25
  closing: number;
24
26
  animating: number;
25
27
  gesture: GestureValues;
26
- bounds: Record<string, BoundEntry>;
27
28
  route: RouteProp<ParamListBase>;
28
29
  };
29
30
 
30
31
  export interface ScreenInterpolationProps {
31
- /** Values for the screen that came before the current one in the navigation stack. */
32
+ /**
33
+ * Values for the screen that came before the current one in the navigation stack.
34
+ */
32
35
  previous: ScreenTransitionState | undefined;
33
- /** Values for the current screen being interpolated. */
36
+
37
+ /**
38
+ * Values for the current screen being interpolated.
39
+ */
34
40
  current: ScreenTransitionState;
35
- /** Values for the screen that comes after the current one in the navigation stack. */
41
+
42
+ /**
43
+ * Values for the screen that comes after the current one in the navigation stack.
44
+ */
36
45
  next: ScreenTransitionState | undefined;
37
- /** Layout measurements for the screen. */
46
+
47
+ /**
48
+ * Layout measurements for the screen.
49
+ */
38
50
  layouts: {
39
- /** The `width` and `height` of the screen container. */
51
+ /**
52
+ * The `width` and `height` of the screen container.
53
+ */
40
54
  screen: Layout;
41
55
  };
42
- /** The safe area insets for the screen. */
56
+
57
+ /**
58
+ * The safe area insets for the screen.
59
+ */
43
60
  insets: EdgeInsets;
44
- /** The ID of the currently active shared bound (e.g., 'a' when Transition.Pressable has sharedBoundTag='a'). */
45
- activeBoundId: string;
46
- /** Whether the current screen is the focused (topmost) screen in the stack. */
61
+
62
+ /**
63
+ * The ID of the currently active shared bound (e.g., 'a' when Transition.Pressable has sharedBoundTag='a').
64
+ * @deprecated
65
+ */
66
+ activeBoundId?: never;
67
+
68
+ /**
69
+ * Whether the current screen is the focused (topmost) screen in the stack.
70
+ */
47
71
  focused: boolean;
48
- /** Combined progress of current and next screen transitions, ranging from 0-2. */
72
+
73
+ /**
74
+ * Combined progress of current and next screen transitions, ranging from 0-2.
75
+ */
49
76
  progress: number;
50
- /** Function that provides access to bounds builders for creating shared element transitions. */
77
+
78
+ /**
79
+ * Function that provides access to bounds builders for creating shared element transitions.
80
+ */
51
81
  bounds: BoundsAccessor;
52
- /** The screen state that is currently driving the transition (either current or next, whichever is focused). */
82
+
83
+ /**
84
+ * The screen state that is currently driving the transition (either current or next, whichever is focused).
85
+ */
53
86
  active: ScreenTransitionState;
54
- /** Whether the active screen is currently transitioning (either being dragged or animating). */
87
+
88
+ /**
89
+ * Whether the active screen is currently transitioning (either being dragged or animating).
90
+ */
55
91
  isActiveTransitioning: boolean;
56
- /** Whether the active screen is in the process of being dismissed/closed. */
92
+
93
+ /**
94
+ * Whether the active screen is in the process of being dismissed/closed.
95
+ */
57
96
  isDismissing: boolean;
58
97
  }
59
98
 
@@ -66,10 +105,12 @@ export type TransitionInterpolatedStyle = {
66
105
  * Animated style for the main screen view. Styles are only applied when Transition.View is present.
67
106
  */
68
107
  contentStyle?: StyleProps;
108
+
69
109
  /**
70
110
  * Animated style for a semi-transparent overlay. Styles are only applied when Transition.View is present.
71
111
  */
72
112
  overlayStyle?: StyleProps;
113
+
73
114
  /**
74
115
  * Define your own custom styles by using an id as the key: [id]: StyleProps
75
116
  */
@@ -1,9 +1,9 @@
1
1
  import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
+ import type { TagData } from "../stores/bounds.store";
2
3
  import type {
3
4
  BoundsBuilderOptions,
4
5
  BoundsReturnType,
5
- } from "../utils/bounds/_types/builder";
6
- import type { ScreenPhase } from "./core";
6
+ } from "../utils/bounds/types/builder";
7
7
 
8
8
  /**
9
9
  * Target style computation.
@@ -21,5 +21,5 @@ export type BoundEntry = {
21
21
 
22
22
  export type BoundsAccessor = {
23
23
  <T extends BoundsBuilderOptions>(options: T): BoundsReturnType<T>;
24
- get: (id?: string, phase?: ScreenPhase) => BoundEntry;
24
+ getOccurrence: (id: string, key: string) => TagData;
25
25
  };
@@ -1,6 +1,6 @@
1
1
  import type { AnimatedProps } from "react-native-reanimated";
2
- import type { ScreenStyleInterpolator, TransitionSpec } from "./animation";
3
- import type { GestureActivationArea, GestureDirection } from "./gesture";
2
+ import type { ScreenStyleInterpolator, TransitionSpec } from "./animation.types";
3
+ import type { GestureActivationArea, GestureDirection } from "./gesture.types";
4
4
 
5
5
  export type Layout = {
6
6
  width: number;
@@ -62,34 +62,42 @@ export type ScreenTransitionConfig = {
62
62
  * The user-provided function to calculate styles based on animation progress.
63
63
  */
64
64
  screenStyleInterpolator?: ScreenStyleInterpolator;
65
+
65
66
  /**
66
67
  * The Reanimated animation config for opening and closing transitions.
67
68
  */
68
69
  transitionSpec?: TransitionSpec;
70
+
69
71
  /**
70
72
  * Whether the gesture is enabled.
71
73
  */
72
74
  gestureEnabled?: boolean;
75
+
73
76
  /**
74
77
  * The direction of the swipe gesture used to dismiss the screen.
75
78
  */
76
79
  gestureDirection?: GestureDirection | GestureDirection[];
80
+
77
81
  /**
78
82
  * How much the gesture's final velocity impacts the dismiss decision.
79
83
  */
80
84
  gestureVelocityImpact?: number;
85
+
81
86
  /**
82
87
  * Distance threshold for gesture recognition throughout the screen.
83
88
  */
84
89
  gestureResponseDistance?: number;
90
+
85
91
  /**
86
92
  * Whether the gesture drives the progress.
87
93
  */
88
94
  gestureDrivesProgress?: boolean;
95
+
89
96
  /**
90
97
  * The area of the screen where the gesture is activated.
91
98
  */
92
99
  gestureActivationArea?: GestureActivationArea;
100
+
93
101
  /**
94
102
  * Whether to enable transitions. It sets the presentation to containedTransparentModal, animation none, and headerShown to false.
95
103
  */
@@ -1,16 +1,14 @@
1
- import { BoundStore } from "../../stores/bound-store";
2
- import type { ScreenTransitionState } from "../../types/animation";
1
+ import type { ScreenTransitionState } from "../../types/animation.types";
3
2
 
4
3
  interface DerivationsParams {
5
4
  current: ScreenTransitionState;
6
5
  next?: ScreenTransitionState;
7
- previous?: ScreenTransitionState;
8
6
  }
9
7
 
10
8
  /**
11
9
  * Additional values to help make defining animations easier.
12
10
  */
13
- export const derivations = ({ current, next, previous }: DerivationsParams) => {
11
+ export const derivations = ({ current, next }: DerivationsParams) => {
14
12
  "worklet";
15
13
 
16
14
  // The combined progress
@@ -26,13 +24,9 @@ export const derivations = ({ current, next, previous }: DerivationsParams) => {
26
24
 
27
25
  const isDismissing = !!(active.gesture.isDismissing || active.closing);
28
26
 
29
- // The active bound id
30
- const activeBoundId = BoundStore.getActiveBound(current, next, previous);
31
-
32
27
  return {
33
28
  progress,
34
29
  focused,
35
- activeBoundId,
36
30
  active,
37
31
  isActiveTransitioning,
38
32
  isDismissing,
@@ -1,6 +1,6 @@
1
1
  import { runOnJS } from "react-native-reanimated";
2
- import type { AnimationStoreMap } from "../../stores/animation-store";
3
- import type { TransitionSpec } from "../../types/animation";
2
+ import type { AnimationStoreMap } from "../../stores/animation.store";
3
+ import type { TransitionSpec } from "../../types/animation.types";
4
4
  import { animate } from "./animate";
5
5
 
6
6
  interface StartScreenTransitionProps {
@@ -1,7 +1,7 @@
1
1
  import type { MeasuredDimensions } from "react-native-reanimated";
2
- import type { Layout } from "../../types/core";
3
- import type { Complete } from "../../types/utils";
4
- import type { BoundsBuilderOptions } from "./_types/builder";
2
+ import type { Layout } from "../../types/core.types";
3
+ import type { Complete } from "../../types/utils.types";
4
+ import type { BoundsBuilderOptions } from "./types/builder";
5
5
 
6
6
  export const FULLSCREEN_DIMENSIONS = (
7
7
  dimensions: Layout,
@@ -1,10 +1,10 @@
1
1
  import type { MeasuredDimensions } from "react-native-reanimated";
2
- import type { Layout } from "../../../types/core";
3
- import type { BoundsAnchor, BoundsScaleMode } from "../_types/builder";
2
+ import type { Layout } from "../../../types/core.types";
3
+ import type { BoundsAnchor, BoundsScaleMode } from "../types/builder";
4
4
  import type {
5
5
  ContentTransformGeometry,
6
6
  RelativeGeometry,
7
- } from "../_types/geometry";
7
+ } from "../types/geometry";
8
8
 
9
9
  /**
10
10
  * Get the anchor point coordinates for a given bound
@@ -1,5 +1,5 @@
1
1
  import type { MeasuredDimensions } from "react-native-reanimated";
2
- import { BoundStore } from "../../../stores/bound-store";
2
+ import { BoundStore } from "../../../stores/bounds.store";
3
3
 
4
4
  export const isBoundsEqual = ({
5
5
  measured,
@@ -11,9 +11,9 @@ export const isBoundsEqual = ({
11
11
  sharedBoundTag: string;
12
12
  }) => {
13
13
  "worklet";
14
- const existing = BoundStore.getBounds(key)?.[sharedBoundTag]?.bounds;
14
+ const existing = BoundStore.getOccurrence(sharedBoundTag, key)?.bounds;
15
15
  return (
16
- existing &&
16
+ !!existing &&
17
17
  existing.width === measured.width &&
18
18
  existing.height === measured.height &&
19
19
  existing.pageX === measured.pageX &&
@@ -3,11 +3,11 @@ import {
3
3
  type MeasuredDimensions,
4
4
  type StyleProps,
5
5
  } from "react-native-reanimated";
6
- import type { BoundsBuilderOptions } from "../_types/builder";
6
+ import type { BoundsBuilderOptions } from "../types/builder";
7
7
  import type {
8
8
  ContentTransformGeometry,
9
9
  RelativeGeometry,
10
- } from "../_types/geometry";
10
+ } from "../types/geometry";
11
11
 
12
12
  /**
13
13
  * Element-level (relative) params shared by size/transform composers.
@@ -1,6 +1,6 @@
1
1
  import type { ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
2
2
  import { isSharedValue } from "react-native-reanimated";
3
- import type { Any } from "../../../types/utils";
3
+ import type { Any } from "../../../types/utils.types";
4
4
 
5
5
  type AnyStyle = ViewStyle | TextStyle | ImageStyle;
6
6
  type StyleValue = StyleProp<AnyStyle>;
@@ -6,21 +6,17 @@ import {
6
6
  EXIT_RANGE,
7
7
  FULLSCREEN_DIMENSIONS,
8
8
  } from "../../constants";
9
+ import { BoundStore, type TagData } from "../../stores/bounds.store";
9
10
  import type {
10
11
  ScreenInterpolationProps,
11
12
  ScreenTransitionState,
12
- } from "../../types/animation";
13
- import type { BoundsAccessor } from "../../types/bounds";
14
- import type { Layout, ScreenPhase } from "../../types/core";
15
- import type {
16
- BoundsBuilderInitParams,
17
- BoundsBuilderOptions,
18
- } from "./_types/builder";
13
+ } from "../../types/animation.types";
14
+ import type { BoundsAccessor } from "../../types/bounds.types";
15
+ import type { Layout } from "../../types/core.types";
19
16
  import {
20
17
  computeContentTransformGeometry,
21
18
  computeRelativeGeometry,
22
- } from "./_utils/geometry";
23
- import { getBounds } from "./_utils/get-bounds";
19
+ } from "./helpers/geometry";
24
20
  import {
25
21
  composeContentStyle,
26
22
  composeSizeAbsolute,
@@ -28,10 +24,13 @@ import {
28
24
  composeTransformAbsolute,
29
25
  composeTransformRelative,
30
26
  type ElementComposeParams,
31
- } from "./_utils/style-composers";
27
+ } from "./helpers/style-composers";
28
+ import type {
29
+ BoundsBuilderOptions,
30
+ BoundsComputeParams,
31
+ } from "./types/builder";
32
32
 
33
33
  export interface BuildBoundsAccessorParams {
34
- activeBoundId: string | null;
35
34
  current: ScreenTransitionState;
36
35
  previous?: ScreenTransitionState;
37
36
  next?: ScreenTransitionState;
@@ -50,34 +49,47 @@ const resolveBounds = (props: {
50
49
  }) => {
51
50
  "worklet";
52
51
  const entering = !props.next;
53
-
54
52
  const fullscreen = FULLSCREEN_DIMENSIONS(props.dimensions);
53
+ const isClosing = props.current?.closing === 1;
55
54
 
56
- const startPhase: ScreenPhase = entering ? "previous" : "current";
57
- const endPhase: ScreenPhase = entering ? "current" : "next";
55
+ const isFullscreenTarget = props.computeOptions.target === "fullscreen";
58
56
 
59
- const getPhaseBounds = (phase?: ScreenPhase) => {
60
- "worklet";
61
- switch (phase) {
62
- case "previous":
63
- return props.previous?.bounds?.[props.id]?.bounds;
64
- case "current":
65
- return props.current?.bounds?.[props.id]?.bounds;
66
- case "next":
67
- return props.next?.bounds?.[props.id]?.bounds;
68
- default:
69
- return null;
70
- }
71
- };
57
+ // Try exact match first (strict matching for nested stacks)
58
+ let link = BoundStore.getActiveLink(
59
+ props.id,
60
+ props.current?.route.key,
61
+ isClosing,
62
+ );
72
63
 
73
- const start = getPhaseBounds(startPhase);
74
- let end = getPhaseBounds(endPhase);
64
+ // For fullscreen target, fall back to most recent link for this tag
65
+ // (destination screen might not have a matching element)
66
+ if (!link && isFullscreenTarget) {
67
+ link = BoundStore.getActiveLink(props.id); // No screenKey = get most recent
68
+ }
75
69
 
76
- const isFullscreen =
77
- props.computeOptions.target === "fullscreen" ||
78
- props.computeOptions.toFullscreen;
70
+ if (!link || !link.source) {
71
+ return {
72
+ start: null,
73
+ end: null,
74
+ entering,
75
+ };
76
+ }
79
77
 
80
- if (isFullscreen) {
78
+ // For fullscreen target, destination element is not required
79
+ if (!isFullscreenTarget && !link.destination) {
80
+ return {
81
+ start: null,
82
+ end: null,
83
+ entering,
84
+ };
85
+ }
86
+
87
+ const { destination, source } = link;
88
+
89
+ const start = source.bounds;
90
+ let end = destination?.bounds ?? fullscreen;
91
+
92
+ if (isFullscreenTarget) {
81
93
  end = fullscreen;
82
94
  }
83
95
 
@@ -95,15 +107,8 @@ const resolveBounds = (props: {
95
107
  };
96
108
 
97
109
  const computeBoundStyles = (
98
- {
99
- id,
100
- previous,
101
- current,
102
- next,
103
- progress,
104
- dimensions,
105
- }: BoundsBuilderInitParams,
106
- computeOptions: BoundsBuilderOptions = {},
110
+ { id, previous, current, next, progress, dimensions }: BoundsComputeParams,
111
+ computeOptions: BoundsBuilderOptions = { id: "bound-id" },
107
112
  ) => {
108
113
  "worklet";
109
114
  if (!id) {
@@ -169,8 +174,7 @@ const computeBoundStyles = (
169
174
  };
170
175
 
171
176
  const isSize = computeOptions.method === "size";
172
- const isAbs =
173
- computeOptions.space === "absolute" || !!computeOptions.absolute;
177
+ const isAbs = computeOptions.space === "absolute";
174
178
 
175
179
  return isSize
176
180
  ? isAbs
@@ -188,13 +192,13 @@ export const createBounds = (
188
192
 
189
193
  const boundsFunction = (params?: BoundsBuilderOptions) => {
190
194
  "worklet";
191
- const id = params?.id ?? props.activeBoundId;
195
+ const id = params?.id;
192
196
 
193
197
  return computeBoundStyles(
194
198
  {
195
199
  id,
196
- current: props.current,
197
200
  previous: props.previous,
201
+ current: props.current,
198
202
  next: props.next,
199
203
  progress: props.progress,
200
204
  dimensions: props.layouts.screen,
@@ -203,16 +207,10 @@ export const createBounds = (
203
207
  );
204
208
  };
205
209
 
206
- const get = (id?: string, phase?: ScreenPhase) => {
210
+ const getOccurrence = (tag: string, key: string): TagData => {
207
211
  "worklet";
208
- return getBounds({
209
- id: id ?? props.activeBoundId,
210
- phase,
211
- current: props.current,
212
- previous: props.previous,
213
- next: props.next,
214
- });
212
+ return BoundStore.getOccurrence(tag, key);
215
213
  };
216
214
 
217
- return Object.assign(boundsFunction, { get }) as BoundsAccessor;
215
+ return Object.assign(boundsFunction, { getOccurrence }) as BoundsAccessor;
218
216
  };
@@ -1,19 +1,7 @@
1
1
  import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
- import type { ScreenTransitionState } from "../../../types/animation";
3
- import type { BoundsMethod } from "../../../types/bounds";
4
- import type { Layout } from "../../../types/core";
5
-
6
- /**
7
- * Params passed to the builder initializer. No method required here.
8
- */
9
- export type BoundsBuilderInitParams = {
10
- id: string | null;
11
- previous?: ScreenTransitionState;
12
- current: ScreenTransitionState;
13
- next?: ScreenTransitionState;
14
- progress: number;
15
- dimensions: Layout;
16
- };
2
+ import type { ScreenTransitionState } from "../../../types/animation.types";
3
+ import type { BoundsMethod } from "../../../types/bounds.types";
4
+ import type { Layout } from "../../../types/core.types";
17
5
 
18
6
  export type BoundsAnchor =
19
7
  | "topLeading"
@@ -32,7 +20,14 @@ export type BoundsTarget = "bound" | "fullscreen" | MeasuredDimensions;
32
20
 
33
21
  export type BoundsSpace = "relative" | "absolute";
34
22
 
35
- export type BoundsComputeParams = BoundsBuilderInitParams;
23
+ export type BoundsComputeParams = {
24
+ id?: string;
25
+ previous?: ScreenTransitionState;
26
+ current: ScreenTransitionState;
27
+ next?: ScreenTransitionState;
28
+ progress: number;
29
+ dimensions: Layout;
30
+ };
36
31
 
37
32
  export type RawSizeAbsoluteReturn = {
38
33
  width: number;
@@ -84,26 +79,14 @@ export type BoundsReturnType<T extends BoundsBuilderOptions> =
84
79
 
85
80
  export type BoundsBuilderOptions = {
86
81
  /**
87
- * @deprecated Use `content.scaleMode` instead.
88
- */
89
- toFullscreen?: boolean;
90
- /**
91
- * @deprecated Use `content.anchor` instead.
92
- */
93
- absolute?: boolean;
94
- /**
95
- * @deprecated Use `content.anchor` instead.
96
- */
97
- relative?: boolean;
98
- /**
99
- * @deprecated Use `scaleMode` instead.
82
+ * The ID of the bound to compute bounds for. If not provided, uses the active bound ID.
100
83
  */
101
- contentScaleMode?: "aspectFill" | "aspectFit" | "auto";
84
+ id: string;
102
85
 
103
86
  /**
104
- * The ID of the bound to compute bounds for. If not provided, uses the active bound ID.
87
+ * Whether the bound should target the screen or the bound.
105
88
  */
106
- id?: string;
89
+ target?: BoundsTarget;
107
90
 
108
91
  /**
109
92
  * The method to use to compute the bounds.
@@ -124,25 +107,24 @@ export type BoundsBuilderOptions = {
124
107
  * @default "relative"
125
108
  */
126
109
  space?: BoundsSpace;
127
- /**
128
- * Whether the bound should target the screen or the bound.
129
- * @default "bound"
130
- */
131
- target?: BoundsTarget;
110
+
132
111
  /**
133
112
  * The gesture offsets to apply to the bounds.
134
113
  */
135
114
  gestures?: { x?: number; y?: number };
115
+
136
116
  /**
137
117
  * How the bounds should be scaled between each other.
138
118
  * @default "match"
139
119
  */
140
120
  scaleMode?: BoundsScaleMode;
121
+
141
122
  /**
142
123
  * Where the bounds should be anchored between each other.
143
124
  * @default "center"
144
125
  */
145
126
  anchor?: BoundsAnchor;
127
+
146
128
  /**
147
129
  * If true, the raw values will be returned instead of the computed values.
148
130
  * @default false
@@ -0,0 +1,71 @@
1
+ /**
2
+ * THANK YOU @MatiPl01
3
+ * https://github.com/MatiPl01/react-native-sortables/blob/main/packages/react-native-sortables/src/providers/utils/createProvider.tsx
4
+ * SUPER COOL AMAZING UTILITY
5
+ */
6
+ import { createContext, type ReactNode, useContext, useMemo } from "react";
7
+
8
+ export default function createProvider<
9
+ ProviderName extends string,
10
+ Guarded extends boolean = true,
11
+ >(name: ProviderName, options?: { guarded?: Guarded }) {
12
+ return <ProviderProps extends object, ContextValue>(
13
+ factory: (props: ProviderProps) => {
14
+ value?: ContextValue;
15
+ enabled?: boolean;
16
+ children?: ReactNode;
17
+ },
18
+ ) => {
19
+ const { guarded = true } = options ?? {};
20
+
21
+ const Context = createContext<ContextValue | null>(null);
22
+ Context.displayName = name;
23
+
24
+ const Provider: React.FC<ProviderProps> = (props) => {
25
+ const {
26
+ children = (props as { children?: ReactNode }).children,
27
+ enabled = true,
28
+ value,
29
+ } = factory(props);
30
+
31
+ if (!value) {
32
+ throw new Error(
33
+ `${name}Context value must be provided. You likely forgot to return it from the factory function.`,
34
+ );
35
+ }
36
+
37
+ const memoValue = useMemo(
38
+ () => (enabled ? value : null),
39
+ [enabled, value],
40
+ );
41
+
42
+ return <Context.Provider value={memoValue}>{children}</Context.Provider>;
43
+ };
44
+
45
+ const useEnhancedContext = (): ContextValue | null => {
46
+ const context = useContext(Context);
47
+
48
+ if (guarded && context === null) {
49
+ throw new Error(
50
+ `${name} context must be used within a ${name}Provider`,
51
+ );
52
+ }
53
+
54
+ return context;
55
+ };
56
+
57
+ return {
58
+ [`${name}Context`]: Context,
59
+ [`${name}Provider`]: Provider,
60
+ [`use${name}Context`]: useEnhancedContext,
61
+ } as {
62
+ [P in ProviderName as `${P}Context`]: React.Context<ContextValue>;
63
+ } & {
64
+ [P in ProviderName as `${P}Provider`]: React.FC<ProviderProps>;
65
+ } & {
66
+ [P in ProviderName as `use${P}Context`]: () => Guarded extends true
67
+ ? ContextValue
68
+ : ContextValue | null;
69
+ };
70
+ };
71
+ }
@@ -9,13 +9,13 @@ import {
9
9
  GESTURE_FAIL_TOLERANCE_X,
10
10
  GESTURE_FAIL_TOLERANCE_Y,
11
11
  } from "../../constants";
12
- import type { Layout } from "../../types/core";
12
+ import type { Layout } from "../../types/core.types";
13
13
  import {
14
14
  type ActivationArea,
15
15
  type GestureActivationArea,
16
16
  GestureOffsetState,
17
17
  type SideActivation,
18
- } from "../../types/gesture";
18
+ } from "../../types/gesture.types";
19
19
 
20
20
  type Directions = {
21
21
  vertical: boolean;