react-native-screen-transitions 2.4.0 → 2.4.2-beta.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 (270) hide show
  1. package/lib/commonjs/__configs__/presets.js.map +1 -1
  2. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  3. package/lib/commonjs/constants.js.map +1 -1
  4. package/lib/commonjs/hooks/animation/use-screen-animation.js +9 -5
  5. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  6. package/lib/commonjs/index.js +7 -0
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/integrations/blank-stack/components/Header.js +142 -0
  9. package/lib/commonjs/integrations/blank-stack/components/Header.js.map +1 -0
  10. package/lib/commonjs/integrations/blank-stack/components/Screens.js +64 -0
  11. package/lib/commonjs/integrations/blank-stack/components/Screens.js.map +1 -0
  12. package/lib/commonjs/integrations/blank-stack/components/StackView.js +94 -0
  13. package/lib/commonjs/integrations/blank-stack/components/StackView.js.map +1 -0
  14. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js +74 -0
  15. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  16. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +66 -0
  17. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  18. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +16 -0
  19. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  20. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +208 -0
  21. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  22. package/lib/commonjs/{types/navigator.js → integrations/blank-stack/utils/with-stack-navigation/_types.js} +1 -1
  23. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  24. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +15 -0
  25. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  26. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +23 -0
  27. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
  28. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +15 -0
  29. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  30. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +14 -0
  31. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  32. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +13 -0
  33. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  34. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js +71 -0
  35. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  36. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  37. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  38. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  39. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -1
  40. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  41. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  42. package/lib/commonjs/providers/keys.js.map +1 -1
  43. package/lib/commonjs/providers/screen-transition-provider.js.map +1 -1
  44. package/lib/commonjs/providers/transition-styles.js +18 -4
  45. package/lib/commonjs/providers/transition-styles.js.map +1 -1
  46. package/lib/commonjs/stores/animations.js.map +1 -1
  47. package/lib/commonjs/stores/bounds/index.js.map +1 -1
  48. package/lib/commonjs/stores/gestures.js.map +1 -1
  49. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  50. package/lib/commonjs/types/blank-stack.navigator.js +6 -0
  51. package/lib/commonjs/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
  52. package/lib/commonjs/types/native-stack.navigator.js +6 -0
  53. package/lib/commonjs/types/native-stack.navigator.js.map +1 -0
  54. package/lib/commonjs/utils/animation/derivations.js +1 -14
  55. package/lib/commonjs/utils/animation/derivations.js.map +1 -1
  56. package/lib/commonjs/utils/bounds/_utils/styles.js.map +1 -1
  57. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  58. package/lib/commonjs/utils/bounds/index.js +23 -90
  59. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  60. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -1
  61. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -1
  62. package/lib/commonjs/utils/gesture/reset-gesture-values.js.map +1 -1
  63. package/lib/commonjs/utils/gesture/velocity.js +2 -2
  64. package/lib/commonjs/utils/gesture/velocity.js.map +1 -1
  65. package/lib/module/__configs__/presets.js.map +1 -1
  66. package/lib/module/components/root-transition-aware.js.map +1 -1
  67. package/lib/module/constants.js.map +1 -1
  68. package/lib/module/hooks/animation/use-screen-animation.js +9 -5
  69. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  70. package/lib/module/index.js +1 -0
  71. package/lib/module/index.js.map +1 -1
  72. package/lib/module/integrations/blank-stack/components/Header.js +138 -0
  73. package/lib/module/integrations/blank-stack/components/Header.js.map +1 -0
  74. package/lib/module/integrations/blank-stack/components/Screens.js +58 -0
  75. package/lib/module/integrations/blank-stack/components/Screens.js.map +1 -0
  76. package/lib/module/integrations/blank-stack/components/StackView.js +90 -0
  77. package/lib/module/integrations/blank-stack/components/StackView.js.map +1 -0
  78. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js +68 -0
  79. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  80. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +60 -0
  81. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  82. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +11 -0
  83. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  84. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +202 -0
  85. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  86. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js +4 -0
  87. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  88. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +10 -0
  89. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  90. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +19 -0
  91. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
  92. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +10 -0
  93. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  94. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +9 -0
  95. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  96. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +8 -0
  97. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  98. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js +65 -0
  99. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  100. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  101. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  102. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  103. package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -1
  104. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  105. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  106. package/lib/module/providers/keys.js.map +1 -1
  107. package/lib/module/providers/screen-transition-provider.js.map +1 -1
  108. package/lib/module/providers/transition-styles.js +19 -5
  109. package/lib/module/providers/transition-styles.js.map +1 -1
  110. package/lib/module/stores/animations.js.map +1 -1
  111. package/lib/module/stores/bounds/index.js.map +1 -1
  112. package/lib/module/stores/gestures.js.map +1 -1
  113. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  114. package/lib/module/types/blank-stack.navigator.js +4 -0
  115. package/lib/module/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
  116. package/lib/module/types/native-stack.navigator.js +4 -0
  117. package/lib/module/types/native-stack.navigator.js.map +1 -0
  118. package/lib/module/utils/animation/derivations.js +1 -14
  119. package/lib/module/utils/animation/derivations.js.map +1 -1
  120. package/lib/module/utils/bounds/_utils/styles.js.map +1 -1
  121. package/lib/module/utils/bounds/constants.js.map +1 -1
  122. package/lib/module/utils/bounds/index.js +24 -91
  123. package/lib/module/utils/bounds/index.js.map +1 -1
  124. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -1
  125. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -1
  126. package/lib/module/utils/gesture/reset-gesture-values.js.map +1 -1
  127. package/lib/module/utils/gesture/velocity.js +2 -2
  128. package/lib/module/utils/gesture/velocity.js.map +1 -1
  129. package/lib/typescript/__configs__/index.d.ts +9 -9
  130. package/lib/typescript/__configs__/index.d.ts.map +1 -1
  131. package/lib/typescript/__configs__/presets.d.ts +1 -1
  132. package/lib/typescript/__configs__/presets.d.ts.map +1 -1
  133. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  134. package/lib/typescript/constants.d.ts +2 -2
  135. package/lib/typescript/constants.d.ts.map +1 -1
  136. package/lib/typescript/hooks/animation/use-screen-animation.d.ts +1 -1
  137. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  138. package/lib/typescript/index.d.ts +20 -18
  139. package/lib/typescript/index.d.ts.map +1 -1
  140. package/lib/typescript/integrations/blank-stack/components/Header.d.ts +5 -0
  141. package/lib/typescript/integrations/blank-stack/components/Header.d.ts.map +1 -0
  142. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts +15 -0
  143. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts.map +1 -0
  144. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts +2 -0
  145. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts.map +1 -0
  146. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts +109 -0
  147. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts.map +1 -0
  148. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts +8 -0
  149. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts.map +1 -0
  150. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts +2 -0
  151. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts.map +1 -0
  152. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts +20 -0
  153. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts.map +1 -0
  154. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts +23 -0
  155. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts.map +1 -0
  156. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts +3 -0
  157. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts.map +1 -0
  158. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts +4 -0
  159. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts.map +1 -0
  160. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts +4 -0
  161. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts.map +1 -0
  162. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts +3 -0
  163. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts.map +1 -0
  164. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts +3 -0
  165. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts.map +1 -0
  166. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts +6 -0
  167. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts.map +1 -0
  168. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +1 -1
  169. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
  170. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +1 -1
  171. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -1
  172. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +1 -1
  173. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -1
  174. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +1 -1
  175. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -1
  176. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +1 -1
  177. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  178. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +1 -1
  179. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
  180. package/lib/typescript/providers/keys.d.ts +1 -1
  181. package/lib/typescript/providers/keys.d.ts.map +1 -1
  182. package/lib/typescript/providers/screen-transition-provider.d.ts +1 -1
  183. package/lib/typescript/providers/screen-transition-provider.d.ts.map +1 -1
  184. package/lib/typescript/providers/transition-styles.d.ts.map +1 -1
  185. package/lib/typescript/stores/animations.d.ts +1 -1
  186. package/lib/typescript/stores/animations.d.ts.map +1 -1
  187. package/lib/typescript/stores/bounds/index.d.ts +1 -1
  188. package/lib/typescript/stores/bounds/index.d.ts.map +1 -1
  189. package/lib/typescript/stores/gestures.d.ts +1 -1
  190. package/lib/typescript/stores/gestures.d.ts.map +1 -1
  191. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +1 -1
  192. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  193. package/lib/typescript/types/animation.d.ts +2 -4
  194. package/lib/typescript/types/animation.d.ts.map +1 -1
  195. package/lib/typescript/types/blank-stack.navigator.d.ts +219 -0
  196. package/lib/typescript/types/blank-stack.navigator.d.ts.map +1 -0
  197. package/lib/typescript/types/bounds.d.ts +0 -57
  198. package/lib/typescript/types/bounds.d.ts.map +1 -1
  199. package/lib/typescript/types/{navigator.d.ts → native-stack.navigator.d.ts} +5 -1
  200. package/lib/typescript/types/native-stack.navigator.d.ts.map +1 -0
  201. package/lib/typescript/types/utils.d.ts.map +1 -1
  202. package/lib/typescript/utils/animation/derivations.d.ts +1 -4
  203. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -1
  204. package/lib/typescript/utils/bounds/_types/builder.d.ts +2 -2
  205. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  206. package/lib/typescript/utils/bounds/_utils/geometry.d.ts +2 -2
  207. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -1
  208. package/lib/typescript/utils/bounds/_utils/styles.d.ts +2 -1
  209. package/lib/typescript/utils/bounds/_utils/styles.d.ts.map +1 -1
  210. package/lib/typescript/utils/bounds/constants.d.ts +2 -2
  211. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  212. package/lib/typescript/utils/bounds/index.d.ts +4 -4
  213. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  214. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +2 -2
  215. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -1
  216. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +2 -2
  217. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -1
  218. package/lib/typescript/utils/gesture/reset-gesture-values.d.ts.map +1 -1
  219. package/lib/typescript/utils/gesture/velocity.d.ts +1 -1
  220. package/lib/typescript/utils/gesture/velocity.d.ts.map +1 -1
  221. package/package.json +1 -1
  222. package/src/__configs__/presets.ts +590 -590
  223. package/src/components/root-transition-aware.tsx +27 -27
  224. package/src/constants.ts +47 -47
  225. package/src/hooks/animation/use-screen-animation.tsx +52 -47
  226. package/src/index.ts +33 -22
  227. package/src/integrations/blank-stack/components/Header.tsx +143 -0
  228. package/src/integrations/blank-stack/components/Screens.tsx +96 -0
  229. package/src/integrations/blank-stack/components/StackView.tsx +106 -0
  230. package/src/integrations/blank-stack/navigators/createBlankStackNavigator.tsx +122 -0
  231. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.tsx +62 -0
  232. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.tsx +11 -0
  233. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.tsx +280 -0
  234. package/src/integrations/blank-stack/utils/with-stack-navigation/_types.ts +36 -0
  235. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.ts +15 -0
  236. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.ts +29 -0
  237. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.ts +17 -0
  238. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.ts +12 -0
  239. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.ts +11 -0
  240. package/src/integrations/blank-stack/utils/with-stack-navigation/index.tsx +93 -0
  241. package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +95 -95
  242. package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +14 -14
  243. package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +23 -23
  244. package/src/integrations/native-stack/views/NativeStackView.native.tsx +608 -608
  245. package/src/integrations/native-stack/views/NativeStackView.tsx +188 -188
  246. package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +260 -260
  247. package/src/providers/keys.tsx +22 -22
  248. package/src/providers/screen-transition-provider.tsx +20 -20
  249. package/src/providers/transition-styles.tsx +24 -11
  250. package/src/stores/animations.ts +23 -23
  251. package/src/stores/bounds/index.ts +82 -82
  252. package/src/stores/gestures.ts +36 -36
  253. package/src/stores/utils/reset-stores-for-screen.ts +4 -4
  254. package/src/types/animation.ts +2 -4
  255. package/src/types/blank-stack.navigator.ts +271 -0
  256. package/src/types/bounds.ts +0 -64
  257. package/src/types/{navigator.ts → native-stack.navigator.ts} +5 -0
  258. package/src/types/utils.ts +1 -0
  259. package/src/utils/animation/derivations.ts +3 -20
  260. package/src/utils/bounds/_types/builder.ts +111 -111
  261. package/src/utils/bounds/_utils/geometry.ts +2 -2
  262. package/src/utils/bounds/_utils/styles.ts +2 -1
  263. package/src/utils/bounds/constants.ts +29 -29
  264. package/src/utils/bounds/index.ts +35 -105
  265. package/src/utils/gesture/apply-offset-rules.ts +271 -271
  266. package/src/utils/gesture/check-gesture-activation.ts +260 -260
  267. package/src/utils/gesture/reset-gesture-values.ts +1 -0
  268. package/src/utils/gesture/velocity.ts +1 -2
  269. package/lib/module/types/navigator.js +0 -4
  270. package/lib/typescript/types/navigator.d.ts.map +0 -1
@@ -0,0 +1,106 @@
1
+ import { SafeAreaProviderCompat } from "@react-navigation/elements";
2
+ import {
3
+ NavigationContext,
4
+ NavigationRouteContext,
5
+ } from "@react-navigation/native";
6
+ import { GestureHandlerRootView } from "react-native-gesture-handler";
7
+ import { ScreenContainer } from "react-native-screens";
8
+ import { RootTransitionAware } from "../../../components/root-transition-aware";
9
+ import { ScreenTransitionProvider } from "../../../providers/screen-transition-provider";
10
+ import type { BlankStackDescriptor } from "../../../types/blank-stack.navigator";
11
+ import { withStackNavigationProvider } from "../utils/with-stack-navigation";
12
+ import { Header } from "./Header";
13
+ import { Screen } from "./Screens";
14
+
15
+ function isFabric() {
16
+ return "nativeFabricUIManager" in global;
17
+ }
18
+
19
+ type SceneViewProps = {
20
+ descriptor: BlankStackDescriptor;
21
+ isFocused: boolean;
22
+ sceneIndex: number;
23
+ };
24
+
25
+ const SceneView = ({ descriptor }: SceneViewProps) => {
26
+ const { route, navigation, render } = descriptor;
27
+
28
+ return (
29
+ <NavigationContext.Provider value={navigation}>
30
+ <NavigationRouteContext.Provider value={route}>
31
+ <RootTransitionAware>
32
+ {descriptor.options.headerMode === "screen" && <Header.Screen />}
33
+ {render()}
34
+ </RootTransitionAware>
35
+ </NavigationRouteContext.Provider>
36
+ </NavigationContext.Provider>
37
+ );
38
+ };
39
+
40
+ export const StackView = withStackNavigationProvider(
41
+ ({
42
+ activeScreensLimit,
43
+ descriptors,
44
+ FloatHeader,
45
+ focusedIndex,
46
+ routes,
47
+ scenes,
48
+ }) => {
49
+ return (
50
+ <GestureHandlerRootView>
51
+ <SafeAreaProviderCompat>
52
+ <FloatHeader />
53
+ <ScreenContainer style={{ flex: 1 }}>
54
+ {scenes.map((scene, sceneIndex) => {
55
+ const descriptor = scene.descriptor;
56
+ const route = scene.route;
57
+ const isFocused = focusedIndex === sceneIndex;
58
+ const isBelowFocused = focusedIndex - 1 === sceneIndex;
59
+
60
+ const previousDescriptor =
61
+ scenes[sceneIndex - 1]?.descriptor ?? undefined;
62
+ const nextDescriptor =
63
+ scenes[sceneIndex + 1]?.descriptor ?? undefined;
64
+
65
+ const isPreloaded = descriptors[route.key] === undefined;
66
+
67
+ // On Fabric, when screen is frozen, animated and reanimated values are not updated
68
+ // due to component being unmounted. To avoid this, we don't freeze the previous screen there
69
+ const shouldFreeze = isFabric()
70
+ ? !isPreloaded && !isFocused && !isBelowFocused
71
+ : !isPreloaded && !isFocused;
72
+ return (
73
+ <Screen
74
+ key={route.key}
75
+ isPreloaded={isPreloaded}
76
+ index={sceneIndex}
77
+ activeScreensLimit={activeScreensLimit}
78
+ routeKey={route.key}
79
+ routes={routes}
80
+ shouldFreeze={shouldFreeze}
81
+ freezeOnBlur={descriptor.options.freezeOnBlur}
82
+ >
83
+ <ScreenTransitionProvider
84
+ // @ts-expect-error
85
+ previous={previousDescriptor}
86
+ // @ts-expect-error
87
+ current={descriptor}
88
+ // @ts-expect-error
89
+ next={nextDescriptor}
90
+ >
91
+ <SceneView
92
+ key={route.key}
93
+ isFocused={isFocused}
94
+ sceneIndex={sceneIndex}
95
+ descriptor={descriptor}
96
+ />
97
+ </ScreenTransitionProvider>
98
+ </Screen>
99
+ );
100
+ })}
101
+ </ScreenContainer>
102
+ </SafeAreaProviderCompat>
103
+ </GestureHandlerRootView>
104
+ );
105
+ }
106
+ );
@@ -0,0 +1,122 @@
1
+ import {
2
+ createNavigatorFactory,
3
+ type EventArg,
4
+ type NavigatorTypeBagBase,
5
+ type ParamListBase,
6
+ type StackActionHelpers,
7
+ StackActions,
8
+ type StackNavigationState,
9
+ StackRouter,
10
+ type StackRouterOptions,
11
+ type StaticConfig,
12
+ type TypedNavigator,
13
+ useNavigationBuilder,
14
+ } from "@react-navigation/native";
15
+ import * as React from "react";
16
+ import { StackView } from "../components/StackView";
17
+ import type {
18
+ BlankStackNavigationEventMap,
19
+ BlankStackNavigationOptions,
20
+ BlankStackNavigationProp,
21
+ BlankStackNavigatorProps,
22
+ } from "../../../types/blank-stack.navigator";
23
+
24
+ function BlankStackNavigator({
25
+ id,
26
+ initialRouteName,
27
+ children,
28
+ layout,
29
+ screenListeners,
30
+ screenOptions,
31
+ screenLayout,
32
+ ...rest
33
+ }: BlankStackNavigatorProps) {
34
+ const { state, describe, descriptors, navigation, NavigationContent } =
35
+ useNavigationBuilder<
36
+ StackNavigationState<ParamListBase>,
37
+ StackRouterOptions,
38
+ StackActionHelpers<ParamListBase>,
39
+ BlankStackNavigationOptions,
40
+ BlankStackNavigationEventMap
41
+ >(StackRouter, {
42
+ id,
43
+ initialRouteName,
44
+ children,
45
+ layout,
46
+ screenListeners,
47
+ screenOptions,
48
+ screenLayout,
49
+ });
50
+
51
+ React.useEffect(
52
+ () =>
53
+ // @ts-expect-error: there may not be a tab navigator in parent
54
+ navigation?.addListener?.("tabPress", (e: any) => {
55
+ const isFocused = navigation.isFocused();
56
+
57
+ // Run the operation in the next frame so we're sure all listeners have been run
58
+ // This is necessary to know if preventDefault() has been called
59
+ requestAnimationFrame(() => {
60
+ if (
61
+ state.index > 0 &&
62
+ isFocused &&
63
+ !(e as EventArg<"tabPress", true>).defaultPrevented
64
+ ) {
65
+ // When user taps on already focused tab and we're inside the tab,
66
+ // reset the stack to replicate native behaviour
67
+ navigation.dispatch({
68
+ ...StackActions.popToTop(),
69
+ target: state.key,
70
+ });
71
+ }
72
+ });
73
+ }),
74
+ [navigation, state.index, state.key]
75
+ );
76
+
77
+ return (
78
+ <NavigationContent>
79
+ <StackView
80
+ {...rest}
81
+ state={state}
82
+ navigation={navigation}
83
+ descriptors={descriptors}
84
+ describe={describe}
85
+ />
86
+ </NavigationContent>
87
+ );
88
+ }
89
+
90
+ export function createBlankStackNavigator<
91
+ const ParamList extends ParamListBase,
92
+ const NavigatorID extends string | undefined = undefined,
93
+ const TypeBag extends NavigatorTypeBagBase = {
94
+ ParamList: ParamList;
95
+ NavigatorID: NavigatorID;
96
+ State: StackNavigationState<ParamList>;
97
+ ScreenOptions: BlankStackNavigationOptions;
98
+ EventMap: BlankStackNavigationEventMap;
99
+ NavigationList: {
100
+ [RouteName in keyof ParamList]: BlankStackNavigationProp<
101
+ ParamList,
102
+ RouteName,
103
+ NavigatorID
104
+ >;
105
+ };
106
+ Navigator: typeof BlankStackNavigator;
107
+ },
108
+ const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>
109
+ >(config?: Config): TypedNavigator<TypeBag, Config> {
110
+ return createNavigatorFactory(BlankStackNavigator)(config);
111
+ }
112
+
113
+ import { withLayoutContext } from "expo-router";
114
+
115
+ const { Navigator } = createBlankStackNavigator();
116
+
117
+ export const BlankStack = withLayoutContext<
118
+ BlankStackNavigationOptions,
119
+ typeof Navigator,
120
+ StackNavigationState<ParamListBase>,
121
+ BlankStackNavigationEventMap
122
+ >(Navigator);
@@ -0,0 +1,62 @@
1
+ import { useRef } from "react";
2
+ import { useSharedValue } from "react-native-reanimated";
3
+ import useStableCallback from "../../../../../hooks/use-stable-callback";
4
+
5
+ export const useClosingRouteKeys = () => {
6
+ const keysRef = useRef<Set<string>>(new Set());
7
+ const shared = useSharedValue<string[]>([]);
8
+
9
+ const add = useStableCallback((key: string) => {
10
+ const keys = keysRef.current;
11
+ if (keys.has(key)) {
12
+ return;
13
+ }
14
+
15
+ keys.add(key);
16
+ shared.modify((prev) => {
17
+ "worklet";
18
+ if (!prev.includes(key)) {
19
+ prev.push(key);
20
+ }
21
+ return prev;
22
+ });
23
+ });
24
+
25
+ const remove = useStableCallback((key: string) => {
26
+ const keys = keysRef.current;
27
+ if (!keys.delete(key)) {
28
+ return;
29
+ }
30
+
31
+ shared.modify((prev) => {
32
+ "worklet";
33
+ const index = prev.indexOf(key);
34
+ if (index !== -1) {
35
+ prev.splice(index, 1);
36
+ }
37
+ return prev;
38
+ });
39
+ });
40
+
41
+ const clear = useStableCallback(() => {
42
+ const keys = keysRef.current;
43
+ if (!keys.size) {
44
+ return;
45
+ }
46
+
47
+ keys.clear();
48
+ shared.modify((prev) => {
49
+ "worklet";
50
+ prev.length = 0;
51
+ return prev;
52
+ });
53
+ });
54
+
55
+ return {
56
+ ref: keysRef,
57
+ shared,
58
+ add,
59
+ remove,
60
+ clear,
61
+ };
62
+ };
@@ -0,0 +1,11 @@
1
+ import { useEffect, useRef } from "react";
2
+
3
+ export const usePrevious = <T,>(value: T): T | null => {
4
+ const ref = useRef<T>(null);
5
+
6
+ useEffect(() => {
7
+ ref.current = value;
8
+ });
9
+
10
+ return ref.current;
11
+ };
@@ -0,0 +1,280 @@
1
+ import { type Route, StackActions } from "@react-navigation/native";
2
+ import { useLayoutEffect, useState } from "react";
3
+ import useStableCallback from "../../../../../hooks/use-stable-callback";
4
+ import type { BlankStackDescriptorMap } from "../../../../../types/blank-stack.navigator";
5
+ import type { StackNavigationContextProps } from "../_types";
6
+ import { areDescriptorsEqual } from "../_utils/are-descriptors-equal";
7
+ import { composeDescriptors } from "../_utils/compose-descriptors";
8
+ import { haveSameRouteKeys } from "../_utils/have-same-route-keys";
9
+ import { routesAreIdentical } from "../_utils/routes-are-identical";
10
+ import { useClosingRouteKeys } from "./use-closing-route-keys";
11
+ import { usePrevious } from "./use-previous";
12
+
13
+ type SyncRoutesWithRemovedParams = {
14
+ prevRoutes: Route<string>[];
15
+ prevDescriptors: BlankStackDescriptorMap;
16
+ nextRoutes: Route<string>[];
17
+ nextDescriptors: BlankStackDescriptorMap;
18
+ closingRouteKeys: ReturnType<typeof useClosingRouteKeys>;
19
+ };
20
+
21
+ /**
22
+ * Aligns current routes with the latest route data while preserving references
23
+ * when possible for performance optimization
24
+ */
25
+ const alignRoutesWithLatest = (
26
+ currentRoutes: Route<string>[],
27
+ currentDescriptors: BlankStackDescriptorMap,
28
+ nextRoutes: Route<string>[],
29
+ nextDescriptors: BlankStackDescriptorMap
30
+ ) => {
31
+ // Early return for empty current routes
32
+ if (currentRoutes.length === 0) {
33
+ return {
34
+ routes: nextRoutes,
35
+ descriptors: composeDescriptors(
36
+ nextRoutes,
37
+ nextDescriptors,
38
+ currentDescriptors
39
+ ),
40
+ };
41
+ }
42
+
43
+ // Create lookup map for efficient route finding
44
+ const nextRouteLookup = new Map<string, Route<string>>();
45
+ for (const route of nextRoutes) {
46
+ nextRouteLookup.set(route.key, route);
47
+ }
48
+
49
+ // Track if any changes occurred
50
+ let didChange = currentRoutes.length !== nextRoutes.length;
51
+
52
+ // Align routes, updating references where needed
53
+ const alignedRoutes = currentRoutes.map((route) => {
54
+ const nextRoute = nextRouteLookup.get(route.key);
55
+
56
+ if (!nextRoute) {
57
+ return route; // Keep current route if not in next
58
+ }
59
+
60
+ if (nextRoute !== route) {
61
+ didChange = true;
62
+ return nextRoute; // Update to new route reference
63
+ }
64
+
65
+ return route; // Keep current route reference
66
+ });
67
+
68
+ // Only create new array if changes occurred
69
+ const routesResult = didChange ? alignedRoutes : currentRoutes;
70
+
71
+ return {
72
+ routes: routesResult,
73
+ descriptors: composeDescriptors(
74
+ routesResult,
75
+ nextDescriptors,
76
+ currentDescriptors
77
+ ),
78
+ };
79
+ };
80
+
81
+ /**
82
+ * Synchronizes routes while handling removed routes that may still be animating out.
83
+ * This manages the complex logic of keeping closing routes visible during transitions.
84
+ */
85
+ const syncRoutesWithRemoved = ({
86
+ prevRoutes,
87
+ prevDescriptors,
88
+ nextRoutes,
89
+ nextDescriptors,
90
+ closingRouteKeys,
91
+ }: SyncRoutesWithRemovedParams) => {
92
+ if (nextRoutes.length === 0) {
93
+ closingRouteKeys.clear();
94
+ return {
95
+ routes: nextRoutes,
96
+ descriptors: {},
97
+ };
98
+ }
99
+
100
+ // Start with next routes, will mutate if needed
101
+ let derivedRoutes: Route<string>[] = nextRoutes;
102
+ let mutated = false;
103
+
104
+ // Helper to ensure we're working with a mutable copy
105
+ const ensureMutable = () => {
106
+ if (!mutated) {
107
+ derivedRoutes = derivedRoutes.slice();
108
+ mutated = true;
109
+ }
110
+ };
111
+
112
+ // Get focused (last) routes for comparison
113
+ const previousFocusedRoute = prevRoutes[prevRoutes.length - 1];
114
+ const nextFocusedRoute = nextRoutes[nextRoutes.length - 1];
115
+
116
+ // Handle focus changes between routes
117
+ if (
118
+ previousFocusedRoute &&
119
+ nextFocusedRoute &&
120
+ previousFocusedRoute.key !== nextFocusedRoute.key
121
+ ) {
122
+ const nextRouteWasPresent = prevRoutes.some(
123
+ (route) => route.key === nextFocusedRoute.key
124
+ );
125
+ const previousRouteStillPresent = nextRoutes.some(
126
+ (route) => route.key === previousFocusedRoute.key
127
+ );
128
+
129
+ if (nextRouteWasPresent && !previousRouteStillPresent) {
130
+ // Previous route was removed, mark as closing
131
+ closingRouteKeys.add(previousFocusedRoute.key);
132
+
133
+ ensureMutable();
134
+ derivedRoutes.push(previousFocusedRoute);
135
+ } else {
136
+ // Next route is now active, not closing
137
+ closingRouteKeys.remove(nextFocusedRoute.key);
138
+
139
+ if (!previousRouteStillPresent) {
140
+ // Previous route needs to be inserted for transition
141
+ closingRouteKeys.remove(previousFocusedRoute.key);
142
+
143
+ ensureMutable();
144
+ const insertIndex = Math.max(derivedRoutes.length - 1, 0);
145
+ derivedRoutes.splice(insertIndex, 0, previousFocusedRoute);
146
+ }
147
+ }
148
+ } else if (nextFocusedRoute) {
149
+ // Same focused route, ensure it's not marked as closing
150
+ closingRouteKeys.remove(nextFocusedRoute.key);
151
+ }
152
+
153
+ // Clean up closing keys that are no longer in the route list
154
+ const activeKeys = new Set(derivedRoutes.map((route) => route.key));
155
+ for (const key of Array.from(closingRouteKeys.ref.current)) {
156
+ if (!activeKeys.has(key)) {
157
+ closingRouteKeys.remove(key);
158
+ }
159
+ }
160
+
161
+ const routesResult = mutated ? derivedRoutes : nextRoutes;
162
+
163
+ return {
164
+ routes: routesResult,
165
+ descriptors: composeDescriptors(
166
+ routesResult,
167
+ nextDescriptors,
168
+ prevDescriptors
169
+ ),
170
+ };
171
+ };
172
+
173
+ export const useStackNavigationState = (props: StackNavigationContextProps) => {
174
+ const previousRoutes = usePrevious(props.state.routes) ?? [];
175
+ const closingRouteKeys = useClosingRouteKeys();
176
+
177
+ const [localState, setLocalState] = useState(() => ({
178
+ routes: props.state.routes,
179
+ descriptors: props.descriptors,
180
+ }));
181
+
182
+ useLayoutEffect(() => {
183
+ const nextRoutesSnapshot = props.state.routes;
184
+ const previousRoutesSnapshot = previousRoutes;
185
+
186
+ setLocalState((current) => {
187
+ const routeKeysUnchanged = haveSameRouteKeys(
188
+ previousRoutesSnapshot,
189
+ nextRoutesSnapshot
190
+ );
191
+
192
+ let derivedRoutes: Route<string>[];
193
+ let derivedDescriptors: BlankStackDescriptorMap;
194
+
195
+ if (routeKeysUnchanged) {
196
+ const result = alignRoutesWithLatest(
197
+ current.routes,
198
+ current.descriptors,
199
+ nextRoutesSnapshot,
200
+ props.descriptors
201
+ );
202
+
203
+ derivedRoutes = result.routes;
204
+ derivedDescriptors = result.descriptors;
205
+ } else {
206
+ const fallbackRoutes =
207
+ previousRoutesSnapshot.length > 0
208
+ ? previousRoutesSnapshot
209
+ : current.routes;
210
+
211
+ const result = syncRoutesWithRemoved({
212
+ prevRoutes: fallbackRoutes,
213
+ prevDescriptors: current.descriptors,
214
+ nextRoutes: nextRoutesSnapshot,
215
+ nextDescriptors: props.descriptors,
216
+ closingRouteKeys,
217
+ });
218
+
219
+ derivedRoutes = result.routes;
220
+ derivedDescriptors = result.descriptors;
221
+ }
222
+
223
+ const routesChanged = !routesAreIdentical(current.routes, derivedRoutes);
224
+ const descriptorsChanged = !areDescriptorsEqual(
225
+ current.descriptors,
226
+ derivedDescriptors
227
+ );
228
+
229
+ if (!routesChanged && !descriptorsChanged) {
230
+ return current;
231
+ }
232
+
233
+ return {
234
+ routes: routesChanged ? derivedRoutes : current.routes,
235
+ descriptors: descriptorsChanged
236
+ ? derivedDescriptors
237
+ : current.descriptors,
238
+ };
239
+ });
240
+ }, [props.state.routes, props.descriptors, previousRoutes, closingRouteKeys]);
241
+
242
+ const handleCloseRoute = useStableCallback(
243
+ ({ route }: { route: Route<string> }) => {
244
+ if (props.state.routes.some((r) => r.key === route.key)) {
245
+ props.navigation.dispatch({
246
+ ...StackActions.pop(),
247
+ source: route.key,
248
+ target: props.state.key,
249
+ });
250
+ return;
251
+ }
252
+
253
+ closingRouteKeys.remove(route.key);
254
+
255
+ setLocalState((current) => {
256
+ if (!current.routes.some((candidate) => candidate.key === route.key)) {
257
+ return current;
258
+ }
259
+
260
+ const nextRoutes = current.routes.filter(
261
+ (candidate) => candidate.key !== route.key
262
+ );
263
+
264
+ const nextDescriptors = { ...current.descriptors };
265
+ delete nextDescriptors[route.key];
266
+
267
+ return {
268
+ routes: nextRoutes,
269
+ descriptors: nextDescriptors,
270
+ };
271
+ });
272
+ }
273
+ );
274
+
275
+ return {
276
+ state: localState,
277
+ handleCloseRoute,
278
+ closingRouteKeys,
279
+ };
280
+ };
@@ -0,0 +1,36 @@
1
+ import type {
2
+ NavigationRoute,
3
+ ParamListBase,
4
+ Route,
5
+ RouteProp,
6
+ StackNavigationState,
7
+ } from "@react-navigation/native";
8
+ import type React from "react";
9
+ import type { SharedValue } from "react-native-reanimated";
10
+ import type {
11
+ BlankStackDescriptor,
12
+ BlankStackDescriptorMap,
13
+ BlankStackNavigationHelpers,
14
+ BlankStackScene,
15
+ } from "../../../../types/blank-stack.navigator";
16
+
17
+ export interface StackNavigationContextValue {
18
+ routes: NavigationRoute<ParamListBase, string>[];
19
+ descriptors: BlankStackDescriptorMap;
20
+ scenes: BlankStackScene[];
21
+ activeScreensLimit: number;
22
+ closingRouteKeysShared: SharedValue<string[]>;
23
+ handleCloseRoute: (payload: { route: Route<string> }) => void;
24
+ FloatHeader: React.MemoExoticComponent<() => React.JSX.Element | null>;
25
+ focusedIndex: number;
26
+ }
27
+
28
+ export interface StackNavigationContextProps {
29
+ state: StackNavigationState<ParamListBase>;
30
+ navigation: BlankStackNavigationHelpers;
31
+ descriptors: BlankStackDescriptorMap;
32
+ describe: (
33
+ route: RouteProp<ParamListBase>,
34
+ placeholder: boolean
35
+ ) => BlankStackDescriptor;
36
+ }
@@ -0,0 +1,15 @@
1
+ import type { BlankStackDescriptorMap } from "../../../../../types/blank-stack.navigator";
2
+
3
+ export const areDescriptorsEqual = (
4
+ a: BlankStackDescriptorMap,
5
+ b: BlankStackDescriptorMap
6
+ ): boolean => {
7
+ if (a === b) return true;
8
+
9
+ const aKeys = Object.keys(a);
10
+ const bKeys = Object.keys(b);
11
+
12
+ if (aKeys.length !== bKeys.length) return false;
13
+
14
+ return aKeys.every((key) => a[key] === b[key]);
15
+ };
@@ -0,0 +1,29 @@
1
+ import type { NavigationRoute, ParamListBase } from "@react-navigation/native";
2
+ import type { BlankStackDescriptorMap } from "../../../../../types/blank-stack.navigator";
3
+
4
+ export function calculateActiveScreensLimit(
5
+ routes: NavigationRoute<ParamListBase, string>[],
6
+ descriptors: BlankStackDescriptorMap
7
+ ): number {
8
+ if (routes.length === 0) {
9
+ return 1;
10
+ }
11
+
12
+ let limit = 1;
13
+
14
+ for (let i = routes.length - 1; i >= 0; i--) {
15
+ const route = routes[i];
16
+
17
+ const shouldKeepPrevious =
18
+ descriptors?.[route.key]?.options?.detachPreviousScreen !== true;
19
+
20
+ if (shouldKeepPrevious) {
21
+ limit++;
22
+ continue;
23
+ }
24
+
25
+ break;
26
+ }
27
+
28
+ return Math.min(limit, routes.length);
29
+ }
@@ -0,0 +1,17 @@
1
+ import type { Route } from "@react-navigation/native";
2
+ import type { BlankStackDescriptorMap } from "../../../../../types/blank-stack.navigator";
3
+
4
+ export const composeDescriptors = (
5
+ routes: Route<string>[],
6
+ nextDescriptors: BlankStackDescriptorMap,
7
+ currentDescriptors: BlankStackDescriptorMap
8
+ ): BlankStackDescriptorMap => {
9
+ const composed: BlankStackDescriptorMap = {};
10
+
11
+ for (const route of routes) {
12
+ composed[route.key] =
13
+ nextDescriptors[route.key] ?? currentDescriptors[route.key];
14
+ }
15
+
16
+ return composed;
17
+ };
@@ -0,0 +1,12 @@
1
+ import type { Route } from "@react-navigation/native";
2
+
3
+ export const haveSameRouteKeys = (
4
+ previous: Route<string>[],
5
+ next: Route<string>[],
6
+ ): boolean => {
7
+ if (previous.length !== next.length) {
8
+ return false;
9
+ }
10
+
11
+ return previous.every((route, index) => route?.key === next[index]?.key);
12
+ };