react-native-screen-transitions 2.0.6 → 2.2.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/LICENSE +21 -0
  2. package/README.md +100 -77
  3. package/lib/commonjs/components/{bounds-activator.js → bound-capture.js} +4 -4
  4. package/lib/commonjs/components/bound-capture.js.map +1 -0
  5. package/lib/commonjs/components/controllers/screen-lifecycle.js +18 -4
  6. package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
  7. package/lib/commonjs/components/create-transition-aware-component.js +23 -12
  8. package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
  9. package/lib/commonjs/components/integrations/masked-view.js +52 -0
  10. package/lib/commonjs/components/integrations/masked-view.js.map +1 -0
  11. package/lib/commonjs/components/root-transition-aware.js +6 -15
  12. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  13. package/lib/commonjs/configs/index.js +4 -1
  14. package/lib/commonjs/configs/index.js.map +1 -1
  15. package/lib/commonjs/configs/presets.js +378 -7
  16. package/lib/commonjs/configs/presets.js.map +1 -1
  17. package/lib/commonjs/configs/specs.js +2 -1
  18. package/lib/commonjs/configs/specs.js.map +1 -1
  19. package/lib/commonjs/hooks/animation/use-associated-style.js +7 -10
  20. package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
  21. package/lib/commonjs/hooks/animation/use-screen-animation.js +37 -37
  22. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  23. package/lib/commonjs/hooks/bounds/use-bound-registry.js +64 -0
  24. package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -0
  25. package/lib/commonjs/hooks/gestures/use-build-gestures.js +156 -152
  26. package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
  27. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js +28 -0
  28. package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  29. package/lib/commonjs/hooks/gestures/use-scroll-registry.js +146 -0
  30. package/lib/commonjs/hooks/gestures/use-scroll-registry.js.map +1 -0
  31. package/lib/commonjs/index.js +3 -0
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +7 -4
  34. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  35. package/lib/commonjs/providers/gestures.js +16 -16
  36. package/lib/commonjs/providers/gestures.js.map +1 -1
  37. package/lib/commonjs/providers/transition-styles.js +44 -0
  38. package/lib/commonjs/providers/transition-styles.js.map +1 -0
  39. package/lib/commonjs/stores/bounds.js +142 -1
  40. package/lib/commonjs/stores/bounds.js.map +1 -1
  41. package/lib/commonjs/stores/utils/reset-stores-for-screen.js +4 -2
  42. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  43. package/lib/commonjs/types/gesture.js +11 -0
  44. package/lib/commonjs/types/gesture.js.map +1 -1
  45. package/lib/commonjs/utils/animation/derivations.js +39 -0
  46. package/lib/commonjs/utils/animation/derivations.js.map +1 -0
  47. package/lib/commonjs/utils/animation/run-transition.js +6 -2
  48. package/lib/commonjs/utils/animation/run-transition.js.map +1 -1
  49. package/lib/commonjs/utils/bounds/_utils/flatten-styles.js.map +1 -0
  50. package/lib/commonjs/utils/bounds/_utils/geometry.js +179 -0
  51. package/lib/commonjs/utils/bounds/_utils/geometry.js.map +1 -0
  52. package/lib/commonjs/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  53. package/lib/commonjs/utils/bounds/_utils/get-bounds.js.map +1 -0
  54. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js +19 -0
  55. package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  56. package/lib/commonjs/utils/bounds/_utils/style-composers.js +201 -0
  57. package/lib/commonjs/utils/bounds/_utils/style-composers.js.map +1 -0
  58. package/lib/commonjs/utils/bounds/constants.js +14 -3
  59. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  60. package/lib/commonjs/utils/bounds/index.js +210 -17
  61. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  62. package/lib/commonjs/utils/gesture/apply-offset-rules.js +233 -0
  63. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -0
  64. package/lib/commonjs/utils/gesture/check-gesture-activation.js +231 -0
  65. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -0
  66. package/lib/commonjs/utils/gesture/determine-dismissal.js +98 -0
  67. package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -0
  68. package/lib/module/components/{bounds-activator.js → bound-capture.js} +2 -2
  69. package/lib/module/components/bound-capture.js.map +1 -0
  70. package/lib/module/components/controllers/screen-lifecycle.js +18 -4
  71. package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
  72. package/lib/module/components/create-transition-aware-component.js +23 -12
  73. package/lib/module/components/create-transition-aware-component.js.map +1 -1
  74. package/lib/module/components/integrations/masked-view.js +48 -0
  75. package/lib/module/components/integrations/masked-view.js.map +1 -0
  76. package/lib/module/components/root-transition-aware.js +7 -16
  77. package/lib/module/components/root-transition-aware.js.map +1 -1
  78. package/lib/module/configs/index.js +6 -3
  79. package/lib/module/configs/index.js.map +1 -1
  80. package/lib/module/configs/presets.js +374 -6
  81. package/lib/module/configs/presets.js.map +1 -1
  82. package/lib/module/configs/specs.js +2 -1
  83. package/lib/module/configs/specs.js.map +1 -1
  84. package/lib/module/hooks/animation/use-associated-style.js +6 -10
  85. package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
  86. package/lib/module/hooks/animation/use-screen-animation.js +37 -37
  87. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  88. package/lib/module/hooks/bounds/use-bound-registry.js +59 -0
  89. package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -0
  90. package/lib/module/hooks/gestures/use-build-gestures.js +156 -153
  91. package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
  92. package/lib/module/hooks/gestures/use-parent-gesture-registry.js +23 -0
  93. package/lib/module/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
  94. package/lib/module/hooks/gestures/use-scroll-registry.js +140 -0
  95. package/lib/module/hooks/gestures/use-scroll-registry.js.map +1 -0
  96. package/lib/module/index.js +2 -0
  97. package/lib/module/index.js.map +1 -1
  98. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +7 -4
  99. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  100. package/lib/module/providers/gestures.js +16 -16
  101. package/lib/module/providers/gestures.js.map +1 -1
  102. package/lib/module/providers/transition-styles.js +39 -0
  103. package/lib/module/providers/transition-styles.js.map +1 -0
  104. package/lib/module/stores/bounds.js +142 -1
  105. package/lib/module/stores/bounds.js.map +1 -1
  106. package/lib/module/stores/utils/reset-stores-for-screen.js +4 -2
  107. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  108. package/lib/module/types/gesture.js +7 -0
  109. package/lib/module/types/gesture.js.map +1 -1
  110. package/lib/module/utils/animation/derivations.js +34 -0
  111. package/lib/module/utils/animation/derivations.js.map +1 -0
  112. package/lib/module/utils/animation/run-transition.js +6 -2
  113. package/lib/module/utils/animation/run-transition.js.map +1 -1
  114. package/lib/module/utils/bounds/_utils/flatten-styles.js.map +1 -0
  115. package/lib/module/utils/bounds/_utils/geometry.js +174 -0
  116. package/lib/module/utils/bounds/_utils/geometry.js.map +1 -0
  117. package/lib/module/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
  118. package/lib/module/utils/bounds/_utils/get-bounds.js.map +1 -0
  119. package/lib/module/utils/bounds/_utils/is-bounds-equal.js +14 -0
  120. package/lib/module/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
  121. package/lib/module/utils/bounds/_utils/style-composers.js +194 -0
  122. package/lib/module/utils/bounds/_utils/style-composers.js.map +1 -0
  123. package/lib/module/utils/bounds/constants.js +14 -3
  124. package/lib/module/utils/bounds/constants.js.map +1 -1
  125. package/lib/module/utils/bounds/index.js +208 -15
  126. package/lib/module/utils/bounds/index.js.map +1 -1
  127. package/lib/module/utils/gesture/apply-offset-rules.js +228 -0
  128. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -0
  129. package/lib/module/utils/gesture/check-gesture-activation.js +226 -0
  130. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -0
  131. package/lib/module/utils/gesture/determine-dismissal.js +93 -0
  132. package/lib/module/utils/gesture/determine-dismissal.js.map +1 -0
  133. package/lib/typescript/components/bound-capture.d.ts +8 -0
  134. package/lib/typescript/components/bound-capture.d.ts.map +1 -0
  135. package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -1
  136. package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
  137. package/lib/typescript/components/integrations/masked-view.d.ts +6 -0
  138. package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -0
  139. package/lib/typescript/components/root-transition-aware.d.ts +3 -3
  140. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  141. package/lib/typescript/configs/index.d.ts +3 -0
  142. package/lib/typescript/configs/index.d.ts.map +1 -1
  143. package/lib/typescript/configs/presets.d.ts +3 -0
  144. package/lib/typescript/configs/presets.d.ts.map +1 -1
  145. package/lib/typescript/configs/specs.d.ts.map +1 -1
  146. package/lib/typescript/hooks/animation/use-associated-style.d.ts +6 -4
  147. package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
  148. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  149. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts → use-bound-registry.d.ts} +4 -4
  150. package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts.map → use-bound-registry.d.ts.map} +1 -1
  151. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +6 -5
  152. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  153. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts +6 -0
  154. package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts.map +1 -0
  155. package/lib/typescript/hooks/gestures/{use-scroll-progress.d.ts → use-scroll-registry.d.ts} +2 -2
  156. package/lib/typescript/hooks/gestures/use-scroll-registry.d.ts.map +1 -0
  157. package/lib/typescript/index.d.ts +17 -8
  158. package/lib/typescript/index.d.ts.map +1 -1
  159. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  160. package/lib/typescript/providers/gestures.d.ts +4 -2
  161. package/lib/typescript/providers/gestures.d.ts.map +1 -1
  162. package/lib/typescript/providers/transition-styles.d.ts +8 -0
  163. package/lib/typescript/providers/transition-styles.d.ts.map +1 -0
  164. package/lib/typescript/stores/bounds.d.ts +11 -0
  165. package/lib/typescript/stores/bounds.d.ts.map +1 -1
  166. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +3 -1
  167. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  168. package/lib/typescript/types/bounds.d.ts +5 -1
  169. package/lib/typescript/types/bounds.d.ts.map +1 -1
  170. package/lib/typescript/types/core.d.ts +8 -0
  171. package/lib/typescript/types/core.d.ts.map +1 -1
  172. package/lib/typescript/types/gesture.d.ts +14 -0
  173. package/lib/typescript/types/gesture.d.ts.map +1 -1
  174. package/lib/typescript/types/navigator.d.ts +5 -1
  175. package/lib/typescript/types/navigator.d.ts.map +1 -1
  176. package/lib/typescript/utils/animation/derivations.d.ts +19 -0
  177. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -0
  178. package/lib/typescript/utils/animation/run-transition.d.ts +2 -1
  179. package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -1
  180. package/lib/typescript/utils/bounds/_types/builder.d.ts +96 -14
  181. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  182. package/lib/typescript/utils/bounds/_types/geometry.d.ts +0 -1
  183. package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -1
  184. package/lib/typescript/utils/bounds/_utils/flatten-styles.d.ts.map +1 -0
  185. package/lib/typescript/utils/bounds/{geometry.d.ts → _utils/geometry.d.ts} +8 -5
  186. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -0
  187. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts +4 -0
  188. package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts.map +1 -0
  189. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts +7 -0
  190. package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts.map +1 -0
  191. package/lib/typescript/utils/bounds/{style-composers.d.ts → _utils/style-composers.d.ts} +7 -10
  192. package/lib/typescript/utils/bounds/_utils/style-composers.d.ts.map +1 -0
  193. package/lib/typescript/utils/bounds/constants.d.ts +5 -5
  194. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  195. package/lib/typescript/utils/bounds/index.d.ts +2 -4
  196. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  197. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +38 -0
  198. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -0
  199. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +38 -0
  200. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -0
  201. package/lib/typescript/utils/gesture/determine-dismissal.d.ts +25 -0
  202. package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -0
  203. package/package.json +2 -2
  204. package/src/__tests__/geometry.test.ts +15 -12
  205. package/src/components/{bounds-activator.tsx → bound-capture.tsx} +1 -1
  206. package/src/components/controllers/screen-lifecycle.tsx +13 -5
  207. package/src/components/create-transition-aware-component.tsx +34 -13
  208. package/src/components/integrations/masked-view.tsx +56 -0
  209. package/src/components/root-transition-aware.tsx +31 -39
  210. package/src/configs/index.ts +20 -8
  211. package/src/configs/presets.ts +401 -6
  212. package/src/configs/specs.ts +1 -0
  213. package/src/hooks/animation/use-associated-style.tsx +12 -11
  214. package/src/hooks/animation/use-screen-animation.tsx +48 -49
  215. package/src/hooks/bounds/{use-bound-measurer.tsx → use-bound-registry.tsx} +24 -20
  216. package/src/hooks/gestures/use-build-gestures.tsx +193 -228
  217. package/src/hooks/gestures/use-parent-gesture-registry.tsx +18 -0
  218. package/src/hooks/gestures/use-scroll-registry.tsx +145 -0
  219. package/src/index.ts +2 -0
  220. package/src/integrations/native-stack/views/NativeStackView.native.tsx +8 -5
  221. package/src/providers/gestures.tsx +19 -22
  222. package/src/providers/transition-styles.tsx +52 -0
  223. package/src/stores/bounds.ts +156 -0
  224. package/src/stores/utils/reset-stores-for-screen.ts +7 -2
  225. package/src/types/bounds.ts +8 -1
  226. package/src/types/core.ts +9 -0
  227. package/src/types/gesture.ts +19 -0
  228. package/src/types/navigator.ts +5 -1
  229. package/src/utils/animation/derivations.ts +38 -0
  230. package/src/utils/animation/run-transition.ts +4 -1
  231. package/src/utils/bounds/_types/builder.ts +127 -11
  232. package/src/utils/bounds/_types/geometry.ts +0 -1
  233. package/src/utils/bounds/_utils/geometry.ts +166 -0
  234. package/src/utils/bounds/_utils/get-bounds.ts +54 -0
  235. package/src/utils/bounds/_utils/is-bounds-equal.ts +24 -0
  236. package/src/utils/bounds/_utils/style-composers.ts +216 -0
  237. package/src/utils/bounds/constants.ts +37 -22
  238. package/src/utils/bounds/index.ts +269 -19
  239. package/src/utils/gesture/apply-offset-rules.ts +314 -0
  240. package/src/utils/gesture/check-gesture-activation.ts +310 -0
  241. package/src/utils/gesture/determine-dismissal.ts +131 -0
  242. package/lib/commonjs/components/bounds-activator.js.map +0 -1
  243. package/lib/commonjs/hooks/bounds/use-bound-measurer.js +0 -52
  244. package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +0 -1
  245. package/lib/commonjs/hooks/gestures/use-scroll-progress.js +0 -57
  246. package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +0 -1
  247. package/lib/commonjs/utils/bounds/build-bound-styles.js +0 -145
  248. package/lib/commonjs/utils/bounds/build-bound-styles.js.map +0 -1
  249. package/lib/commonjs/utils/bounds/flatten-styles.js.map +0 -1
  250. package/lib/commonjs/utils/bounds/geometry.js +0 -94
  251. package/lib/commonjs/utils/bounds/geometry.js.map +0 -1
  252. package/lib/commonjs/utils/bounds/get-bounds.js.map +0 -1
  253. package/lib/commonjs/utils/bounds/style-composers.js +0 -199
  254. package/lib/commonjs/utils/bounds/style-composers.js.map +0 -1
  255. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +0 -81
  256. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  257. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +0 -21
  258. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +0 -1
  259. package/lib/module/components/bounds-activator.js.map +0 -1
  260. package/lib/module/hooks/bounds/use-bound-measurer.js +0 -47
  261. package/lib/module/hooks/bounds/use-bound-measurer.js.map +0 -1
  262. package/lib/module/hooks/gestures/use-scroll-progress.js +0 -52
  263. package/lib/module/hooks/gestures/use-scroll-progress.js.map +0 -1
  264. package/lib/module/utils/bounds/build-bound-styles.js +0 -141
  265. package/lib/module/utils/bounds/build-bound-styles.js.map +0 -1
  266. package/lib/module/utils/bounds/flatten-styles.js.map +0 -1
  267. package/lib/module/utils/bounds/geometry.js +0 -89
  268. package/lib/module/utils/bounds/geometry.js.map +0 -1
  269. package/lib/module/utils/bounds/get-bounds.js.map +0 -1
  270. package/lib/module/utils/bounds/style-composers.js +0 -191
  271. package/lib/module/utils/bounds/style-composers.js.map +0 -1
  272. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +0 -76
  273. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
  274. package/lib/module/utils/gesture/normalize-gesture-translation.js +0 -16
  275. package/lib/module/utils/gesture/normalize-gesture-translation.js.map +0 -1
  276. package/lib/typescript/components/bounds-activator.d.ts +0 -8
  277. package/lib/typescript/components/bounds-activator.d.ts.map +0 -1
  278. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +0 -1
  279. package/lib/typescript/utils/bounds/build-bound-styles.d.ts +0 -4
  280. package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +0 -1
  281. package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +0 -1
  282. package/lib/typescript/utils/bounds/geometry.d.ts.map +0 -1
  283. package/lib/typescript/utils/bounds/get-bounds.d.ts +0 -4
  284. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +0 -1
  285. package/lib/typescript/utils/bounds/style-composers.d.ts.map +0 -1
  286. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +0 -17
  287. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +0 -1
  288. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +0 -6
  289. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +0 -1
  290. package/src/hooks/gestures/use-scroll-progress.tsx +0 -60
  291. package/src/utils/bounds/build-bound-styles.ts +0 -184
  292. package/src/utils/bounds/geometry.ts +0 -113
  293. package/src/utils/bounds/get-bounds.ts +0 -56
  294. package/src/utils/bounds/style-composers.ts +0 -172
  295. package/src/utils/gesture/apply-gesture-activation-criteria.ts +0 -109
  296. package/src/utils/gesture/normalize-gesture-translation.ts +0 -20
  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
@@ -1,24 +1,27 @@
1
1
  import type { ScaledSize } from "react-native";
2
2
  import type { MeasuredDimensions } from "react-native-reanimated";
3
- import type { BoundsBuilderOptions } from "./_types/builder";
4
- import type { ContentTransformGeometry, RelativeGeometry } from "./_types/geometry";
3
+ import type { BoundsAnchor, BoundsScaleMode } from "../_types/builder";
4
+ import type { ContentTransformGeometry, RelativeGeometry } from "../_types/geometry";
5
5
  /**
6
6
  * Relative geometry between start/end bounds.
7
7
  */
8
- export declare function computeRelativeGeometry({ start, end, entering, }: {
8
+ export declare function computeRelativeGeometry({ start, end, entering, anchor, scaleMode, }: {
9
9
  start: MeasuredDimensions;
10
10
  end: MeasuredDimensions;
11
11
  entering: boolean;
12
+ anchor?: BoundsAnchor;
13
+ scaleMode?: BoundsScaleMode;
12
14
  }): RelativeGeometry;
13
15
  /**
14
16
  * Computes the transform to apply to the entire destination screen so that
15
17
  * its bound (end) matches the source bound (start) at progress start.
16
18
  */
17
- export declare function computeContentTransformGeometry({ start, end, entering, dimensions, contentScaleMode, }: {
19
+ export declare function computeContentTransformGeometry({ start, end, entering, dimensions, anchor, scaleMode, }: {
18
20
  start: MeasuredDimensions;
19
21
  end: MeasuredDimensions;
20
22
  entering: boolean;
21
23
  dimensions: ScaledSize;
22
- contentScaleMode: BoundsBuilderOptions["contentScaleMode"];
24
+ anchor?: BoundsAnchor;
25
+ scaleMode?: BoundsScaleMode;
23
26
  }): ContentTransformGeometry;
24
27
  //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/geometry.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,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAsC5B;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EACvC,KAAK,EACL,GAAG,EACH,QAAQ,EACR,MAAiB,EACjB,SAAmB,GACnB,EAAE;IACF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B,GAAG,gBAAgB,CAoCnB;AACD;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,EAC/C,KAAK,EACL,GAAG,EACH,QAAQ,EACR,UAAU,EACV,MAAiB,EACjB,SAAqB,GACrB,EAAE;IACF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B,GAAG,wBAAwB,CAmD3B"}
@@ -0,0 +1,4 @@
1
+ import type { BoundEntry } from "../../../types/bounds";
2
+ import type { GetBoundsParams } from "../_types/get-bounds";
3
+ export declare const getBounds: (props: GetBoundsParams) => BoundEntry;
4
+ //# sourceMappingURL=get-bounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../../src/utils/bounds/_utils/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAc5D,eAAO,MAAM,SAAS,GAAI,OAAO,eAAe,KAAG,UAqClD,CAAC"}
@@ -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.6",
3
+ "version": "2.2.0",
4
4
  "description": "Easy screen transitions for React Native and Expo",
5
5
  "author": "Ed",
6
6
  "license": "MIT",
@@ -65,5 +65,5 @@
65
65
  ]
66
66
  ]
67
67
  },
68
- "gitHead": "888d4df9936ec0e3b8221bea7cd81115e6301693"
68
+ "gitHead": "ea83a2b1bc369610cde35850de314c43122ba60c"
69
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 (
@@ -54,8 +53,15 @@ export function createTransitionAwareComponent<P extends object>(
54
53
  React.ComponentRef<typeof AnimatedComponent>,
55
54
  TransitionAwareProps<P>
56
55
  >((props, ref) => {
57
- const { children, style, sharedBoundTag, styleId, onPress, ...rest } =
58
- props as Any;
56
+ const {
57
+ children,
58
+ style,
59
+ sharedBoundTag,
60
+ styleId,
61
+ onPress,
62
+ measureOnLayout,
63
+ ...rest
64
+ } = props as Any;
59
65
 
60
66
  const animatedRef = useAnimatedRef<View>();
61
67
  const { current } = useKeys();
@@ -64,7 +70,7 @@ export function createTransitionAwareComponent<P extends object>(
64
70
  id: sharedBoundTag || styleId,
65
71
  });
66
72
 
67
- const { measureAndSet, measureOnLayout } = useBoundMeasurer({
73
+ const { measureBounds, handleLayout } = useBoundsRegistry({
68
74
  sharedBoundTag,
69
75
  animatedRef,
70
76
  current,
@@ -72,21 +78,36 @@ export function createTransitionAwareComponent<P extends object>(
72
78
  });
73
79
 
74
80
  if (isScrollable) {
75
- return <ScrollableInner {...(props as Any)} ref={ref} />;
81
+ return (
82
+ <ScrollableInner
83
+ {...(props as Any)}
84
+ ref={ref}
85
+ measureBounds={measureBounds}
86
+ handleLayout={handleLayout}
87
+ />
88
+ );
76
89
  }
77
90
 
91
+ const onLayoutHandler = runOnUI(() => {
92
+ "worklet";
93
+ handleLayout();
94
+ if (measureOnLayout && sharedBoundTag) {
95
+ measureBounds();
96
+ }
97
+ });
98
+
78
99
  return (
79
- <BoundActivator sharedBoundTag={sharedBoundTag} measure={measureAndSet}>
100
+ <BoundCapture sharedBoundTag={sharedBoundTag} measure={measureBounds}>
80
101
  <AnimatedComponent
81
102
  {...(rest as Any)}
82
103
  ref={animatedRef}
83
104
  style={[style, associatedStyles]}
84
105
  onPress={onPress}
85
- onLayout={runOnUI(measureOnLayout)}
106
+ onLayout={onLayoutHandler}
86
107
  >
87
108
  {children}
88
109
  </AnimatedComponent>
89
- </BoundActivator>
110
+ </BoundCapture>
90
111
  );
91
112
  });
92
113
 
@@ -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
+ });