react-native-screen-transitions 2.0.4 → 2.1.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 (300) hide show
  1. package/README.md +100 -77
  2. package/lib/commonjs/components/{bounds-activator.js → bound-capture.js} +4 -4
  3. package/lib/commonjs/components/bound-capture.js.map +1 -0
  4. package/lib/commonjs/components/controllers/screen-lifecycle.js +18 -4
  5. package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
  6. package/lib/commonjs/components/create-transition-aware-component.js +14 -12
  7. package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
  8. package/lib/commonjs/components/integrations/masked-view.js +52 -0
  9. package/lib/commonjs/components/integrations/masked-view.js.map +1 -0
  10. package/lib/commonjs/components/root-transition-aware.js +6 -15
  11. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  12. package/lib/commonjs/configs/index.js +15 -5
  13. package/lib/commonjs/configs/index.js.map +1 -1
  14. package/lib/commonjs/configs/presets.js +378 -7
  15. package/lib/commonjs/configs/presets.js.map +1 -1
  16. package/lib/commonjs/configs/specs.js +1 -1
  17. package/lib/commonjs/hooks/animation/use-associated-style.js +7 -10
  18. package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
  19. package/lib/commonjs/hooks/animation/use-screen-animation.js +37 -37
  20. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  21. package/lib/commonjs/hooks/bounds/use-bound-registry.js +73 -0
  22. package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -0
  23. package/lib/commonjs/hooks/gestures/use-build-gestures.js +156 -152
  24. package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
  25. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js +28 -0
  26. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  27. package/lib/commonjs/hooks/gestures/use-scroll-registry.js +146 -0
  28. package/lib/commonjs/hooks/gestures/use-scroll-registry.js.map +1 -0
  29. package/lib/commonjs/index.js +3 -0
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +7 -4
  32. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  33. package/lib/commonjs/providers/gestures.js +16 -16
  34. package/lib/commonjs/providers/gestures.js.map +1 -1
  35. package/lib/commonjs/providers/transition-styles.js +44 -0
  36. package/lib/commonjs/providers/transition-styles.js.map +1 -0
  37. package/lib/commonjs/stores/bounds.js +142 -1
  38. package/lib/commonjs/stores/bounds.js.map +1 -1
  39. package/lib/commonjs/stores/utils/reset-stores-for-screen.js +4 -2
  40. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  41. package/lib/commonjs/types/gesture.js +11 -0
  42. package/lib/commonjs/types/gesture.js.map +1 -1
  43. package/lib/commonjs/utils/animation/derivations.js +39 -0
  44. package/lib/commonjs/utils/animation/derivations.js.map +1 -0
  45. package/lib/commonjs/utils/animation/run-transition.js +6 -2
  46. package/lib/commonjs/utils/animation/run-transition.js.map +1 -1
  47. package/lib/commonjs/utils/bounds/_utils/flatten-styles.js.map +1 -0
  48. package/lib/commonjs/utils/bounds/_utils/geometry.js +179 -0
  49. package/lib/commonjs/utils/bounds/_utils/geometry.js.map +1 -0
  50. package/lib/commonjs/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  51. package/lib/commonjs/utils/bounds/_utils/get-bounds.js.map +1 -0
  52. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js +19 -0
  53. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  54. package/lib/commonjs/utils/bounds/_utils/style-composers.js +201 -0
  55. package/lib/commonjs/utils/bounds/_utils/style-composers.js.map +1 -0
  56. package/lib/commonjs/utils/bounds/constants.js +14 -3
  57. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  58. package/lib/commonjs/utils/bounds/index.js +210 -17
  59. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  60. package/lib/commonjs/utils/gesture/apply-offset-rules.js +233 -0
  61. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -0
  62. package/lib/commonjs/utils/gesture/check-gesture-activation.js +231 -0
  63. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -0
  64. package/lib/commonjs/utils/gesture/determine-dismissal.js +98 -0
  65. package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -0
  66. package/lib/module/components/{bounds-activator.js → bound-capture.js} +2 -2
  67. package/lib/module/components/bound-capture.js.map +1 -0
  68. package/lib/module/components/controllers/screen-lifecycle.js +18 -4
  69. package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
  70. package/lib/module/components/create-transition-aware-component.js +14 -12
  71. package/lib/module/components/create-transition-aware-component.js.map +1 -1
  72. package/lib/module/components/integrations/masked-view.js +48 -0
  73. package/lib/module/components/integrations/masked-view.js.map +1 -0
  74. package/lib/module/components/root-transition-aware.js +7 -16
  75. package/lib/module/components/root-transition-aware.js.map +1 -1
  76. package/lib/module/configs/index.js +15 -2
  77. package/lib/module/configs/index.js.map +1 -1
  78. package/lib/module/configs/presets.js +374 -6
  79. package/lib/module/configs/presets.js.map +1 -1
  80. package/lib/module/configs/specs.js +1 -1
  81. package/lib/module/hooks/animation/use-associated-style.js +6 -10
  82. package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
  83. package/lib/module/hooks/animation/use-screen-animation.js +37 -37
  84. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  85. package/lib/module/hooks/bounds/use-bound-registry.js +68 -0
  86. package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -0
  87. package/lib/module/hooks/gestures/use-build-gestures.js +156 -153
  88. package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
  89. package/lib/module/hooks/gestures/use-parent-gesture-registry.js +23 -0
  90. package/lib/module/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  91. package/lib/module/hooks/gestures/use-scroll-registry.js +140 -0
  92. package/lib/module/hooks/gestures/use-scroll-registry.js.map +1 -0
  93. package/lib/module/index.js +2 -0
  94. package/lib/module/index.js.map +1 -1
  95. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +7 -4
  96. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  97. package/lib/module/providers/gestures.js +16 -16
  98. package/lib/module/providers/gestures.js.map +1 -1
  99. package/lib/module/providers/transition-styles.js +39 -0
  100. package/lib/module/providers/transition-styles.js.map +1 -0
  101. package/lib/module/stores/bounds.js +142 -1
  102. package/lib/module/stores/bounds.js.map +1 -1
  103. package/lib/module/stores/utils/reset-stores-for-screen.js +4 -2
  104. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  105. package/lib/module/types/gesture.js +7 -0
  106. package/lib/module/types/gesture.js.map +1 -1
  107. package/lib/module/utils/animation/derivations.js +34 -0
  108. package/lib/module/utils/animation/derivations.js.map +1 -0
  109. package/lib/module/utils/animation/run-transition.js +6 -2
  110. package/lib/module/utils/animation/run-transition.js.map +1 -1
  111. package/lib/module/utils/bounds/_utils/flatten-styles.js.map +1 -0
  112. package/lib/module/utils/bounds/_utils/geometry.js +174 -0
  113. package/lib/module/utils/bounds/_utils/geometry.js.map +1 -0
  114. package/lib/module/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  115. package/lib/module/utils/bounds/_utils/get-bounds.js.map +1 -0
  116. package/lib/module/utils/bounds/_utils/is-bounds-equal.js +14 -0
  117. package/lib/module/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  118. package/lib/module/utils/bounds/_utils/style-composers.js +194 -0
  119. package/lib/module/utils/bounds/_utils/style-composers.js.map +1 -0
  120. package/lib/module/utils/bounds/constants.js +14 -3
  121. package/lib/module/utils/bounds/constants.js.map +1 -1
  122. package/lib/module/utils/bounds/index.js +208 -15
  123. package/lib/module/utils/bounds/index.js.map +1 -1
  124. package/lib/module/utils/gesture/apply-offset-rules.js +228 -0
  125. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -0
  126. package/lib/module/utils/gesture/check-gesture-activation.js +226 -0
  127. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -0
  128. package/lib/module/utils/gesture/determine-dismissal.js +93 -0
  129. package/lib/module/utils/gesture/determine-dismissal.js.map +1 -0
  130. package/lib/typescript/components/bound-capture.d.ts +8 -0
  131. package/lib/typescript/components/bound-capture.d.ts.map +1 -0
  132. package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -1
  133. package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
  134. package/lib/typescript/components/integrations/masked-view.d.ts +6 -0
  135. package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -0
  136. package/lib/typescript/components/root-transition-aware.d.ts +3 -3
  137. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  138. package/lib/typescript/configs/index.d.ts +15 -2
  139. package/lib/typescript/configs/index.d.ts.map +1 -1
  140. package/lib/typescript/configs/presets.d.ts +3 -0
  141. package/lib/typescript/configs/presets.d.ts.map +1 -1
  142. package/lib/typescript/hooks/animation/use-associated-style.d.ts +6 -4
  143. package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
  144. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  145. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts → use-bound-registry.d.ts} +5 -4
  146. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts.map → use-bound-registry.d.ts.map} +1 -1
  147. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +6 -5
  148. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  149. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts +6 -0
  150. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts.map +1 -0
  151. package/lib/typescript/hooks/gestures/{use-scroll-progress.d.ts → use-scroll-registry.d.ts} +2 -2
  152. package/lib/typescript/hooks/gestures/use-scroll-registry.d.ts.map +1 -0
  153. package/lib/typescript/index.d.ts +25 -11
  154. package/lib/typescript/index.d.ts.map +1 -1
  155. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  156. package/lib/typescript/providers/gestures.d.ts +4 -2
  157. package/lib/typescript/providers/gestures.d.ts.map +1 -1
  158. package/lib/typescript/providers/transition-styles.d.ts +8 -0
  159. package/lib/typescript/providers/transition-styles.d.ts.map +1 -0
  160. package/lib/typescript/stores/bounds.d.ts +11 -0
  161. package/lib/typescript/stores/bounds.d.ts.map +1 -1
  162. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +3 -1
  163. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  164. package/lib/typescript/types/bounds.d.ts +5 -1
  165. package/lib/typescript/types/bounds.d.ts.map +1 -1
  166. package/lib/typescript/types/gesture.d.ts +14 -0
  167. package/lib/typescript/types/gesture.d.ts.map +1 -1
  168. package/lib/typescript/types/navigator.d.ts +5 -1
  169. package/lib/typescript/types/navigator.d.ts.map +1 -1
  170. package/lib/typescript/utils/animation/derivations.d.ts +19 -0
  171. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -0
  172. package/lib/typescript/utils/animation/run-transition.d.ts +2 -1
  173. package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -1
  174. package/lib/typescript/utils/bounds/_types/builder.d.ts +96 -14
  175. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  176. package/lib/typescript/utils/bounds/_types/geometry.d.ts +0 -1
  177. package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -1
  178. package/lib/typescript/utils/bounds/_utils/flatten-styles.d.ts.map +1 -0
  179. package/lib/typescript/utils/bounds/{geometry.d.ts → _utils/geometry.d.ts} +8 -5
  180. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -0
  181. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts +4 -0
  182. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts.map +1 -0
  183. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts +7 -0
  184. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts.map +1 -0
  185. package/lib/typescript/utils/bounds/{style-composers.d.ts → _utils/style-composers.d.ts} +7 -10
  186. package/lib/typescript/utils/bounds/_utils/style-composers.d.ts.map +1 -0
  187. package/lib/typescript/utils/bounds/constants.d.ts +5 -5
  188. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  189. package/lib/typescript/utils/bounds/index.d.ts +2 -4
  190. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  191. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +38 -0
  192. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -0
  193. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +38 -0
  194. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -0
  195. package/lib/typescript/utils/gesture/determine-dismissal.d.ts +25 -0
  196. package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -0
  197. package/package.json +2 -3
  198. package/src/__tests__/geometry.test.ts +15 -12
  199. package/src/components/{bounds-activator.tsx → bound-capture.tsx} +1 -1
  200. package/src/components/controllers/screen-lifecycle.tsx +13 -5
  201. package/src/components/create-transition-aware-component.tsx +17 -11
  202. package/src/components/integrations/masked-view.tsx +56 -0
  203. package/src/components/root-transition-aware.tsx +31 -39
  204. package/src/configs/index.ts +26 -2
  205. package/src/configs/presets.ts +401 -6
  206. package/src/configs/specs.ts +1 -1
  207. package/src/hooks/animation/use-associated-style.tsx +12 -11
  208. package/src/hooks/animation/use-screen-animation.tsx +48 -49
  209. package/src/hooks/bounds/{use-bound-measurer.tsx → use-bound-registry.tsx} +32 -20
  210. package/src/hooks/gestures/use-build-gestures.tsx +193 -228
  211. package/src/hooks/gestures/use-parent-gesture-registry.tsx +18 -0
  212. package/src/hooks/gestures/use-scroll-registry.tsx +145 -0
  213. package/src/index.ts +2 -0
  214. package/src/integrations/native-stack/views/NativeStackView.native.tsx +8 -5
  215. package/src/providers/gestures.tsx +19 -22
  216. package/src/providers/transition-styles.tsx +52 -0
  217. package/src/stores/bounds.ts +156 -0
  218. package/src/stores/utils/reset-stores-for-screen.ts +7 -2
  219. package/src/types/bounds.ts +8 -1
  220. package/src/types/gesture.ts +19 -0
  221. package/src/types/navigator.ts +5 -1
  222. package/src/utils/animation/derivations.ts +38 -0
  223. package/src/utils/animation/run-transition.ts +4 -1
  224. package/src/utils/bounds/_types/builder.ts +127 -11
  225. package/src/utils/bounds/_types/geometry.ts +0 -1
  226. package/src/utils/bounds/_utils/geometry.ts +166 -0
  227. package/src/utils/bounds/_utils/get-bounds.ts +54 -0
  228. package/src/utils/bounds/_utils/is-bounds-equal.ts +24 -0
  229. package/src/utils/bounds/_utils/style-composers.ts +216 -0
  230. package/src/utils/bounds/constants.ts +37 -22
  231. package/src/utils/bounds/index.ts +269 -19
  232. package/src/utils/gesture/apply-offset-rules.ts +314 -0
  233. package/src/utils/gesture/check-gesture-activation.ts +310 -0
  234. package/src/utils/gesture/determine-dismissal.ts +131 -0
  235. package/lib/commonjs/components/bounds-activator.js.map +0 -1
  236. package/lib/commonjs/hooks/bounds/use-bound-measurer.js +0 -52
  237. package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +0 -1
  238. package/lib/commonjs/hooks/gestures/use-scroll-progress.js +0 -57
  239. package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +0 -1
  240. package/lib/commonjs/utils/bounds/build-bound-styles.js +0 -145
  241. package/lib/commonjs/utils/bounds/build-bound-styles.js.map +0 -1
  242. package/lib/commonjs/utils/bounds/flatten-styles.js.map +0 -1
  243. package/lib/commonjs/utils/bounds/geometry.js +0 -94
  244. package/lib/commonjs/utils/bounds/geometry.js.map +0 -1
  245. package/lib/commonjs/utils/bounds/get-bounds.js.map +0 -1
  246. package/lib/commonjs/utils/bounds/style-composers.js +0 -199
  247. package/lib/commonjs/utils/bounds/style-composers.js.map +0 -1
  248. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +0 -81
  249. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  250. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +0 -21
  251. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +0 -1
  252. package/lib/commonjs/utils/index.js +0 -17
  253. package/lib/commonjs/utils/index.js.map +0 -1
  254. package/lib/module/components/bounds-activator.js.map +0 -1
  255. package/lib/module/hooks/bounds/use-bound-measurer.js +0 -47
  256. package/lib/module/hooks/bounds/use-bound-measurer.js.map +0 -1
  257. package/lib/module/hooks/gestures/use-scroll-progress.js +0 -52
  258. package/lib/module/hooks/gestures/use-scroll-progress.js.map +0 -1
  259. package/lib/module/utils/bounds/build-bound-styles.js +0 -141
  260. package/lib/module/utils/bounds/build-bound-styles.js.map +0 -1
  261. package/lib/module/utils/bounds/flatten-styles.js.map +0 -1
  262. package/lib/module/utils/bounds/geometry.js +0 -89
  263. package/lib/module/utils/bounds/geometry.js.map +0 -1
  264. package/lib/module/utils/bounds/get-bounds.js.map +0 -1
  265. package/lib/module/utils/bounds/style-composers.js +0 -191
  266. package/lib/module/utils/bounds/style-composers.js.map +0 -1
  267. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +0 -76
  268. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  269. package/lib/module/utils/gesture/normalize-gesture-translation.js +0 -16
  270. package/lib/module/utils/gesture/normalize-gesture-translation.js.map +0 -1
  271. package/lib/module/utils/index.js +0 -4
  272. package/lib/module/utils/index.js.map +0 -1
  273. package/lib/typescript/components/bounds-activator.d.ts +0 -8
  274. package/lib/typescript/components/bounds-activator.d.ts.map +0 -1
  275. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +0 -1
  276. package/lib/typescript/utils/bounds/build-bound-styles.d.ts +0 -4
  277. package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +0 -1
  278. package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +0 -1
  279. package/lib/typescript/utils/bounds/geometry.d.ts.map +0 -1
  280. package/lib/typescript/utils/bounds/get-bounds.d.ts +0 -4
  281. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +0 -1
  282. package/lib/typescript/utils/bounds/style-composers.d.ts.map +0 -1
  283. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +0 -17
  284. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +0 -1
  285. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +0 -6
  286. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +0 -1
  287. package/lib/typescript/utils/index.d.ts +0 -2
  288. package/lib/typescript/utils/index.d.ts.map +0 -1
  289. package/src/hooks/gestures/use-scroll-progress.tsx +0 -60
  290. package/src/utils/bounds/build-bound-styles.ts +0 -184
  291. package/src/utils/bounds/geometry.ts +0 -113
  292. package/src/utils/bounds/get-bounds.ts +0 -56
  293. package/src/utils/bounds/style-composers.ts +0 -172
  294. package/src/utils/gesture/apply-gesture-activation-criteria.ts +0 -109
  295. package/src/utils/gesture/normalize-gesture-translation.ts +0 -20
  296. package/src/utils/index.ts +0 -1
  297. /package/lib/commonjs/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
  298. /package/lib/module/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
  299. /package/lib/typescript/utils/bounds/{flatten-styles.d.ts → _utils/flatten-styles.d.ts} +0 -0
  300. /package/src/utils/bounds/{flatten-styles.ts → _utils/flatten-styles.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ import type { MeasuredDimensions } from "react-native-reanimated";
2
+ export declare const isBoundsEqual: ({ measured, key, sharedBoundTag, }: {
3
+ measured: MeasuredDimensions;
4
+ key: string;
5
+ sharedBoundTag: string;
6
+ }) => boolean;
7
+ //# sourceMappingURL=is-bounds-equal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-bounds-equal.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/is-bounds-equal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,eAAO,MAAM,aAAa,GAAI,oCAI3B;IACF,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACvB,YAYA,CAAC"}
@@ -1,11 +1,6 @@
1
- import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
2
- import type { BoundsBuilderOptions } from "./_types/builder";
3
- import type { ContentTransformGeometry, RelativeGeometry } from "./_types/geometry";
4
- /**
5
- * Common interpolation helper signature used by composers.
6
- * It maps from a -> b over the already-determined progress range.
7
- */
8
- export type Interp = (a: number, b: number) => number;
1
+ import { type MeasuredDimensions, type StyleProps } from "react-native-reanimated";
2
+ import type { BoundsBuilderOptions } from "../_types/builder";
3
+ import type { ContentTransformGeometry, RelativeGeometry } from "../_types/geometry";
9
4
  /**
10
5
  * Element-level (relative) params shared by size/transform composers.
11
6
  * - start/end: absolute window bounds of the element in previous/next phases
@@ -16,7 +11,8 @@ export type ElementComposeParams = {
16
11
  start: MeasuredDimensions;
17
12
  end: MeasuredDimensions;
18
13
  geometry: RelativeGeometry;
19
- interp: Interp;
14
+ progress: number;
15
+ ranges: readonly [number, number];
20
16
  computeOptions: BoundsBuilderOptions;
21
17
  };
22
18
  /**
@@ -29,7 +25,8 @@ export type ContentComposeParams = {
29
25
  start: MeasuredDimensions;
30
26
  end: MeasuredDimensions;
31
27
  geometry: ContentTransformGeometry;
32
- interp: Interp;
28
+ progress: number;
29
+ ranges: readonly [number, number];
33
30
  computeOptions: BoundsBuilderOptions;
34
31
  };
35
32
  export declare function composeSizeAbsolute(params: ElementComposeParams): StyleProps;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-composers.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/style-composers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAgC5E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAkC5E;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CA6BZ;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CAoCZ;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CA+B5E"}
@@ -1,7 +1,7 @@
1
- import type { ScaledSize } from 'react-native';
2
- import type { MeasuredDimensions } from 'react-native-reanimated';
3
- import type { Complete } from '../../types/utils';
4
- import type { BoundsBuilderOptions } from './_types/builder';
1
+ import type { ScaledSize } from "react-native";
2
+ import type { MeasuredDimensions } from "react-native-reanimated";
3
+ import type { Complete } from "../../types/utils";
4
+ import type { BoundsBuilderOptions } from "./_types/builder";
5
5
  export declare const FULLSCREEN_DIMENSIONS: (dimensions: ScaledSize) => MeasuredDimensions;
6
- export declare const DEFAULT_BUILDER_OPTIONS: Complete<BoundsBuilderOptions>;
6
+ export declare const DEFAULT_BUILDER_OPTIONS: Complete<Omit<BoundsBuilderOptions, "id">>;
7
7
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,oBAAoB,CAOjE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,GACjC,YAAY,UAAU,KACpB,kBAUF,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC7C,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAmBtB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { ScaledSize } from "react-native";
2
- import type { ScreenPhase } from "../../types/core";
3
2
  import type { ScreenTransitionState } from "../../types/animation";
3
+ import type { BoundsAccessor } from "../../types/bounds";
4
4
  export interface BuildBoundsAccessorParams {
5
5
  activeBoundId: string | null;
6
6
  current: ScreenTransitionState;
@@ -9,7 +9,5 @@ export interface BuildBoundsAccessorParams {
9
9
  progress: number;
10
10
  dimensions: ScaledSize;
11
11
  }
12
- export declare const buildBoundsAccessor: ({ activeBoundId, current, previous, next, progress, dimensions, }: BuildBoundsAccessorParams) => ((id?: string) => import("../../types/bounds").BoundsBuilder) & {
13
- get: (id?: string, phase?: ScreenPhase) => import("../../types/bounds").BoundEntry;
14
- };
12
+ export declare const createBounds: ({ activeBoundId, current, previous, next, progress, dimensions, }: BuildBoundsAccessorParams) => BoundsAccessor;
15
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,mEAOjC,yBAAyB,YAGN,MAAM;eAWf,MAAM,UAAU,WAAW;CASvC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,oBAAoB,CAAC;AAqBxE,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACvB;AAwND,eAAO,MAAM,YAAY,GAAI,mEAO1B,yBAAyB,KAAG,cAyC9B,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ScaledSize } from "react-native";
2
+ import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
3
+ import type { SharedValue } from "react-native-reanimated";
4
+ import { type GestureActivationArea, GestureOffsetState } from "../../types/gesture";
5
+ type Directions = {
6
+ vertical: boolean;
7
+ verticalInverted: boolean;
8
+ horizontal: boolean;
9
+ horizontalInverted: boolean;
10
+ };
11
+ interface CheckGestureActivationProps {
12
+ initialTouch: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ touch: {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ directions: Directions;
21
+ manager?: GestureStateManagerType;
22
+ gestureOffsetState: SharedValue<GestureOffsetState>;
23
+ activationArea?: GestureActivationArea;
24
+ dimensions: ScaledSize;
25
+ responseDistance?: number;
26
+ }
27
+ interface ReturnValues {
28
+ isSwipingDown: boolean;
29
+ isSwipingUp: boolean;
30
+ isSwipingRight: boolean;
31
+ isSwipingLeft: boolean;
32
+ }
33
+ /**
34
+ * Since we're using onTouchesMove to activate our pan, faillOffset and activateOffset don't actually work. In that case we'll create this function to use in onTouchesMove which acts simarly to the original functionality.
35
+ */
36
+ export declare const applyOffsetRules: ({ initialTouch, touch, directions, manager, gestureOffsetState, activationArea, dimensions, responseDistance, }: CheckGestureActivationProps) => ReturnValues;
37
+ export {};
38
+ //# sourceMappingURL=apply-offset-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-offset-rules.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/apply-offset-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mFAAmF,CAAC;AACjI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEN,KAAK,qBAAqB,EAC1B,kBAAkB,EAElB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,UAAU,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,UAAU,2BAA2B;IACpC,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AA8BD,UAAU,YAAY;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACvB;AAiKD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,iHAS9B,2BAA2B,KAAG,YA+EhC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ScaledSize } from "react-native";
2
+ import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
3
+ import type { SharedValue } from "react-native-reanimated";
4
+ import { type GestureActivationArea, GestureOffsetState } from "../../types/gesture";
5
+ type Directions = {
6
+ vertical: boolean;
7
+ verticalInverted: boolean;
8
+ horizontal: boolean;
9
+ horizontalInverted: boolean;
10
+ };
11
+ interface CheckGestureActivationProps {
12
+ initialTouch: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ touch: {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ directions: Directions;
21
+ manager?: GestureStateManagerType;
22
+ gestureOffsetState: SharedValue<GestureOffsetState>;
23
+ activationArea?: GestureActivationArea;
24
+ dimensions: ScaledSize;
25
+ responseDistance?: number;
26
+ }
27
+ interface ReturnValues {
28
+ isSwipingDown: boolean;
29
+ isSwipingUp: boolean;
30
+ isSwipingRight: boolean;
31
+ isSwipingLeft: boolean;
32
+ }
33
+ /**
34
+ * Since we're using onTouchesMove to activate our pan, faillOffset and activateOffset don't actually work. In that case we'll create this function to use in onTouchesMove which acts simarly to the original functionality.
35
+ */
36
+ export declare const applyOffsetRules: ({ initialTouch, touch, directions, manager, gestureOffsetState, activationArea, dimensions, responseDistance, }: CheckGestureActivationProps) => ReturnValues;
37
+ export {};
38
+ //# sourceMappingURL=check-gesture-activation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-gesture-activation.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/check-gesture-activation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mFAAmF,CAAC;AACjI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEN,KAAK,qBAAqB,EAC1B,kBAAkB,EAElB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,UAAU,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,UAAU,2BAA2B;IACpC,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AA8BD,UAAU,YAAY;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACvB;AAiKD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,iHAS9B,2BAA2B,KAAG,YA2EhC,CAAC"}
@@ -0,0 +1,25 @@
1
+ interface DetermineDismissalProps {
2
+ event: {
3
+ translationX: number;
4
+ translationY: number;
5
+ velocityX: number;
6
+ velocityY: number;
7
+ };
8
+ directions: {
9
+ vertical: boolean;
10
+ verticalInverted: boolean;
11
+ horizontal: boolean;
12
+ horizontalInverted: boolean;
13
+ };
14
+ dimensions: {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ gestureVelocityImpact: number;
19
+ }
20
+ export declare const determineDismissal: ({ event, directions, dimensions, gestureVelocityImpact, }: DetermineDismissalProps) => {
21
+ shouldDismiss: boolean;
22
+ velocity: number;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=determine-dismissal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determine-dismissal.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/determine-dismissal.ts"],"names":[],"mappings":"AAOA,UAAU,uBAAuB;IAChC,KAAK,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,EAAE;QACX,QAAQ,EAAE,OAAO,CAAC;QAClB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,UAAU,EAAE,OAAO,CAAC;QACpB,kBAAkB,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAuCD,eAAO,MAAM,kBAAkB,GAAI,2DAKhC,uBAAuB;;;CAgEzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screen-transitions",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "Easy screen transitions for React Native and Expo",
5
5
  "author": "Ed",
6
6
  "license": "MIT",
@@ -49,7 +49,6 @@
49
49
  "@testing-library/react-native": "^13.2.0",
50
50
  "@types/react": "~19.0.10",
51
51
  "react-native-builder-bob": "0.39.0",
52
- "tsup": "^8.5.0",
53
52
  "typescript": "~5.8.3"
54
53
  },
55
54
  "react-native-builder-bob": {
@@ -66,5 +65,5 @@
66
65
  ]
67
66
  ]
68
67
  },
69
- "gitHead": "38f75fc51e610d78d165d5fc78b94f71a1db0efe"
68
+ "gitHead": "92afaa07f6b9c279851d6aef805ecbfefdbcc4df"
70
69
  }
@@ -2,7 +2,7 @@ import { describe, expect, it } from "bun:test";
2
2
  import {
3
3
  computeContentTransformGeometry,
4
4
  computeRelativeGeometry,
5
- } from "../utils/bounds/geometry";
5
+ } from "../utils/bounds/_utils/geometry";
6
6
 
7
7
  describe("computeRelativeGeometry", () => {
8
8
  it("calculates correct relative geometry when entering", () => {
@@ -29,7 +29,6 @@ describe("computeRelativeGeometry", () => {
29
29
  expect(result.dy).toBe(-180); // center diff Y
30
30
  expect(result.scaleX).toBe(0.5); // width ratio
31
31
  expect(result.scaleY).toBe(0.5); // height ratio
32
- expect(result.ranges).toEqual([0, 1]);
33
32
  expect(result.entering).toBe(true);
34
33
  });
35
34
 
@@ -39,7 +38,6 @@ describe("computeRelativeGeometry", () => {
39
38
 
40
39
  const result = computeRelativeGeometry({ start, end, entering: false });
41
40
 
42
- expect(result.ranges).toEqual([1, 2]);
43
41
  expect(result.entering).toBe(false);
44
42
  });
45
43
  });
@@ -47,7 +45,7 @@ describe("computeRelativeGeometry", () => {
47
45
  describe("computeContentTransformGeometry", () => {
48
46
  const dimensions = { width: 375, height: 812, scale: 1, fontScale: 1 };
49
47
 
50
- it("calculates transform with aspectFit mode", () => {
48
+ it("uniform chooses min scale when aspect ratio differs significantly", () => {
51
49
  const start = {
52
50
  x: 0,
53
51
  y: 0,
@@ -63,15 +61,15 @@ describe("computeContentTransformGeometry", () => {
63
61
  end,
64
62
  entering: true,
65
63
  dimensions,
66
- contentScaleMode: "aspectFit",
64
+ anchor: "center",
65
+ scaleMode: "uniform",
67
66
  });
68
67
 
69
68
  expect(result.s).toBe(0.5);
70
69
  expect(result.entering).toBe(true);
71
- expect(result.ranges).toEqual([0, 1]);
72
70
  });
73
71
 
74
- it("calculates transform with aspectFill mode", () => {
72
+ it("calculates transform with match mode (average of sx/sy)", () => {
75
73
  const start = {
76
74
  x: 0,
77
75
  y: 0,
@@ -87,13 +85,16 @@ describe("computeContentTransformGeometry", () => {
87
85
  end,
88
86
  entering: true,
89
87
  dimensions,
90
- contentScaleMode: "aspectFill",
88
+ anchor: "center",
89
+ // match mode uses the average of sx and sy
90
+ scaleMode: "match",
91
91
  });
92
92
 
93
- expect(result.s).toBe(2);
93
+ // sx = 100/200 = 0.5, sy = 100/50 = 2 -> (0.5 + 2) / 2 = 1.25
94
+ expect(result.s).toBeCloseTo(1.25, 5);
94
95
  });
95
96
 
96
- it("handles auto mode based on aspect ratio difference", () => {
97
+ it("uniform chooses max scale when aspect ratios are similar", () => {
97
98
  const start = { x: 0, y: 0, pageX: 0, pageY: 0, width: 100, height: 100 };
98
99
  const end = { x: 0, y: 0, pageX: 0, pageY: 0, width: 200, height: 195 };
99
100
 
@@ -102,7 +103,8 @@ describe("computeContentTransformGeometry", () => {
102
103
  end,
103
104
  entering: true,
104
105
  dimensions,
105
- contentScaleMode: "auto",
106
+ anchor: "center",
107
+ scaleMode: "uniform",
106
108
  });
107
109
 
108
110
  expect(result.s).toBeCloseTo(0.512, 2);
@@ -118,7 +120,8 @@ describe("computeContentTransformGeometry", () => {
118
120
  end,
119
121
  entering: true,
120
122
  dimensions,
121
- contentScaleMode: "aspectFit",
123
+ anchor: "center",
124
+ scaleMode: "uniform",
122
125
  });
123
126
 
124
127
  expect(result.s).toBeDefined();
@@ -8,7 +8,7 @@ interface BoundActivatorProps {
8
8
  measure: () => void;
9
9
  }
10
10
 
11
- export const BoundActivator = ({
11
+ export const BoundCapture = ({
12
12
  sharedBoundTag,
13
13
  children,
14
14
  measure,
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useLayoutEffect } from "react";
2
+ import { useParentGestureRegistry } from "../../hooks/gestures/use-parent-gesture-registry";
2
3
  import useStableCallback from "../../hooks/use-stable-callback";
3
4
  import { useKeys } from "../../providers/keys";
4
5
  import { Animations } from "../../stores/animations";
@@ -23,21 +24,25 @@ export const ScreenLifecycleController = ({
23
24
 
24
25
  // Don't run e.preventDefault when the dismissal was on the local root
25
26
  if (requestedDismissOnNavigator) {
26
- resetStoresForScreen(current);
27
+ resetStoresForScreen(current, { clearActive: true });
27
28
  return;
28
29
  }
29
30
 
30
31
  // Don't run e.preventDefault when this is the first screen of the stack
31
32
  if (current.navigation.getState().index === 0) {
32
- resetStoresForScreen(current);
33
+ resetStoresForScreen(current, { clearActive: true });
33
34
  return;
34
35
  }
35
36
 
36
37
  e.preventDefault();
37
38
  const onFinish = (finished: boolean) => {
38
39
  if (finished) {
39
- resetStoresForScreen(current);
40
40
  current.navigation.dispatch(e.data.action);
41
+
42
+ // we'll ensure the dispatch is complete before resetting stores
43
+ requestAnimationFrame(() => {
44
+ resetStoresForScreen(current, { clearActive: false });
45
+ });
41
46
  }
42
47
  };
43
48
 
@@ -57,8 +62,6 @@ export const ScreenLifecycleController = ({
57
62
  });
58
63
  });
59
64
 
60
- useLayoutEffect(handleInitialize, []);
61
-
62
65
  useEffect(() => {
63
66
  const unsubscribe = current.navigation.addListener(
64
67
  "beforeRemove",
@@ -68,5 +71,10 @@ export const ScreenLifecycleController = ({
68
71
  return unsubscribe;
69
72
  }, [current.navigation, handleBeforeRemove]);
70
73
 
74
+ useLayoutEffect(handleInitialize, []);
75
+
76
+ // important for t.a scrollviews inside nested navigators.
77
+ useParentGestureRegistry();
78
+
71
79
  return children;
72
80
  };
@@ -4,13 +4,13 @@ import type { View } from "react-native";
4
4
  import { GestureDetector } from "react-native-gesture-handler";
5
5
  import Animated, { runOnUI, useAnimatedRef } from "react-native-reanimated";
6
6
  import { useAssociatedStyles } from "../hooks/animation/use-associated-style";
7
- import { useBoundMeasurer } from "../hooks/bounds/use-bound-measurer";
8
- import { useScrollProgress } from "../hooks/gestures/use-scroll-progress";
7
+ import { useBoundsRegistry } from "../hooks/bounds/use-bound-registry";
8
+ import { useScrollRegistry } from "../hooks/gestures/use-scroll-registry";
9
9
  import { useGestureContext } from "../providers/gestures";
10
10
  import { useKeys } from "../providers/keys";
11
11
  import type { TransitionAwareProps } from "../types/core";
12
12
  import type { Any } from "../types/utils";
13
- import { BoundActivator } from "./bounds-activator";
13
+ import { BoundCapture } from "./bound-capture";
14
14
 
15
15
  interface CreateTransitionAwareComponentOptions {
16
16
  isScrollable?: boolean;
@@ -29,11 +29,10 @@ export function createTransitionAwareComponent<P extends object>(
29
29
  TransitionAwareProps<P>
30
30
  >((props: Any, ref) => {
31
31
  const { nativeGesture } = useGestureContext();
32
-
33
- const { scrollHandler, onContentSizeChange, onLayout } = useScrollProgress({
32
+ const { scrollHandler, onContentSizeChange, onLayout } = useScrollRegistry({
34
33
  onScroll: props.onScroll,
35
34
  onContentSizeChange: props.onContentSizeChange,
36
- onLayout: props.onLayout, // Add this line to pass through onLayout
35
+ onLayout: props.onLayout,
37
36
  });
38
37
 
39
38
  return (
@@ -64,7 +63,7 @@ export function createTransitionAwareComponent<P extends object>(
64
63
  id: sharedBoundTag || styleId,
65
64
  });
66
65
 
67
- const { measureAndSet, measureOnLayout } = useBoundMeasurer({
66
+ const { measureBounds, handleLayout } = useBoundsRegistry({
68
67
  sharedBoundTag,
69
68
  animatedRef,
70
69
  current,
@@ -72,21 +71,28 @@ export function createTransitionAwareComponent<P extends object>(
72
71
  });
73
72
 
74
73
  if (isScrollable) {
75
- return <ScrollableInner {...(props as Any)} ref={ref} />;
74
+ return (
75
+ <ScrollableInner
76
+ {...(props as Any)}
77
+ ref={ref}
78
+ measureBounds={measureBounds}
79
+ handleLayout={handleLayout}
80
+ />
81
+ );
76
82
  }
77
83
 
78
84
  return (
79
- <BoundActivator sharedBoundTag={sharedBoundTag} measure={measureAndSet}>
85
+ <BoundCapture sharedBoundTag={sharedBoundTag} measure={measureBounds}>
80
86
  <AnimatedComponent
81
87
  {...(rest as Any)}
82
88
  ref={animatedRef}
83
89
  style={[style, associatedStyles]}
84
90
  onPress={onPress}
85
- onLayout={runOnUI(measureOnLayout)}
91
+ onLayout={runOnUI(handleLayout)}
86
92
  >
87
93
  {children}
88
94
  </AnimatedComponent>
89
- </BoundActivator>
95
+ </BoundCapture>
90
96
  );
91
97
  });
92
98
 
@@ -0,0 +1,56 @@
1
+ import { type StyleProp, StyleSheet, View, type ViewStyle } from "react-native";
2
+ import { createTransitionAwareComponent } from "../create-transition-aware-component";
3
+
4
+ const TransitionView = createTransitionAwareComponent(View);
5
+
6
+ let LazyMaskedView = View;
7
+
8
+ try {
9
+ LazyMaskedView = require("@react-native-masked-view/masked-view").default;
10
+ } catch (_) {
11
+ // noop
12
+ }
13
+
14
+ const MASK_STYLE_ID = "_ROOT_MASKED";
15
+ const CONTAINER_STYLE_ID = "_ROOT_CONTAINER";
16
+
17
+ export default function MaskedView({
18
+ children,
19
+ style: userStyles = {},
20
+ }: {
21
+ children: React.ReactNode;
22
+ style?: StyleProp<ViewStyle>;
23
+ }) {
24
+ if (LazyMaskedView === View) {
25
+ return children;
26
+ }
27
+
28
+ return (
29
+ <LazyMaskedView
30
+ style={styles.root}
31
+ // @ts-expect-error
32
+ maskElement={
33
+ <TransitionView styleId={MASK_STYLE_ID} style={styles.rootMask} />
34
+ }
35
+ >
36
+ <TransitionView
37
+ styleId={CONTAINER_STYLE_ID}
38
+ style={[styles.rootContainer, userStyles]}
39
+ >
40
+ {children}
41
+ </TransitionView>
42
+ </LazyMaskedView>
43
+ );
44
+ }
45
+
46
+ const styles = StyleSheet.create({
47
+ root: {
48
+ flex: 1,
49
+ },
50
+ rootMask: {
51
+ backgroundColor: "white",
52
+ },
53
+ rootContainer: {
54
+ flex: 1,
55
+ },
56
+ });
@@ -1,50 +1,42 @@
1
1
  import { memo } from "react";
2
- import { StyleSheet } from "react-native";
3
- import Animated, { useAnimatedStyle } from "react-native-reanimated";
4
- import { _useScreenAnimation } from "../hooks/animation/use-screen-animation";
2
+ import { StyleSheet, View } from "react-native";
3
+ import Animated, {
4
+ type StyleProps,
5
+ useAnimatedStyle,
6
+ } from "react-native-reanimated";
7
+ import { useTransitionStyles } from "../providers/transition-styles";
5
8
 
6
- interface RootTransitionAwareProps {
9
+ type Props = {
7
10
  children: React.ReactNode;
8
- }
11
+ };
9
12
 
10
- export const RootTransitionAware = memo(
11
- ({ children }: RootTransitionAwareProps) => {
12
- const { screenInterpolatorProps, screenStyleInterpolator } =
13
- _useScreenAnimation();
13
+ const EMPTY_STYLE = Object.freeze({} as StyleProps);
14
14
 
15
- const animatedContentStyle = useAnimatedStyle(() => {
16
- "worklet";
17
- if (!screenStyleInterpolator) {
18
- return {};
19
- }
20
- const props = screenInterpolatorProps.value;
21
- return screenStyleInterpolator(props).contentStyle || {};
22
- });
15
+ export const RootTransitionAware = memo(({ children }: Props) => {
16
+ const stylesMap = useTransitionStyles();
23
17
 
24
- const animatedOverlayStyle = useAnimatedStyle(() => {
25
- "worklet";
26
- if (!screenStyleInterpolator) {
27
- return {};
28
- }
29
- return (
30
- screenStyleInterpolator(screenInterpolatorProps.value).overlayStyle ||
31
- {}
32
- );
33
- });
18
+ const animatedContentStyle = useAnimatedStyle(() => {
19
+ "worklet";
20
+ return stylesMap.value.contentStyle || EMPTY_STYLE;
21
+ });
34
22
 
35
- return (
36
- <Animated.View style={styles.container}>
37
- <Animated.View
38
- style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
39
- pointerEvents="none"
40
- />
41
- <Animated.View style={[styles.content, animatedContentStyle]}>
42
- {children}
43
- </Animated.View>
23
+ const animatedOverlayStyle = useAnimatedStyle(() => {
24
+ "worklet";
25
+ return stylesMap.value.overlayStyle || EMPTY_STYLE;
26
+ });
27
+
28
+ return (
29
+ <View style={styles.container}>
30
+ <Animated.View
31
+ style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
32
+ pointerEvents="none"
33
+ />
34
+ <Animated.View style={[styles.content, animatedContentStyle]}>
35
+ {children}
44
36
  </Animated.View>
45
- );
46
- },
47
- );
37
+ </View>
38
+ );
39
+ });
48
40
 
49
41
  const styles = StyleSheet.create({
50
42
  container: {
@@ -1,2 +1,26 @@
1
- export * as presets from "./presets";
2
- export * as specs from "./specs";
1
+ import {
2
+ DraggableCard,
3
+ ElasticCard,
4
+ SharedAppleMusic,
5
+ SharedIGImage,
6
+ SharedXImage,
7
+ SlideFromBottom,
8
+ SlideFromTop,
9
+ ZoomIn,
10
+ } from "./presets";
11
+ import { DefaultSpec } from "./specs";
12
+
13
+ export const specs = {
14
+ DefaultSpec,
15
+ };
16
+
17
+ export const presets = {
18
+ SlideFromTop,
19
+ ZoomIn,
20
+ SlideFromBottom,
21
+ DraggableCard,
22
+ ElasticCard,
23
+ SharedIGImage,
24
+ SharedAppleMusic,
25
+ SharedXImage,
26
+ };