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
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ import { getHeaderTitle, Header, HeaderBackButton, HeaderBackContext, SafeAreaProviderCompat, Screen, useHeaderHeight } from "@react-navigation/elements";
4
+ import { useLinkBuilder } from "@react-navigation/native";
5
+ import * as React from "react";
6
+ import { Animated, Image, StyleSheet, View } from "react-native";
7
+ import { AnimatedHeaderHeightContext } from "../utils/useAnimatedHeaderHeight";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const TRANSPARENT_PRESENTATIONS = ["transparentModal", "containedTransparentModal"];
10
+ export function NativeStackView({
11
+ state,
12
+ descriptors,
13
+ describe
14
+ }) {
15
+ const parentHeaderBack = React.useContext(HeaderBackContext);
16
+ const {
17
+ buildHref
18
+ } = useLinkBuilder();
19
+ const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
20
+ acc[route.key] = acc[route.key] || describe(route, true);
21
+ return acc;
22
+ }, {});
23
+ return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
24
+ children: state.routes.concat(state.preloadedRoutes).map((route, i) => {
25
+ const isFocused = state.index === i;
26
+ const previousKey = state.routes[i - 1]?.key;
27
+ const nextKey = state.routes[i + 1]?.key;
28
+ const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
29
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
30
+ const {
31
+ options,
32
+ navigation,
33
+ render
34
+ } = descriptors[route.key] ?? preloadedDescriptors[route.key];
35
+ const headerBack = previousDescriptor ? {
36
+ title: getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name),
37
+ href: buildHref(previousDescriptor.route.name, previousDescriptor.route.params)
38
+ } : parentHeaderBack;
39
+ const canGoBack = headerBack != null;
40
+ const {
41
+ header,
42
+ headerShown,
43
+ headerBackImageSource,
44
+ headerLeft,
45
+ headerTransparent,
46
+ headerBackTitle,
47
+ presentation,
48
+ contentStyle,
49
+ ...rest
50
+ } = options;
51
+ const nextPresentation = nextDescriptor?.options.presentation;
52
+ const isPreloaded = preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;
53
+ return /*#__PURE__*/_jsx(Screen, {
54
+ focused: isFocused,
55
+ route: route,
56
+ navigation: navigation,
57
+ headerShown: headerShown,
58
+ headerTransparent: headerTransparent,
59
+ header: header !== undefined ? header({
60
+ back: headerBack,
61
+ options,
62
+ route,
63
+ navigation
64
+ }) : /*#__PURE__*/_jsx(Header, {
65
+ ...rest,
66
+ back: headerBack,
67
+ title: getHeaderTitle(options, route.name),
68
+ headerLeft: typeof headerLeft === "function" ? ({
69
+ label,
70
+ ...rest
71
+ }) => headerLeft({
72
+ ...rest,
73
+ label: headerBackTitle ?? label
74
+ }) : headerLeft === undefined && canGoBack ? ({
75
+ tintColor,
76
+ label,
77
+ ...rest
78
+ }) => /*#__PURE__*/_jsx(HeaderBackButton, {
79
+ ...rest,
80
+ label: headerBackTitle ?? label,
81
+ tintColor: tintColor,
82
+ backImage: headerBackImageSource !== undefined ? () => /*#__PURE__*/_jsx(Image, {
83
+ source: headerBackImageSource,
84
+ resizeMode: "contain",
85
+ tintColor: tintColor,
86
+ style: styles.backImage
87
+ }) : undefined,
88
+ onPress: navigation.goBack
89
+ }) : headerLeft,
90
+ headerTransparent: headerTransparent
91
+ }),
92
+ style: [StyleSheet.absoluteFill, {
93
+ display: (isFocused || nextPresentation != null && TRANSPARENT_PRESENTATIONS.includes(nextPresentation)) && !isPreloaded ? "flex" : "none"
94
+ }, presentation != null && TRANSPARENT_PRESENTATIONS.includes(presentation) ? {
95
+ backgroundColor: "transparent"
96
+ } : null],
97
+ children: /*#__PURE__*/_jsx(HeaderBackContext.Provider, {
98
+ value: headerBack,
99
+ children: /*#__PURE__*/_jsx(AnimatedHeaderHeightProvider, {
100
+ children: /*#__PURE__*/_jsx(View, {
101
+ style: [styles.contentContainer, contentStyle],
102
+ children: render()
103
+ })
104
+ })
105
+ })
106
+ }, route.key);
107
+ })
108
+ });
109
+ }
110
+ const AnimatedHeaderHeightProvider = ({
111
+ children
112
+ }) => {
113
+ const headerHeight = useHeaderHeight();
114
+ const [animatedHeaderHeight] = React.useState(() => new Animated.Value(headerHeight));
115
+ React.useEffect(() => {
116
+ animatedHeaderHeight.setValue(headerHeight);
117
+ }, [animatedHeaderHeight, headerHeight]);
118
+ return /*#__PURE__*/_jsx(AnimatedHeaderHeightContext.Provider, {
119
+ value: animatedHeaderHeight,
120
+ children: children
121
+ });
122
+ };
123
+ const styles = StyleSheet.create({
124
+ contentContainer: {
125
+ flex: 1
126
+ },
127
+ backImage: {
128
+ height: 24,
129
+ width: 24,
130
+ margin: 3
131
+ }
132
+ });
133
+ //# sourceMappingURL=NativeStackView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","SafeAreaProviderCompat","Screen","useHeaderHeight","useLinkBuilder","React","Animated","Image","StyleSheet","View","AnimatedHeaderHeightContext","jsx","_jsx","TRANSPARENT_PRESENTATIONS","NativeStackView","state","descriptors","describe","parentHeaderBack","useContext","buildHref","preloadedDescriptors","preloadedRoutes","reduce","acc","route","key","children","routes","concat","map","i","isFocused","index","previousKey","nextKey","previousDescriptor","undefined","nextDescriptor","options","navigation","render","headerBack","title","name","href","params","canGoBack","header","headerShown","headerBackImageSource","headerLeft","headerTransparent","headerBackTitle","presentation","contentStyle","rest","nextPresentation","isPreloaded","focused","back","label","tintColor","backImage","source","resizeMode","style","styles","onPress","goBack","absoluteFill","display","includes","backgroundColor","Provider","value","AnimatedHeaderHeightProvider","contentContainer","headerHeight","animatedHeaderHeight","useState","Value","useEffect","setValue","create","flex","height","width","margin"],"sourceRoot":"../../../../../src","sources":["integrations/native-stack/views/NativeStackView.tsx"],"mappings":";;AAAA,SACCA,cAAc,EACdC,MAAM,EACNC,gBAAgB,EAChBC,iBAAiB,EACjBC,sBAAsB,EACtBC,MAAM,EACNC,eAAe,QACT,4BAA4B;AACnC,SAICC,cAAc,QACR,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAOhE,SAASC,2BAA2B,QAAQ,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAa/E,MAAMC,yBAAyB,GAAG,CACjC,kBAAkB,EAClB,2BAA2B,CAC3B;AAED,OAAO,SAASC,eAAeA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC;AAAgB,CAAC,EAAE;EACxE,MAAMC,gBAAgB,GAAGb,KAAK,CAACc,UAAU,CAACnB,iBAAiB,CAAC;EAC5D,MAAM;IAAEoB;EAAU,CAAC,GAAGhB,cAAc,CAAC,CAAC;EAEtC,MAAMiB,oBAAoB,GACzBN,KAAK,CAACO,eAAe,CAACC,MAAM,CAA2B,CAACC,GAAG,EAAEC,KAAK,KAAK;IACtED,GAAG,CAACC,KAAK,CAACC,GAAG,CAAC,GAAGF,GAAG,CAACC,KAAK,CAACC,GAAG,CAAC,IAAIT,QAAQ,CAACQ,KAAK,EAAE,IAAI,CAAC;IACxD,OAAOD,GAAG;EACX,CAAC,EAAE,CAAC,CAAC,CAAC;EAEP,oBACCZ,IAAA,CAACX,sBAAsB;IAAA0B,QAAA,EACrBZ,KAAK,CAACa,MAAM,CAACC,MAAM,CAACd,KAAK,CAACO,eAAe,CAAC,CAACQ,GAAG,CAAC,CAACL,KAAK,EAAEM,CAAC,KAAK;MAC7D,MAAMC,SAAS,GAAGjB,KAAK,CAAC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E;IACjBQ,IAAI,EAAE;EACP,CAAC;EACDtB,SAAS,EAAE;IACVuB,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACT;AACD,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,492 @@
1
+ "use strict";
2
+
3
+ import { getDefaultHeaderHeight, getHeaderTitle, HeaderBackContext, HeaderHeightContext, HeaderShownContext, SafeAreaProviderCompat, useFrameSize } from "@react-navigation/elements";
4
+ import { NavigationContext, NavigationRouteContext, StackActions, usePreventRemoveContext, useTheme } from "@react-navigation/native";
5
+ import * as React from "react";
6
+ import { Animated, Platform, StatusBar, StyleSheet, useAnimatedValue, View } from "react-native";
7
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
8
+ import { ScreenStack, ScreenStackItem } from "react-native-screens";
9
+ import { ScreenLifecycleController } from "../../../components/controllers/screen-lifecycle";
10
+ import { RootTransitionAware } from "../../../components/root-transition-aware";
11
+ import { ScreenGestureProvider } from "../../../providers/gestures";
12
+ import { KeysProvider } from "../../../providers/keys";
13
+ import { debounce } from "../utils/debounce";
14
+ import { getModalRouteKeys } from "../utils/getModalRoutesKeys";
15
+ import { AnimatedHeaderHeightContext } from "../utils/useAnimatedHeaderHeight";
16
+ import { useDismissedRouteError } from "../utils/useDismissedRouteError";
17
+ import { useInvalidPreventRemoveError } from "../utils/useInvalidPreventRemoveError";
18
+ import { useHeaderConfigProps } from "./useHeaderConfigProps";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
21
+ function isFabric() {
22
+ return "nativeFabricUIManager" in global;
23
+ }
24
+ const useNativeDriver = Platform.OS !== "web";
25
+ const SceneView = ({
26
+ index,
27
+ focused,
28
+ shouldFreeze,
29
+ descriptor,
30
+ previousDescriptor,
31
+ nextDescriptor,
32
+ isPresentationModal,
33
+ isPreloaded,
34
+ onWillDisappear,
35
+ onWillAppear,
36
+ onAppear,
37
+ onDisappear,
38
+ onDismissed,
39
+ onHeaderBackButtonClicked,
40
+ onNativeDismissCancelled,
41
+ onGestureCancel,
42
+ onSheetDetentChanged
43
+ }) => {
44
+ const {
45
+ route,
46
+ navigation,
47
+ options,
48
+ render
49
+ } = descriptor;
50
+ let {
51
+ animation,
52
+ animationMatchesGesture,
53
+ presentation = isPresentationModal ? "modal" : "card",
54
+ fullScreenGestureEnabled
55
+ } = options;
56
+ const {
57
+ animationDuration,
58
+ animationTypeForReplace = "push",
59
+ fullScreenGestureShadowEnabled = true,
60
+ nativeGestureEnabled,
61
+ nativeGestureDirection = presentation === "card" ? "horizontal" : "vertical",
62
+ nativeGestureResponseDistance,
63
+ header,
64
+ headerBackButtonMenuEnabled,
65
+ headerShown,
66
+ headerBackground,
67
+ headerTransparent,
68
+ autoHideHomeIndicator,
69
+ keyboardHandlingEnabled,
70
+ navigationBarColor,
71
+ navigationBarTranslucent,
72
+ navigationBarHidden,
73
+ orientation,
74
+ sheetAllowedDetents = [1.0],
75
+ sheetLargestUndimmedDetentIndex = -1,
76
+ sheetGrabberVisible = false,
77
+ sheetCornerRadius = -1.0,
78
+ sheetElevation = 24,
79
+ sheetExpandsWhenScrolledToEdge = true,
80
+ sheetInitialDetentIndex = 0,
81
+ statusBarAnimation,
82
+ statusBarHidden,
83
+ statusBarStyle,
84
+ statusBarTranslucent,
85
+ statusBarBackgroundColor,
86
+ unstable_sheetFooter,
87
+ freezeOnBlur,
88
+ contentStyle,
89
+ enableTransitions
90
+ } = options;
91
+ if (nativeGestureDirection === "vertical" && Platform.OS === "ios") {
92
+ // for `vertical` direction to work, we need to set `fullScreenGestureEnabled` to `true`
93
+ // so the screen can be dismissed from any point on screen.
94
+ // `animationMatchesGesture` needs to be set to `true` so the `animation` set by user can be used,
95
+ // otherwise `simple_push` will be used.
96
+ // Also, the default animation for this direction seems to be `slide_from_bottom`.
97
+ if (fullScreenGestureEnabled === undefined) {
98
+ fullScreenGestureEnabled = true;
99
+ }
100
+ if (animationMatchesGesture === undefined) {
101
+ animationMatchesGesture = true;
102
+ }
103
+ if (animation === undefined) {
104
+ animation = "slide_from_bottom";
105
+ }
106
+ }
107
+
108
+ // workaround for rn-screens where gestureDirection has to be set on both
109
+ // current and previous screen - software-mansion/react-native-screens/pull/1509
110
+ const nextGestureDirection = nextDescriptor?.options.nativeGestureDirection;
111
+ const gestureDirectionOverride = nextGestureDirection != null ? nextGestureDirection : nativeGestureDirection;
112
+ if (index === 0) {
113
+ // first screen should always be treated as `card`, it resolves problems with no header animation
114
+ // for navigator with first screen as `modal` and the next as `card`
115
+ presentation = "card";
116
+ }
117
+ const {
118
+ colors
119
+ } = useTheme();
120
+ const insets = useSafeAreaInsets();
121
+
122
+ // `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.
123
+ const isModal = presentation === "modal" || presentation === "formSheet";
124
+
125
+ // Modals are fullscreen in landscape only on iPhone
126
+ const isIPhone = Platform.OS === "ios" && !(Platform.isPad || Platform.isTV);
127
+ const isParentHeaderShown = React.useContext(HeaderShownContext);
128
+ const parentHeaderHeight = React.useContext(HeaderHeightContext);
129
+ const parentHeaderBack = React.useContext(HeaderBackContext);
130
+ const isLandscape = useFrameSize(frame => frame.width > frame.height);
131
+ const topInset = isParentHeaderShown || Platform.OS === "ios" && isModal || isIPhone && isLandscape ? 0 : insets.top;
132
+ const defaultHeaderHeight = useFrameSize(frame => Platform.select({
133
+ // FIXME: Currently screens isn't using Material 3
134
+ // So our `getDefaultHeaderHeight` doesn't return the correct value
135
+ // So we hardcode the value here for now until screens is updated
136
+ android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,
137
+ default: getDefaultHeaderHeight(frame, isModal, topInset)
138
+ }));
139
+ const {
140
+ preventedRoutes
141
+ } = usePreventRemoveContext();
142
+ const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);
143
+
144
+ // eslint-disable-next-line react-hooks/exhaustive-deps
145
+ const setHeaderHeightDebounced = React.useCallback(
146
+ // Debounce the header height updates to avoid excessive re-renders
147
+ debounce(setHeaderHeight, 100), []);
148
+ const hasCustomHeader = header != null;
149
+ let headerHeightCorrectionOffset = 0;
150
+ if (Platform.OS === "android" && !hasCustomHeader) {
151
+ const statusBarHeight = StatusBar.currentHeight ?? 0;
152
+
153
+ // FIXME: On Android, the native header height is not correctly calculated
154
+ // It includes status bar height even if statusbar is not translucent
155
+ // And the statusbar value itself doesn't match the actual status bar height
156
+ // So we subtract the bogus status bar height and add the actual top inset
157
+ headerHeightCorrectionOffset = -statusBarHeight + topInset;
158
+ }
159
+ const rawAnimatedHeaderHeight = useAnimatedValue(defaultHeaderHeight);
160
+ const animatedHeaderHeight = React.useMemo(() => Animated.add(rawAnimatedHeaderHeight, headerHeightCorrectionOffset), [headerHeightCorrectionOffset, rawAnimatedHeaderHeight]);
161
+
162
+ // During the very first render topInset is > 0 when running
163
+ // in non edge-to-edge mode on Android, while on every consecutive render
164
+ // topInset === 0, causing header content to jump, as we add padding on the first frame,
165
+ // just to remove it in next one. To prevent this, when statusBarTranslucent is set,
166
+ // we apply additional padding in header only if its true.
167
+ // For more details see: https://github.com/react-navigation/react-navigation/pull/12014
168
+ const headerTopInsetEnabled = typeof statusBarTranslucent === "boolean" ? statusBarTranslucent : topInset !== 0;
169
+ const canGoBack = previousDescriptor != null || parentHeaderBack != null;
170
+ const backTitle = previousDescriptor ? getHeaderTitle(previousDescriptor.options, previousDescriptor.route.name) : parentHeaderBack?.title;
171
+ const headerBack = React.useMemo(() => {
172
+ if (canGoBack) {
173
+ return {
174
+ href: undefined,
175
+ // No href needed for native
176
+ title: backTitle
177
+ };
178
+ }
179
+ return undefined;
180
+ }, [canGoBack, backTitle]);
181
+ const isRemovePrevented = preventedRoutes[route.key]?.preventRemove;
182
+ const modifiedPresentation = enableTransitions ? "containedTransparentModal" : presentation === "card" ? "push" : presentation;
183
+ const modifiedAnimation = enableTransitions ? "none" : animation;
184
+ const modifiedHeaderShown = enableTransitions || header !== undefined ? false : headerShown;
185
+ const headerConfig = useHeaderConfigProps({
186
+ ...options,
187
+ route,
188
+ headerBackButtonMenuEnabled: isRemovePrevented !== undefined ? !isRemovePrevented : headerBackButtonMenuEnabled,
189
+ headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : undefined,
190
+ headerHeight,
191
+ headerShown: modifiedHeaderShown,
192
+ headerTopInsetEnabled,
193
+ headerBack
194
+ });
195
+ return /*#__PURE__*/_jsx(NavigationContext.Provider, {
196
+ value: navigation,
197
+ children: /*#__PURE__*/_jsx(NavigationRouteContext.Provider, {
198
+ value: route,
199
+ children: /*#__PURE__*/_jsx(ScreenStackItem, {
200
+ screenId: route.key,
201
+ activityState: isPreloaded ? 0 : 2,
202
+ style: StyleSheet.absoluteFill,
203
+ "aria-hidden": !focused,
204
+ customAnimationOnSwipe: animationMatchesGesture,
205
+ fullScreenSwipeEnabled: fullScreenGestureEnabled,
206
+ fullScreenSwipeShadowEnabled: fullScreenGestureShadowEnabled,
207
+ freezeOnBlur: freezeOnBlur,
208
+ gestureEnabled: Platform.OS === "android" ?
209
+ // This prop enables handling of system back gestures on Android
210
+ // Since we handle them in JS side, we disable this
211
+ false : nativeGestureEnabled,
212
+ homeIndicatorHidden: autoHideHomeIndicator,
213
+ hideKeyboardOnSwipe: keyboardHandlingEnabled,
214
+ navigationBarColor: navigationBarColor,
215
+ navigationBarTranslucent: navigationBarTranslucent,
216
+ navigationBarHidden: navigationBarHidden,
217
+ replaceAnimation: animationTypeForReplace,
218
+ stackPresentation: modifiedPresentation,
219
+ stackAnimation: modifiedAnimation,
220
+ screenOrientation: orientation,
221
+ sheetAllowedDetents: sheetAllowedDetents,
222
+ sheetLargestUndimmedDetentIndex: sheetLargestUndimmedDetentIndex,
223
+ sheetGrabberVisible: sheetGrabberVisible,
224
+ sheetInitialDetentIndex: sheetInitialDetentIndex,
225
+ sheetCornerRadius: sheetCornerRadius,
226
+ sheetElevation: sheetElevation,
227
+ sheetExpandsWhenScrolledToEdge: sheetExpandsWhenScrolledToEdge,
228
+ statusBarAnimation: statusBarAnimation,
229
+ statusBarHidden: statusBarHidden,
230
+ statusBarStyle: statusBarStyle,
231
+ statusBarColor: statusBarBackgroundColor,
232
+ statusBarTranslucent: statusBarTranslucent,
233
+ swipeDirection: gestureDirectionOverride,
234
+ transitionDuration: animationDuration,
235
+ onWillAppear: onWillAppear,
236
+ onWillDisappear: onWillDisappear,
237
+ onAppear: onAppear,
238
+ onDisappear: onDisappear,
239
+ onDismissed: onDismissed,
240
+ onGestureCancel: onGestureCancel,
241
+ onSheetDetentChanged: onSheetDetentChanged,
242
+ gestureResponseDistance: nativeGestureResponseDistance,
243
+ nativeBackButtonDismissalEnabled: false // on Android
244
+ ,
245
+ onHeaderBackButtonClicked: onHeaderBackButtonClicked,
246
+ preventNativeDismiss: isRemovePrevented // on iOS
247
+ ,
248
+ onNativeDismissCancelled: onNativeDismissCancelled
249
+ // Unfortunately, because of the bug that exists on Fabric, where native event drivers
250
+ // for Animated objects are being created after the first notifications about the header height
251
+ // from the native side, `onHeaderHeightChange` event does not notify
252
+ // `animatedHeaderHeight` about initial values on appearing screens at the moment.
253
+ ,
254
+ onHeaderHeightChange: Animated.event([{
255
+ nativeEvent: {
256
+ headerHeight: rawAnimatedHeaderHeight
257
+ }
258
+ }], {
259
+ useNativeDriver,
260
+ listener: e => {
261
+ if (hasCustomHeader) {
262
+ // If we have a custom header, don't use native header height
263
+ return;
264
+ }
265
+ if (Platform.OS === "android" && (options.headerBackground != null || options.headerTransparent)) {
266
+ // FIXME: On Android, we get 0 if the header is translucent
267
+ // So we set a default height in that case
268
+ setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
269
+ return;
270
+ }
271
+ if (e.nativeEvent && typeof e.nativeEvent === "object" && "headerHeight" in e.nativeEvent && typeof e.nativeEvent.headerHeight === "number") {
272
+ const headerHeight = e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
273
+
274
+ // Only debounce if header has large title or search bar
275
+ // As it's the only case where the header height can change frequently
276
+ const doesHeaderAnimate = Platform.OS === "ios" && (options.headerLargeTitle || options.headerSearchBarOptions);
277
+ if (doesHeaderAnimate) {
278
+ setHeaderHeightDebounced(headerHeight);
279
+ } else {
280
+ setHeaderHeight(headerHeight);
281
+ }
282
+ }
283
+ }
284
+ }),
285
+ contentStyle: [modifiedPresentation !== "transparentModal" && modifiedPresentation !== "containedTransparentModal" && {
286
+ backgroundColor: colors.background
287
+ }, contentStyle],
288
+ headerConfig: headerConfig,
289
+ unstable_sheetFooter: unstable_sheetFooter
290
+ // When ts-expect-error is added, it affects all the props below it
291
+ // So we keep any props that need it at the end
292
+ // Otherwise invalid props may not be caught by TypeScript
293
+ ,
294
+ shouldFreeze: shouldFreeze,
295
+ children: /*#__PURE__*/_jsx(AnimatedHeaderHeightContext.Provider, {
296
+ value: animatedHeaderHeight,
297
+ children: /*#__PURE__*/_jsxs(HeaderHeightContext.Provider, {
298
+ value: headerShown !== false ? headerHeight : parentHeaderHeight ?? 0,
299
+ children: [headerBackground != null ?
300
+ /*#__PURE__*/
301
+ /**
302
+ * To show a custom header background, we render it at the top of the screen below the header
303
+ * The header also needs to be positioned absolutely (with `translucent` style)
304
+ */
305
+ _jsx(View, {
306
+ style: [styles.background, headerTransparent ? styles.translucent : null, {
307
+ height: headerHeight
308
+ }],
309
+ children: headerBackground()
310
+ }) : null, header != null && headerShown !== false ? /*#__PURE__*/_jsx(View, {
311
+ onLayout: e => {
312
+ const headerHeight = e.nativeEvent.layout.height;
313
+ setHeaderHeight(headerHeight);
314
+ rawAnimatedHeaderHeight.setValue(headerHeight);
315
+ },
316
+ style: [styles.header, headerTransparent ? styles.absolute : null],
317
+ children: header({
318
+ back: headerBack,
319
+ options,
320
+ route,
321
+ navigation
322
+ })
323
+ }) : null, /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
324
+ value: isParentHeaderShown || headerShown !== false,
325
+ children: /*#__PURE__*/_jsx(HeaderBackContext.Provider, {
326
+ value: headerBack,
327
+ children: /*#__PURE__*/_jsx(KeysProvider, {
328
+ previous: previousDescriptor,
329
+ current: descriptor,
330
+ next: nextDescriptor,
331
+ children: /*#__PURE__*/_jsx(ScreenLifecycleController, {
332
+ children: /*#__PURE__*/_jsx(ScreenGestureProvider, {
333
+ children: /*#__PURE__*/_jsx(RootTransitionAware, {
334
+ children: render()
335
+ })
336
+ })
337
+ })
338
+ })
339
+ })
340
+ })]
341
+ })
342
+ })
343
+ }, route.key)
344
+ })
345
+ });
346
+ };
347
+ export function NativeStackView({
348
+ state,
349
+ navigation,
350
+ descriptors,
351
+ describe
352
+ }) {
353
+ const {
354
+ setNextDismissedKey
355
+ } = useDismissedRouteError(state);
356
+ useInvalidPreventRemoveError(descriptors);
357
+ const modalRouteKeys = getModalRouteKeys(state.routes, descriptors);
358
+ const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
359
+ acc[route.key] = acc[route.key] || describe(route, true);
360
+ return acc;
361
+ }, {});
362
+ return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
363
+ children: /*#__PURE__*/_jsx(ScreenStack, {
364
+ style: styles.container,
365
+ children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
366
+ const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
367
+ const isFocused = state.index === index;
368
+ const isBelowFocused = state.index - 1 === index;
369
+ const previousKey = state.routes[index - 1]?.key;
370
+ const nextKey = state.routes[index + 1]?.key;
371
+ const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
372
+ const nextDescriptor = nextKey ? descriptors[nextKey] : undefined;
373
+ const isModal = modalRouteKeys.includes(route.key);
374
+ const isPreloaded = preloadedDescriptors[route.key] !== undefined && descriptors[route.key] === undefined;
375
+
376
+ // On Fabric, when screen is frozen, animated and reanimated values are not updated
377
+ // due to component being unmounted. To avoid this, we don't freeze the previous screen there
378
+ const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused : !isPreloaded && !isFocused;
379
+ return /*#__PURE__*/_jsx(SceneView, {
380
+ index: index,
381
+ focused: isFocused,
382
+ shouldFreeze: shouldFreeze,
383
+ descriptor: descriptor,
384
+ previousDescriptor: previousDescriptor,
385
+ nextDescriptor: nextDescriptor,
386
+ isPresentationModal: isModal,
387
+ isPreloaded: isPreloaded,
388
+ onWillDisappear: () => {
389
+ navigation.emit({
390
+ type: "transitionStart",
391
+ data: {
392
+ closing: true
393
+ },
394
+ target: route.key
395
+ });
396
+ },
397
+ onWillAppear: () => {
398
+ navigation.emit({
399
+ type: "transitionStart",
400
+ data: {
401
+ closing: false
402
+ },
403
+ target: route.key
404
+ });
405
+ },
406
+ onAppear: () => {
407
+ navigation.emit({
408
+ type: "transitionEnd",
409
+ data: {
410
+ closing: false
411
+ },
412
+ target: route.key
413
+ });
414
+ },
415
+ onDisappear: () => {
416
+ navigation.emit({
417
+ type: "transitionEnd",
418
+ data: {
419
+ closing: true
420
+ },
421
+ target: route.key
422
+ });
423
+ },
424
+ onDismissed: event => {
425
+ navigation.dispatch({
426
+ ...StackActions.pop(event.nativeEvent.dismissCount),
427
+ source: route.key,
428
+ target: state.key
429
+ });
430
+ setNextDismissedKey(route.key);
431
+ },
432
+ onHeaderBackButtonClicked: () => {
433
+ navigation.dispatch({
434
+ ...StackActions.pop(),
435
+ source: route.key,
436
+ target: state.key
437
+ });
438
+ },
439
+ onNativeDismissCancelled: event => {
440
+ navigation.dispatch({
441
+ ...StackActions.pop(event.nativeEvent.dismissCount),
442
+ source: route.key,
443
+ target: state.key
444
+ });
445
+ },
446
+ onGestureCancel: () => {
447
+ navigation.emit({
448
+ type: "gestureCancel",
449
+ target: route.key
450
+ });
451
+ },
452
+ onSheetDetentChanged: event => {
453
+ navigation.emit({
454
+ type: "sheetDetentChange",
455
+ target: route.key,
456
+ data: {
457
+ index: event.nativeEvent.index,
458
+ stable: event.nativeEvent.isStable
459
+ }
460
+ });
461
+ }
462
+ }, route.key);
463
+ })
464
+ })
465
+ });
466
+ }
467
+ const styles = StyleSheet.create({
468
+ container: {
469
+ flex: 1
470
+ },
471
+ header: {
472
+ zIndex: 1
473
+ },
474
+ absolute: {
475
+ position: "absolute",
476
+ top: 0,
477
+ start: 0,
478
+ end: 0
479
+ },
480
+ translucent: {
481
+ position: "absolute",
482
+ top: 0,
483
+ start: 0,
484
+ end: 0,
485
+ zIndex: 1,
486
+ elevation: 1
487
+ },
488
+ background: {
489
+ overflow: "hidden"
490
+ }
491
+ });
492
+ //# sourceMappingURL=NativeStackView.native.js.map