react-native-screen-transitions 1.1.0 → 2.0.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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -269
  3. package/lib/commonjs/__tests__ /geometry.test.js +178 -0
  4. package/lib/commonjs/__tests__ /geometry.test.js.map +1 -0
  5. package/lib/commonjs/components/bounds-activator.js +33 -0
  6. package/lib/commonjs/components/bounds-activator.js.map +1 -0
  7. package/lib/commonjs/components/controllers/screen-lifecycle.js +66 -0
  8. package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -0
  9. package/lib/commonjs/components/create-transition-aware-component.js +96 -0
  10. package/lib/commonjs/components/create-transition-aware-component.js.map +1 -0
  11. package/lib/commonjs/components/root-transition-aware.js +56 -0
  12. package/lib/commonjs/components/root-transition-aware.js.map +1 -0
  13. package/lib/commonjs/configs/index.js +12 -0
  14. package/lib/commonjs/configs/index.js.map +1 -0
  15. package/lib/commonjs/configs/presets.js +206 -0
  16. package/lib/commonjs/configs/presets.js.map +1 -0
  17. package/lib/commonjs/configs/specs.js +14 -0
  18. package/lib/commonjs/configs/specs.js.map +1 -0
  19. package/lib/commonjs/hooks/animation/use-associated-style.js +36 -0
  20. package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -0
  21. package/lib/commonjs/hooks/animation/use-screen-animation.js +120 -0
  22. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -0
  23. package/lib/commonjs/hooks/bounds/use-bound-measurer.js +52 -0
  24. package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +1 -0
  25. package/lib/commonjs/hooks/gestures/use-build-gestures.js +239 -0
  26. package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -0
  27. package/lib/commonjs/hooks/gestures/use-scroll-progress.js +57 -0
  28. package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +1 -0
  29. package/lib/commonjs/hooks/use-stable-callback.js +17 -0
  30. package/lib/commonjs/hooks/use-stable-callback.js.map +1 -0
  31. package/lib/commonjs/index.js +37 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js +68 -0
  34. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
  35. package/lib/commonjs/integrations/native-stack/utils/debounce.js +16 -0
  36. package/lib/commonjs/integrations/native-stack/utils/debounce.js.map +1 -0
  37. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js +17 -0
  38. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
  39. package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js +18 -0
  40. package/lib/commonjs/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
  41. package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js +22 -0
  42. package/lib/commonjs/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
  43. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js +25 -0
  44. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
  45. package/lib/commonjs/integrations/native-stack/views/FontProcessor.js +10 -0
  46. package/lib/commonjs/integrations/native-stack/views/FontProcessor.js.map +1 -0
  47. package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js +18 -0
  48. package/lib/commonjs/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
  49. package/lib/commonjs/integrations/native-stack/views/FooterComponent.js +17 -0
  50. package/lib/commonjs/integrations/native-stack/views/FooterComponent.js.map +1 -0
  51. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js +138 -0
  52. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -0
  53. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +497 -0
  54. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
  55. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js +203 -0
  56. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
  57. package/lib/commonjs/package.json +1 -0
  58. package/lib/commonjs/providers/gestures.js +64 -0
  59. package/lib/commonjs/providers/gestures.js.map +1 -0
  60. package/lib/commonjs/providers/keys.js +35 -0
  61. package/lib/commonjs/providers/keys.js.map +1 -0
  62. package/lib/commonjs/stores/animations.js +39 -0
  63. package/lib/commonjs/stores/animations.js.map +1 -0
  64. package/lib/commonjs/stores/bounds.js +64 -0
  65. package/lib/commonjs/stores/bounds.js.map +1 -0
  66. package/lib/commonjs/stores/gestures.js +38 -0
  67. package/lib/commonjs/stores/gestures.js.map +1 -0
  68. package/lib/commonjs/stores/navigator-dismiss-state.js +23 -0
  69. package/lib/commonjs/stores/navigator-dismiss-state.js.map +1 -0
  70. package/lib/commonjs/stores/utils/reset-stores-for-screen.js +20 -0
  71. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -0
  72. package/lib/commonjs/types/animation.js +6 -0
  73. package/lib/commonjs/types/animation.js.map +1 -0
  74. package/lib/commonjs/types/bounds.js +6 -0
  75. package/lib/commonjs/types/bounds.js.map +1 -0
  76. package/lib/commonjs/types/core.js +6 -0
  77. package/lib/commonjs/types/core.js.map +1 -0
  78. package/lib/commonjs/types/gesture.js +2 -0
  79. package/lib/commonjs/types/gesture.js.map +1 -0
  80. package/lib/commonjs/types/navigator.js +6 -0
  81. package/lib/commonjs/types/navigator.js.map +1 -0
  82. package/lib/commonjs/types/utils.js +2 -0
  83. package/lib/commonjs/types/utils.js.map +1 -0
  84. package/lib/commonjs/utils/animation/animate.js +18 -0
  85. package/lib/commonjs/utils/animation/animate.js.map +1 -0
  86. package/lib/commonjs/utils/animation/run-transition.js +48 -0
  87. package/lib/commonjs/utils/animation/run-transition.js.map +1 -0
  88. package/lib/commonjs/utils/bounds/_types/builder.js +6 -0
  89. package/lib/commonjs/utils/bounds/_types/builder.js.map +1 -0
  90. package/lib/commonjs/utils/bounds/_types/geometry.js +2 -0
  91. package/lib/commonjs/utils/bounds/_types/geometry.js.map +1 -0
  92. package/lib/commonjs/utils/bounds/_types/get-bounds.js +6 -0
  93. package/lib/commonjs/utils/bounds/_types/get-bounds.js.map +1 -0
  94. package/lib/commonjs/utils/bounds/build-bound-styles.js +145 -0
  95. package/lib/commonjs/utils/bounds/build-bound-styles.js.map +1 -0
  96. package/lib/commonjs/utils/bounds/constants.js +31 -0
  97. package/lib/commonjs/utils/bounds/constants.js.map +1 -0
  98. package/lib/commonjs/utils/bounds/flatten-styles.js +27 -0
  99. package/lib/commonjs/utils/bounds/flatten-styles.js.map +1 -0
  100. package/lib/commonjs/utils/bounds/geometry.js +94 -0
  101. package/lib/commonjs/utils/bounds/geometry.js.map +1 -0
  102. package/lib/commonjs/utils/bounds/get-bounds.js +51 -0
  103. package/lib/commonjs/utils/bounds/get-bounds.js.map +1 -0
  104. package/lib/commonjs/utils/bounds/index.js +38 -0
  105. package/lib/commonjs/utils/bounds/index.js.map +1 -0
  106. package/lib/commonjs/utils/bounds/style-composers.js +199 -0
  107. package/lib/commonjs/utils/bounds/style-composers.js.map +1 -0
  108. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +81 -0
  109. package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
  110. package/lib/commonjs/utils/gesture/map-gesture-to-progress.js +17 -0
  111. package/lib/commonjs/utils/gesture/map-gesture-to-progress.js.map +1 -0
  112. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +21 -0
  113. package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +1 -0
  114. package/lib/commonjs/utils/index.js +17 -0
  115. package/lib/commonjs/utils/index.js.map +1 -0
  116. package/lib/module/__tests__ /geometry.test.js +178 -0
  117. package/lib/module/__tests__ /geometry.test.js.map +1 -0
  118. package/lib/module/components/bounds-activator.js +28 -0
  119. package/lib/module/components/bounds-activator.js.map +1 -0
  120. package/lib/module/components/controllers/screen-lifecycle.js +60 -0
  121. package/lib/module/components/controllers/screen-lifecycle.js.map +1 -0
  122. package/lib/module/components/create-transition-aware-component.js +91 -0
  123. package/lib/module/components/create-transition-aware-component.js.map +1 -0
  124. package/lib/module/components/root-transition-aware.js +51 -0
  125. package/lib/module/components/root-transition-aware.js.map +1 -0
  126. package/lib/module/configs/index.js +5 -0
  127. package/lib/module/configs/index.js.map +1 -0
  128. package/lib/module/configs/presets.js +197 -0
  129. package/lib/module/configs/presets.js.map +1 -0
  130. package/lib/module/configs/specs.js +10 -0
  131. package/lib/module/configs/specs.js.map +1 -0
  132. package/lib/module/hooks/animation/use-associated-style.js +32 -0
  133. package/lib/module/hooks/animation/use-associated-style.js.map +1 -0
  134. package/lib/module/hooks/animation/use-screen-animation.js +115 -0
  135. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -0
  136. package/lib/module/hooks/bounds/use-bound-measurer.js +47 -0
  137. package/lib/module/hooks/bounds/use-bound-measurer.js.map +1 -0
  138. package/lib/module/hooks/gestures/use-build-gestures.js +234 -0
  139. package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -0
  140. package/lib/module/hooks/gestures/use-scroll-progress.js +52 -0
  141. package/lib/module/hooks/gestures/use-scroll-progress.js.map +1 -0
  142. package/lib/module/hooks/use-stable-callback.js +13 -0
  143. package/lib/module/hooks/use-stable-callback.js.map +1 -0
  144. package/lib/module/index.js +21 -0
  145. package/lib/module/index.js.map +1 -0
  146. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js +63 -0
  147. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -0
  148. package/lib/module/integrations/native-stack/utils/debounce.js +12 -0
  149. package/lib/module/integrations/native-stack/utils/debounce.js.map +1 -0
  150. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js +12 -0
  151. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -0
  152. package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js +12 -0
  153. package/lib/module/integrations/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -0
  154. package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js +17 -0
  155. package/lib/module/integrations/native-stack/utils/useDismissedRouteError.js.map +1 -0
  156. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js +20 -0
  157. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -0
  158. package/lib/module/integrations/native-stack/views/FontProcessor.js +6 -0
  159. package/lib/module/integrations/native-stack/views/FontProcessor.js.map +1 -0
  160. package/lib/module/integrations/native-stack/views/FontProcessor.native.js +12 -0
  161. package/lib/module/integrations/native-stack/views/FontProcessor.native.js.map +1 -0
  162. package/lib/module/integrations/native-stack/views/FooterComponent.js +13 -0
  163. package/lib/module/integrations/native-stack/views/FooterComponent.js.map +1 -0
  164. package/lib/module/integrations/native-stack/views/NativeStackView.js +133 -0
  165. package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -0
  166. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +492 -0
  167. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -0
  168. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js +199 -0
  169. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -0
  170. package/lib/module/providers/gestures.js +58 -0
  171. package/lib/module/providers/gestures.js.map +1 -0
  172. package/lib/module/providers/keys.js +29 -0
  173. package/lib/module/providers/keys.js.map +1 -0
  174. package/lib/module/stores/animations.js +33 -0
  175. package/lib/module/stores/animations.js.map +1 -0
  176. package/lib/module/stores/bounds.js +60 -0
  177. package/lib/module/stores/bounds.js.map +1 -0
  178. package/lib/module/stores/gestures.js +34 -0
  179. package/lib/module/stores/gestures.js.map +1 -0
  180. package/lib/module/stores/navigator-dismiss-state.js +19 -0
  181. package/lib/module/stores/navigator-dismiss-state.js.map +1 -0
  182. package/lib/module/stores/utils/reset-stores-for-screen.js +16 -0
  183. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -0
  184. package/lib/module/types/animation.js +4 -0
  185. package/lib/module/types/animation.js.map +1 -0
  186. package/lib/module/types/bounds.js +4 -0
  187. package/lib/module/types/bounds.js.map +1 -0
  188. package/lib/module/types/core.js +4 -0
  189. package/lib/module/types/core.js.map +1 -0
  190. package/lib/module/types/gesture.js +2 -0
  191. package/lib/module/types/gesture.js.map +1 -0
  192. package/lib/module/types/navigator.js +4 -0
  193. package/lib/module/types/navigator.js.map +1 -0
  194. package/lib/module/types/utils.js +2 -0
  195. package/lib/module/types/utils.js.map +1 -0
  196. package/lib/module/utils/animation/animate.js +13 -0
  197. package/lib/module/utils/animation/animate.js.map +1 -0
  198. package/lib/module/utils/animation/run-transition.js +43 -0
  199. package/lib/module/utils/animation/run-transition.js.map +1 -0
  200. package/lib/module/utils/bounds/_types/builder.js +4 -0
  201. package/lib/module/utils/bounds/_types/builder.js.map +1 -0
  202. package/lib/module/utils/bounds/_types/geometry.js +2 -0
  203. package/lib/module/utils/bounds/_types/geometry.js.map +1 -0
  204. package/lib/module/utils/bounds/_types/get-bounds.js +4 -0
  205. package/lib/module/utils/bounds/_types/get-bounds.js.map +1 -0
  206. package/lib/module/utils/bounds/build-bound-styles.js +141 -0
  207. package/lib/module/utils/bounds/build-bound-styles.js.map +1 -0
  208. package/lib/module/utils/bounds/constants.js +26 -0
  209. package/lib/module/utils/bounds/constants.js.map +1 -0
  210. package/lib/module/utils/bounds/flatten-styles.js +23 -0
  211. package/lib/module/utils/bounds/flatten-styles.js.map +1 -0
  212. package/lib/module/utils/bounds/geometry.js +89 -0
  213. package/lib/module/utils/bounds/geometry.js.map +1 -0
  214. package/lib/module/utils/bounds/get-bounds.js +46 -0
  215. package/lib/module/utils/bounds/get-bounds.js.map +1 -0
  216. package/lib/module/utils/bounds/index.js +33 -0
  217. package/lib/module/utils/bounds/index.js.map +1 -0
  218. package/lib/module/utils/bounds/style-composers.js +191 -0
  219. package/lib/module/utils/bounds/style-composers.js.map +1 -0
  220. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +76 -0
  221. package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +1 -0
  222. package/lib/module/utils/gesture/map-gesture-to-progress.js +12 -0
  223. package/lib/module/utils/gesture/map-gesture-to-progress.js.map +1 -0
  224. package/lib/module/utils/gesture/normalize-gesture-translation.js +16 -0
  225. package/lib/module/utils/gesture/normalize-gesture-translation.js.map +1 -0
  226. package/lib/module/utils/index.js +4 -0
  227. package/lib/module/utils/index.js.map +1 -0
  228. package/lib/typescript/components/bounds-activator.d.ts +8 -0
  229. package/lib/typescript/components/bounds-activator.d.ts.map +1 -0
  230. package/lib/typescript/components/controllers/screen-lifecycle.d.ts +6 -0
  231. package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -0
  232. package/lib/typescript/components/create-transition-aware-component.d.ts +9 -0
  233. package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -0
  234. package/lib/typescript/components/root-transition-aware.d.ts +6 -0
  235. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -0
  236. package/lib/typescript/configs/index.d.ts +3 -0
  237. package/lib/typescript/configs/index.d.ts.map +1 -0
  238. package/lib/typescript/configs/presets.d.ts +9 -0
  239. package/lib/typescript/configs/presets.d.ts.map +1 -0
  240. package/lib/typescript/configs/specs.d.ts +3 -0
  241. package/lib/typescript/configs/specs.d.ts.map +1 -0
  242. package/lib/typescript/hooks/animation/use-associated-style.d.ts +11 -0
  243. package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -0
  244. package/lib/typescript/hooks/animation/use-screen-animation.d.ts +7 -0
  245. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -0
  246. package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts +18 -0
  247. package/lib/typescript/hooks/bounds/use-bound-measurer.d.ts.map +1 -0
  248. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +11 -0
  249. package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -0
  250. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts +14 -0
  251. package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +1 -0
  252. package/lib/typescript/hooks/use-stable-callback.d.ts +2 -0
  253. package/lib/typescript/hooks/use-stable-callback.d.ts.map +1 -0
  254. package/lib/typescript/index.d.ts +1275 -0
  255. package/lib/typescript/index.d.ts.map +1 -0
  256. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +16 -0
  257. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -0
  258. package/lib/typescript/integrations/native-stack/utils/debounce.d.ts +2 -0
  259. package/lib/typescript/integrations/native-stack/utils/debounce.d.ts.map +1 -0
  260. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +4 -0
  261. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -0
  262. package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts +5 -0
  263. package/lib/typescript/integrations/native-stack/utils/useAnimatedHeaderHeight.d.ts.map +1 -0
  264. package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts +6 -0
  265. package/lib/typescript/integrations/native-stack/utils/useDismissedRouteError.d.ts.map +1 -0
  266. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +3 -0
  267. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -0
  268. package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts +2 -0
  269. package/lib/typescript/integrations/native-stack/views/FontProcessor.d.ts.map +1 -0
  270. package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts +2 -0
  271. package/lib/typescript/integrations/native-stack/views/FontProcessor.native.d.ts.map +1 -0
  272. package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts +7 -0
  273. package/lib/typescript/integrations/native-stack/views/FooterComponent.d.ts.map +1 -0
  274. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +11 -0
  275. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -0
  276. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +11 -0
  277. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -0
  278. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +44 -0
  279. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -0
  280. package/lib/typescript/providers/gestures.d.ts +22 -0
  281. package/lib/typescript/providers/gestures.d.ts.map +1 -0
  282. package/lib/typescript/providers/keys.d.ts +16 -0
  283. package/lib/typescript/providers/keys.d.ts.map +1 -0
  284. package/lib/typescript/stores/animations.d.ts +17 -0
  285. package/lib/typescript/stores/animations.d.ts.map +1 -0
  286. package/lib/typescript/stores/bounds.d.ts +21 -0
  287. package/lib/typescript/stores/bounds.d.ts.map +1 -0
  288. package/lib/typescript/stores/gestures.d.ts +21 -0
  289. package/lib/typescript/stores/gestures.d.ts.map +1 -0
  290. package/lib/typescript/stores/navigator-dismiss-state.d.ts +7 -0
  291. package/lib/typescript/stores/navigator-dismiss-state.d.ts.map +1 -0
  292. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +6 -0
  293. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -0
  294. package/lib/typescript/types/animation.d.ts +65 -0
  295. package/lib/typescript/types/animation.d.ts.map +1 -0
  296. package/lib/typescript/types/bounds.d.ts +73 -0
  297. package/lib/typescript/types/bounds.d.ts.map +1 -0
  298. package/lib/typescript/types/core.d.ts +47 -0
  299. package/lib/typescript/types/core.d.ts.map +1 -0
  300. package/lib/typescript/types/gesture.d.ts +28 -0
  301. package/lib/typescript/types/gesture.d.ts.map +1 -0
  302. package/lib/typescript/types/navigator.d.ts +683 -0
  303. package/lib/typescript/types/navigator.d.ts.map +1 -0
  304. package/lib/typescript/types/utils.d.ts +5 -0
  305. package/lib/typescript/types/utils.d.ts.map +1 -0
  306. package/lib/typescript/utils/animation/animate.d.ts +4 -0
  307. package/lib/typescript/utils/animation/animate.d.ts.map +1 -0
  308. package/lib/typescript/utils/animation/run-transition.d.ts +11 -0
  309. package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -0
  310. package/lib/typescript/utils/bounds/_types/builder.d.ts +36 -0
  311. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -0
  312. package/lib/typescript/utils/bounds/_types/geometry.d.ts +16 -0
  313. package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -0
  314. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +10 -0
  315. package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -0
  316. package/lib/typescript/utils/bounds/build-bound-styles.d.ts +4 -0
  317. package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +1 -0
  318. package/lib/typescript/utils/bounds/constants.d.ts +7 -0
  319. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -0
  320. package/lib/typescript/utils/bounds/flatten-styles.d.ts +2 -0
  321. package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +1 -0
  322. package/lib/typescript/utils/bounds/geometry.d.ts +24 -0
  323. package/lib/typescript/utils/bounds/geometry.d.ts.map +1 -0
  324. package/lib/typescript/utils/bounds/get-bounds.d.ts +4 -0
  325. package/lib/typescript/utils/bounds/get-bounds.d.ts.map +1 -0
  326. package/lib/typescript/utils/bounds/index.d.ts +15 -0
  327. package/lib/typescript/utils/bounds/index.d.ts.map +1 -0
  328. package/lib/typescript/utils/bounds/style-composers.d.ts +40 -0
  329. package/lib/typescript/utils/bounds/style-composers.d.ts.map +1 -0
  330. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +17 -0
  331. package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +1 -0
  332. package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts +5 -0
  333. package/lib/typescript/utils/gesture/map-gesture-to-progress.d.ts.map +1 -0
  334. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +6 -0
  335. package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +1 -0
  336. package/lib/typescript/utils/index.d.ts +2 -0
  337. package/lib/typescript/utils/index.d.ts.map +1 -0
  338. package/package.json +33 -16
  339. package/dist/index.d.mts +0 -1473
  340. package/dist/index.d.ts +0 -1473
  341. package/dist/index.js +0 -1169
  342. package/dist/index.js.map +0 -1
  343. package/dist/index.mjs +0 -1159
  344. package/dist/index.mjs.map +0 -1
package/README.md CHANGED
@@ -1,24 +1,12 @@
1
1
  # react-native-screen-transitions
2
2
 
3
-
4
3
  | iOS | Android |
5
- |---------|---------|
6
- |<video src="https://github.com/user-attachments/assets/8a7b8006-f165-4a78-b0f9-c94cddd948b9" width="300" controls></video>|<video src="https://github.com/user-attachments/assets/ddebdaa8-a929-43ab-b857-08a00e142343" width="300" controls></video>|
4
+ |---|---|
5
+ | <video src="https://github.com/user-attachments/assets/81f39391-80c0-4ce4-b6ff-76de85d2cf03" width="300" height="600" controls></video> | <video src="https://github.com/user-attachments/assets/c2b4c6ca-2b0c-4cf4-a164-f7e68cee0c32" width="300" controls></video> |
7
6
 
8
7
 
9
8
  **WIP**: This package is a work-in-progress. It provides customizable screen transition animations for React Native apps, primarily designed for use with `expo-router` and `react-navigation`. It supports gestures, predefined presets, and custom animations, making it easy to add polished transitions to your navigation flows.
10
9
 
11
- This library is inspired by the transition system in `@react-navigation/stack` (not the native stack). If you're familiar with how transitions work there (e.g., using interpolators), you'll find this similar.
12
-
13
-
14
-
15
-
16
- ## Features
17
- - Predefined animation presets (e.g., SlideFromTop, ZoomIn, DraggableCard).
18
- - Gesture support for interactive transitions (e.g., drag-to-dismiss).
19
- - Animations using Reanimated.
20
- - Easy integration with expo-router and react-navigation.
21
-
22
10
  ## Compatibility
23
11
  - **Platforms**: Currently tested on iOS and Android. Not tested or intended for web—web support is not a priority and may not work due to gesture and animation differences.
24
12
  - **Dependencies**: Requires React Native, Reanimated, Gesture Handler, and either expo-router or react-navigation.
@@ -34,236 +22,170 @@ bun add react-native-screen-transitions
34
22
 
35
23
  ## Peer Dependencies
36
24
  ```bash
37
- npm install react-native-reanimated react-native-gesture-handler
25
+ npm install react-native-reanimated react-native-gesture-handler \
26
+ @react-navigation/native @react-navigation/native-stack \
27
+ @react-navigation/elements react-native-screens \
28
+ react-native-safe-area-context
38
29
  ```
39
30
 
40
- ## Your First Screen Transition
41
-
42
- Getting started with screen transitions is simple. Here's how to add your first animated transition:
31
+ ## Setup
43
32
 
44
- ### 1. Wrap your app with GestureHandlerRootView
33
+ ### 1. Expo Router
45
34
 
46
35
  ```tsx
47
- // app/_layout.tsx (expo-router) or App.tsx (react-navigation)
48
- import { GestureHandlerRootView } from "react-native-gesture-handler";
49
- import Transition from "react-native-screen-transitions";
50
-
51
- export default function RootLayout() {
52
- return (
53
- <GestureHandlerRootView style={{ flex: 1 }}>
54
- {/* Your navigation setup */}
55
- </GestureHandlerRootView>
56
- );
57
- }
36
+ import type {
37
+ ParamListBase,
38
+ StackNavigationState,
39
+ } from "@react-navigation/native";
40
+ import { withLayoutContext } from "expo-router";
41
+ import {
42
+ createNativeStackNavigator,
43
+ type NativeStackNavigationEventMap,
44
+ type NativeStackNavigationOptions,
45
+ } from "react-native-screen-transitions";
46
+
47
+ const { Navigator } = createNativeStackNavigator();
48
+
49
+ export const Stack = withLayoutContext<
50
+ NativeStackNavigationOptions,
51
+ typeof Navigator,
52
+ StackNavigationState<ParamListBase>,
53
+ NativeStackNavigationEventMap
54
+ >(Navigator);
58
55
  ```
59
56
 
60
- ### 2. Add transition configuration to your screens
57
+ That’s it you’re ready to go.
61
58
 
62
- ```tsx
63
- import { Stack } from "expo-router";
64
- import Transition from "react-native-screen-transitions";
59
+ ### 2. React Navigation (bare)
65
60
 
66
- export default function RootLayout() {
67
- return (
68
- <GestureHandlerRootView>
69
- <Stack>
70
- <Stack.Screen
71
- name="a"
72
- options={{ headerShown: false }}
73
- {...Transition.createScreenConfig()}
74
- />
75
- <Stack.Screen
76
- name="b"
77
- {...Transition.createScreenConfig({
78
- ...Transition.presets.SlideFromTop(),
79
- })}
80
- />
81
- </Stack>
82
- </GestureHandlerRootView>
83
- );
84
- }
85
- ```
61
+ If you’re using **React Navigation** directly (not Expo Router), the navigator is already configured.
62
+ No extra setup is required—just import and use as usual:
86
63
 
87
- > ⚠️ **Important**: The first screen (like "a" in the example) must include `{...Transition.createScreenConfig()}` for it to be properly controlled by incoming screens.
64
+ ```tsx
65
+ import { createNativeStackNavigator } from 'react-native-screen-transitions';
88
66
 
89
- ### 3. Use transition-aware components in your screens
67
+ const Stack = createNativeStackNavigator();
90
68
 
91
- ```tsx
92
- // a.tsx
93
- import Transition from "react-native-screen-transitions";
69
+ // Use Stack.Navigator and Stack.Screen as normal
70
+ ```
94
71
 
95
- export default function A() {
96
- return (
97
- <Transition.View> {/* By default has flex: 1 */}
98
- {/* Your content */}
99
- </Transition.View>
100
- );
101
- }
72
+ ### Extended native-stack options
102
73
 
103
- // b.tsx
104
- import Transition from "react-native-screen-transitions";
74
+ This package ships an **extended native stack** built on top of React Navigation’s native stack.
75
+ All the usual native-stack options are available, plus the following extras:
105
76
 
106
- export default function B() {
107
- return (
108
- <Transition.View>
109
- {/* Your content */}
110
- </Transition.View>
111
- );
112
- }
113
- ```
77
+ | Option | Type | Description |
78
+ |---|---|---|
79
+ | `enableTransitions` | `boolean` | Switches the screen to a transparent modal and disables the header so custom transitions can take over. |
80
+ | `screenStyleInterpolator` | `ScreenStyleInterpolator` | Function that returns animated styles based on transition progress. |
81
+ | `transitionSpec` | `TransitionSpec` | Reanimated timing/spring config for open/close animations. |
82
+ | `gestureEnabled` | `boolean` | Whether swipe-to-dismiss is allowed. |
83
+ | `gestureDirection` | `GestureDirection \| GestureDirection[]` | Allowed swipe directions (`vertical`, `horizontal`, etc.). |
84
+ | `gestureVelocityImpact` | `number` | How much the gesture’s velocity affects dismissal. |
85
+ | `gestureResponseDistance` | `number` | Distance from screen where the gesture is recognized. |
86
+ | `gestureDrivesProgress` | `boolean` | Whether the gesture directly drives the transition progress. |
114
87
 
115
- ### For Nested Navigators
88
+ ### Renamed native options (extended stack)
116
89
 
117
- When using nested navigators, wrap the nested Stack in a transition-aware component:
90
+ To avoid collisions with the new options above, the built-in React Navigation gesture props are renamed:
118
91
 
119
- ```tsx
120
- // app/nested/_layout.tsx
121
- import Transition from "react-native-screen-transitions";
92
+ | React Navigation prop | Renamed to |
93
+ |---|---|
94
+ | `gestureDirection` | `nativeGestureDirection` |
95
+ | `gestureEnabled` | `nativeGestureEnabled` |
96
+ | `gestureResponseDistance` | `nativeGestureResponseDistance` |
122
97
 
123
- export default function TabLayout() {
124
- return (
125
- <Transition.View>
126
- <Stack>
127
- <Stack.Screen name="nested-a" {...Transition.createScreenConfig()} />
128
- <Stack.Screen name="nested-b" {...Transition.createScreenConfig()} />
129
- </Stack>
130
- </Transition.View>
131
- );
132
- }
133
- ```
98
+ All other React Navigation native-stack options keep their original names.
134
99
 
135
- ## Advanced Usage
136
100
 
137
- ### Method 1: Navigator-Level Interpolator (Recommended)
101
+ ## Creating your screen animations
138
102
 
139
- Define a `screenStyleInterpolator` at the navigator level to animate both entering and exiting screens simultaneously. This approach is much cleaner.
103
+ ### Using presets
140
104
 
141
- ```tsx
142
- // app/_layout.tsx
143
- import { Stack } from "expo-router";
144
- import { GestureHandlerRootView } from "react-native-gesture-handler";
145
- import Transition from "react-native-screen-transitions";
146
- import { interpolate, Easing } from "react-native-reanimated";
105
+ Pick a built-in preset and spread it into the screen’s options.
106
+ The incoming screen automatically controls the previous screen.
147
107
 
148
- export default function RootLayout() {
149
- return (
150
- <GestureHandlerRootView>
151
- <Stack>
152
- <Stack.Screen
153
- name="a"
154
- {...Transition.createScreenConfig()} // Initialize
155
- />
156
- <Stack.Screen
157
- name="b"
158
- {...Transition.createScreenConfig({
159
- gestureDirection: "horizontal",
160
- gestureEnabled: true,
161
- gestureResponseDistance: 50,
162
- gestureVelocityImpact: 0.3,
163
- screenStyleInterpolator: ({
164
- current,
165
- next,
166
- layouts: { screen: { width } },
167
- }) => {
168
- "worklet";
169
- // Mimics the iOS stack slide animation
170
- const progress = current.progress.value + (next?.progress.value || 0);
171
- const translateX = interpolate(
172
- progress,
173
- [0, 1, 2],
174
- [width, 0, width * -0.3],
175
- "clamp"
176
- );
177
- return {
178
- contentStyle: {
179
- transform: [{ translateX }],
180
- },
181
- };
182
- },
183
- transitionSpec: {
184
- open: {
185
- easing: Easing.bezier(0.25, 0.1, 0.25, 1.0),
186
- duration: 1000,
187
- },
188
- close: {
189
- damping: 10,
190
- mass: 0.5,
191
- stiffness: 100,
192
- },
193
- },
194
- })}
195
- />
196
- </Stack>
197
- </GestureHandlerRootView>
198
- );
199
- }
108
+ ```tsx
109
+ <Stack>
110
+ <Stack.Screen
111
+ name="a"
112
+ />
113
+ <Stack.Screen
114
+ name="b"
115
+ options={{
116
+ ...Transition.presets.SlideFromTop(),
117
+ }}
118
+ />
119
+ <Stack.Screen
120
+ name="c"
121
+ options={{
122
+ ...Transition.presets.SlideFromBottom(),
123
+ }}
124
+ />
125
+ </Stack>
200
126
  ```
201
127
 
202
- When using `screenStyleInterpolator`, both screens must wrap their content in a transition-aware component.
128
+ ### Navigator-level custom animations
203
129
 
204
- ### Method 2: Screen-Level Animations
130
+ Instead of presets, you can define a custom transition directly on the screen’s options.
131
+ `screenStyleInterpolator` receives an object with the following useful fields:
132
+
133
+ - `progress` – overall transition progress (`0 → 2`).
134
+ - `current` – state for the current screen (includes `progress`, `closing`, `gesture`, `route`, etc.).
135
+ - `previous` – state for the previous screen (may be `undefined`).
136
+ - `next` – state for the next screen (may be `undefined`).
137
+ - `layouts.screen` – `{ width, height }` of the container.
138
+ - `insets` – `{ top, right, bottom, left }` safe-area insets.
139
+ - `bounds(id)` – helper to compute shared-element transforms (see IntelliSense for chainable methods).
140
+ - `activeBoundId` – id of the active bound.
141
+ - `focused` – state of the current screen
205
142
 
206
- Alternatively, define animations at the screen level using the `useScreenAnimation` hook. This is useful for screen-specific effects or when you don't need to animate both screens. You CAN combine this with `screenStyleInterpolator` for more advanced animations, but for this example, we'll leave `screenStyleInterpolator` undefined.
207
143
 
208
144
  ```tsx
209
- // app/_layout.tsx
210
- <Stack.Screen
211
- name="a"
212
- {...Transition.createScreenConfig()}
213
- />
145
+ import { interpolate } from 'react-native-reanimated'
146
+
214
147
  <Stack.Screen
215
148
  name="b"
216
- {...Transition.createScreenConfig({
149
+ options={{
150
+ enableTransitions: true,
151
+ screenStyleInterpolator: ({
152
+ layouts: { screen: { width } },
153
+ progress,
154
+ }) => {
155
+ "worklet";
156
+
157
+ const x = interpolate(progress, [0, 1, 2], [width, 0, -width]);
158
+ return {
159
+ contentStyle: {
160
+ transform: [{ translateX: x }],
161
+ },
162
+ };
163
+ },
217
164
  transitionSpec: {
218
- open: {
219
- easing: Easing.bezier(0.25, 0.1, 0.25, 1.0),
220
- duration: 1000,
221
- },
222
- close: {
223
- damping: 10,
224
- mass: 0.5,
225
- stiffness: 100,
226
- },
165
+ close: Transition.specs.DefaultSpec,
166
+ open: Transition.specs.DefaultSpec,
227
167
  },
228
- })}
168
+ }}
229
169
  />
230
170
  ```
231
171
 
232
- ```tsx
233
- // a.tsx (previous screen)
234
- import { useScreenAnimation } from 'react-native-screen-transitions';
235
- import Animated, { useAnimatedStyle, interpolate } from 'react-native-reanimated';
236
-
237
- export default function A() {
238
- const { next, layouts: { screen: { width } } } = useScreenAnimation();
172
+ In this example the incoming screen slides in from the right while the exiting screen slides out to the left.
239
173
 
240
- const animatedStyle = useAnimatedStyle(() => {
241
- // Unfocusing animation - screen slides left when next screen enters
242
- const translateX = interpolate(next?.progress.value || 0, [0, 1], [0, width * -0.3]);
243
- return {
244
- transform: [{ translateX }],
245
- };
246
- });
174
+ ### Screen-level custom animations with `useScreenAnimation`
247
175
 
248
- return (
249
- <Animated.View style={[{ flex: 1 }, animatedStyle]}>
250
- {/* Your content */}
251
- </Animated.View>
252
- );
253
- }
176
+ For per-screen control, import the `useScreenAnimation` hook and compose your own animated styles.
254
177
 
255
- // b.tsx (entering screen)
178
+ ```tsx
256
179
  import { useScreenAnimation } from 'react-native-screen-transitions';
257
180
  import Animated, { useAnimatedStyle, interpolate } from 'react-native-reanimated';
258
181
 
259
- export default function B() {
260
- const { current, layouts: { screen: { width } } } = useScreenAnimation();
182
+ export default function BScreen() {
183
+ const props = useScreenAnimation();
261
184
 
262
185
  const animatedStyle = useAnimatedStyle(() => {
263
- // Focusing animation - screen slides in from right
264
- const translateX = interpolate(current.progress.value, [0, 1], [width, 0]);
186
+ const { current: { progress } } = props.value
265
187
  return {
266
- transform: [{ translateX }],
188
+ opacity: progress
267
189
  };
268
190
  });
269
191
 
@@ -275,115 +197,193 @@ export default function B() {
275
197
  }
276
198
  ```
277
199
 
200
+ ## Swipe-to-dismiss with scrollables
278
201
 
279
-
280
- ## Dismissible Screens with Scrollables
281
-
282
- Screen transitions can be dismissed based on defined gesture directions. Integration with scrollable components is seamless:
283
-
284
- ### Create Custom Transition-Aware Scrollables
285
-
286
- You can use built-in scrollables or create your own
202
+ You can drag a screen away even when it contains a scroll view.
203
+ Just swap the regular scrollable for a transition-aware one:
287
204
 
288
205
  ```tsx
206
+ import Transition from 'react-native-screen-transitions';
207
+ import { LegendList } from "@legendapp/list"
289
208
  import { FlashList } from "@shopify/flash-list";
290
- import { LegendList } from "@legendapp/list";
291
- import { FlatList, ScrollView } from "react-native";
292
- import Transition from "react-native-screen-transitions";
293
209
 
294
- // Built-in transition-aware scrollables
295
- const MyScrollView = Transition.ScrollView;
296
- const MyFlatList = Transition.FlatList;
210
+ // Drop-in replacements
211
+ const ScrollView = Transition.ScrollView;
212
+ const FlatList = Transition.FlatList;
297
213
 
298
- // Create custom transition-aware scrollables
299
- const TransitionFlashList = Transition.createTransitionAwareScrollable(FlashList);
300
- const TransitionLegendList = Transition.createTransitionAwareScrollable(LegendList);
301
- ```
214
+ // Or wrap any list you like
215
+ const TransitionFlashList =
216
+ Transition.createTransitionAwareScrollable(FlashList, { isScrollable: true });
302
217
 
303
- These components now integrate seamlessly with your transition system and provide smart gesture handling.
218
+ const TransitionLegendList =
219
+ Transition.createTransitionAwareScrollable(LegendList, { isScrollable: true} );
220
+ ```
304
221
 
305
- ### Configure Gesture Directions
222
+ Enable the gesture on the screen:
306
223
 
307
224
  ```tsx
308
225
  <Stack.Screen
309
- name="scrollable-screen"
310
- {...Transition.createScreenConfig({
311
- gestureDirection: ["vertical", "vertical-inverted"],
226
+ name="gallery"
227
+ options={{
228
+ enableTransitions: true,
312
229
  gestureEnabled: true,
313
- // ... other config
314
- })}
230
+ gestureDirection: 'vertical', // or 'horizontal', ['vertical', 'horizontal'], etc.
231
+ }}
315
232
  />
316
233
  ```
317
234
 
318
- ### Use in Your Screen
235
+ Use it in the screen:
319
236
 
320
237
  ```tsx
321
- // scrollable-screen.tsx
322
- export default function ScrollableScreen() {
238
+ export default function B() {
323
239
  return (
324
240
  <Transition.ScrollView>
325
- {/* Your scrollable content */}
241
+ {/* content */}
326
242
  </Transition.ScrollView>
327
243
  );
328
244
  }
329
245
  ```
330
246
 
331
- **Smart Gesture Handling**: The screen will only start the dismissal process when:
332
- - `vertical`: ScrollView is at the top (scrollY <= 0)
333
- - `vertical-inverted`: ScrollView is at the bottom (scrollY >= maxScroll)
334
- - `horizontal`: ScrollView is at the left edge
335
- - `horizontal-inverted`: ScrollView is at the right edge
247
+ Gesture rules (handled automatically):
336
248
 
337
- This prevents gesture conflicts and provides intuitive user interaction.
249
+ - **vertical** only starts when the list is at the very top
250
+ - **vertical-inverted** – only starts when the list is at the very bottom
251
+ - **horizontal** / **horizontal-inverted** – only starts when the list is at the left or right edge
338
252
 
339
- ## Performance Considerations
253
+ These rules apply **only when the screen contains a scrollable**.
254
+ If no scroll view is present, the gesture can begin from **anywhere on the screen**—not restricted to the edges.
340
255
 
341
- This package is designed for optimal performance, but since underlying screens remain active during transitions, following these guidelines will help maintain smooth 60fps animations:
256
+ ## Bounds (measure-driven screen transitions)
342
257
 
343
- ### Screen Optimization
344
- - **Keep screens lightweight**: Minimize heavy computations and complex layouts in screens that will be animated
258
+ Bounds let you animate **any component** between two screens by measuring its start and end positions.
259
+ They are **not shared elements**—they’re just measurements.
260
+ Tag the component you want to animate with `sharedBoundTag`, then describe how it should move when the screen transition starts.
345
261
 
346
- ### Animation Properties
347
- Prioritize transform and opacity properties over layout-affecting properties for the smoothest animations:
262
+ 1. Tag the source component
348
263
 
349
- **✅ Performant properties:**
350
- - `transform` (translateX, translateY, scale, rotate)
351
- - `opacity`
352
- - `backgroundColor` (with caution)
264
+ ```tsx
265
+ <Transition.View sharedBoundTag="hero" style={{ width: 100, height: 100 }}>
266
+ <Image source={uri} style={{ width: '100%', height: '100%' }} resizeMode="cover" />
267
+ </Transition.View>
268
+ ```
353
269
 
354
- **❌ Avoid when possible:**
355
- - Layout properties (`width`, `height`, `padding`, `margin`)
356
- - `borderRadius` on large elements
357
- - Complex `shadowOffset` or `elevation` changes
358
- - Frequent `zIndex` modifications
270
+ 2. Tag the destination component (same id)
359
271
 
360
- ### Easing and Timing Configuration
272
+ ```tsx
273
+ <Transition.View sharedBoundTag="hero" style={{ width: 200, height: 200 }}>
274
+ <Image source={uri} style={{ width: '100%', height: '100%' }} resizeMode="cover" />
275
+ </Transition.View>
276
+ ```
361
277
 
362
- Choose balanced easing curves to avoid perceived delays:
278
+ 3. Drive the animation in `screenStyleInterpolator`
363
279
 
364
280
  ```tsx
365
- // ✅ Good - Smooth and responsive
366
- transitionSpec: {
367
- open: {
368
- duration: 300,
369
- easing: Easing.bezier(0.25, 0.1, 0.25, 1), // iOS-like easing
370
- },
371
- close: {
372
- duration: 250,
373
- easing: Easing.out(Easing.quad),
374
- },
375
- }
281
+ screenStyleInterpolator: ({
282
+ activeBoundId,
283
+ bounds,
284
+ focused,
285
+ current,
286
+ next,
287
+ }) => {
288
+ "worklet";
289
+
290
+ const animatedBoundStyles = bounds()
291
+ .relative()
292
+ .transform()
293
+ .build();
294
+
295
+ return {
296
+ [activeBoundId]: animatedBoundStyles,
297
+ };
298
+ };
299
+ ```
376
300
 
377
- // Avoid - Too snappy, may cause perceived delays
378
- transitionSpec: {
379
- close: {
380
- duration: 400,
381
- easing: Easing.bezierFn(0, 0.98, 0, 1), // Too abrupt
382
- },
383
- }
301
+ That’s it—the bounds helper works alongside focused and unfocused screens.
302
+ For further customization, separate logic by the `focused` prop:
303
+
304
+ ```tsx
305
+ screenStyleInterpolator: ({
306
+ activeBoundId,
307
+ bounds,
308
+ focused,
309
+ current,
310
+ next,
311
+ }) => {
312
+ "worklet";
313
+
314
+
315
+ if (focused) {
316
+ const focusedBoundStyles = bounds()
317
+ .relative()
318
+ .transform()
319
+ .build();
320
+
321
+ return {
322
+ [activeBoundId]: focusedBoundStyles,
323
+ };
324
+ }
325
+
326
+ return {}
327
+ };
384
328
  ```
385
329
 
386
- **Why timing matters**: Screen dismissal callbacks execute when animations complete. Overly snappy configurations can create a perceived delay between gesture end and actual screen dismissal. Find the sweet spot that matches your app's personality while feeling responsive.
330
+
331
+ ### Choosing the right modifier
332
+
333
+ | Modifier | When to use |
334
+ |---|---|
335
+ | `gestures({x,y})` | Sync the bound with live gesture deltas (drag, swipe). |
336
+ | `toFullscreen()` | Destination has no `sharedBoundTag`; animate to full-screen size. |
337
+ | `absolute()` | Element is not constrained by parent layout (uses pageX/pageY). |
338
+ | `relative()` | Element is inside layout constraints (default). |
339
+ | `transform()` | Animate with `translateX/Y` + `scaleX/Y` (default). |
340
+ | `size()` | Animate `translateX/Y` + `width/height` (no scale). |
341
+ | `content()` | Center the container so its bound aligns with the source at progress start. |
342
+ | `contentFill()` / `contentFit()` | Control how the content scales inside the container. |
343
+ | `build()` | Finalize the animated style object. |
344
+
345
+ ### Quick access: `bounds.get()`
346
+
347
+ Need the raw measurements or styles for a specific bound?
348
+ Call `bounds.get(boundId, phase)` to retrieve the exact dimensions and style object for any bound tag and screen phase (`current`, `next`, or `previous`).
349
+
350
+ ```tsx
351
+ const heroMetrics = bounds.get('hero', 'current');
352
+ // heroMetrics = { bounds: { x, y, width, height, pageX, pageY }, styles: { ... } }
353
+ ```
354
+
355
+ Use this when you want explicit control over which bound’s data you animate, regardless of the current screen focus.
356
+
357
+ ### Animating individual components with `styleId`
358
+
359
+ Use `styleId` to animate a single view inside a screen.
360
+
361
+ 1. Tag the element:
362
+
363
+ ```tsx
364
+ <Transition.View styleId="fade-box" style={{ width: 100, height: 100, backgroundColor: 'crimson' }} />
365
+ ```
366
+
367
+ 2. Drive it from the interpolator:
368
+
369
+ ```tsx
370
+ screenStyleInterpolator: ({ progress }) => {
371
+ "worklet";
372
+
373
+ return {
374
+ 'fade-box': {
375
+ opacity: interpolate(progress, [0, 1, 2],[0, 1, 0])
376
+ }
377
+ };
378
+ };
379
+ ```
380
+
381
+ The red square fades in as the screen opens.
382
+
383
+ ## Known Issues
384
+
385
+ - **Delayed Touch Events** – There’s a noticeable delay in touch events, likely caused by the `beforeRemove` listener in the native stack. If this affects your app, please hold off on using this package until a fix is available.
386
+ - **Deeply nested navigators with scrollables** – Behavior is currently unstable. We recommend using programmatic dismissal for deeply nested navigators that contain scrollables, as the gesture-driven dismissal logic needs an overhaul.
387
387
 
388
388
 
389
389
  ## Support and Development
@@ -395,6 +395,10 @@ This package is provided as-is and is developed in my free time. While I strive
395
395
 
396
396
  I apologize for any inconvenience this may cause. If you encounter issues or have suggestions, please feel free to open an issue on the repository.
397
397
 
398
+ ### Support the project
399
+ I’ve estimated I downed around 60 cups of coffee while building this.
400
+ If you’d like to fuel the next release, [buy me a coffee](https://buymeacoffee.com/trpfsu)
401
+
398
402
 
399
403
 
400
404
  ## License