react-native-screen-transitions 2.4.1 → 2.4.2-beta.1

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 (284) hide show
  1. package/lib/commonjs/__configs__/presets.js.map +1 -1
  2. package/lib/commonjs/components/controllers/screen-lifecycle.blank.js +59 -0
  3. package/lib/commonjs/components/controllers/screen-lifecycle.blank.js.map +1 -0
  4. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  5. package/lib/commonjs/constants.js.map +1 -1
  6. package/lib/commonjs/hooks/animation/use-screen-animation.js +9 -5
  7. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  8. package/lib/commonjs/index.js +7 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/integrations/blank-stack/components/Header.js +135 -0
  11. package/lib/commonjs/integrations/blank-stack/components/Header.js.map +1 -0
  12. package/lib/commonjs/integrations/blank-stack/components/Screens.js +64 -0
  13. package/lib/commonjs/integrations/blank-stack/components/Screens.js.map +1 -0
  14. package/lib/commonjs/integrations/blank-stack/components/StackView.js +85 -0
  15. package/lib/commonjs/integrations/blank-stack/components/StackView.js.map +1 -0
  16. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js +68 -0
  17. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  18. package/lib/commonjs/integrations/blank-stack/providers/screen-transition-provider.js +10 -0
  19. package/lib/commonjs/integrations/blank-stack/providers/screen-transition-provider.js.map +1 -0
  20. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +66 -0
  21. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  22. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +16 -0
  23. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  24. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +208 -0
  25. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  26. package/lib/commonjs/{types/navigator.js → integrations/blank-stack/utils/with-stack-navigation/_types.js} +1 -1
  27. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  28. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +15 -0
  29. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  30. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.js +23 -0
  31. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.js.map +1 -0
  32. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +15 -0
  33. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  34. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +14 -0
  35. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  36. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +13 -0
  37. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  38. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js +71 -0
  39. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  40. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  41. package/lib/commonjs/integrations/native-stack/providers/screen-transition-provider.js +10 -0
  42. package/lib/commonjs/integrations/native-stack/providers/screen-transition-provider.js.map +1 -0
  43. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  44. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  45. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -1
  46. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +1 -1
  47. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  48. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  49. package/lib/commonjs/providers/create-screen-transition-provider.js +35 -0
  50. package/lib/commonjs/providers/create-screen-transition-provider.js.map +1 -0
  51. package/lib/commonjs/providers/keys.js.map +1 -1
  52. package/lib/commonjs/providers/transition-styles.js +18 -4
  53. package/lib/commonjs/providers/transition-styles.js.map +1 -1
  54. package/lib/commonjs/stores/animations.js.map +1 -1
  55. package/lib/commonjs/stores/bounds/index.js.map +1 -1
  56. package/lib/commonjs/stores/gestures.js.map +1 -1
  57. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  58. package/lib/commonjs/types/blank-stack.navigator.js +6 -0
  59. package/lib/{module/types/navigator.js.map → commonjs/types/blank-stack.navigator.js.map} +1 -1
  60. package/lib/commonjs/types/native-stack.navigator.js +6 -0
  61. package/lib/commonjs/types/native-stack.navigator.js.map +1 -0
  62. package/lib/commonjs/utils/animation/derivations.js +1 -14
  63. package/lib/commonjs/utils/animation/derivations.js.map +1 -1
  64. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  65. package/lib/commonjs/utils/bounds/index.js +23 -90
  66. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  67. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -1
  68. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -1
  69. package/lib/module/__configs__/presets.js.map +1 -1
  70. package/lib/module/components/controllers/screen-lifecycle.blank.js +53 -0
  71. package/lib/module/components/controllers/screen-lifecycle.blank.js.map +1 -0
  72. package/lib/module/components/root-transition-aware.js.map +1 -1
  73. package/lib/module/constants.js.map +1 -1
  74. package/lib/module/hooks/animation/use-screen-animation.js +9 -5
  75. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  76. package/lib/module/index.js +1 -0
  77. package/lib/module/index.js.map +1 -1
  78. package/lib/module/integrations/blank-stack/components/Header.js +131 -0
  79. package/lib/module/integrations/blank-stack/components/Header.js.map +1 -0
  80. package/lib/module/integrations/blank-stack/components/Screens.js +58 -0
  81. package/lib/module/integrations/blank-stack/components/Screens.js.map +1 -0
  82. package/lib/module/integrations/blank-stack/components/StackView.js +81 -0
  83. package/lib/module/integrations/blank-stack/components/StackView.js.map +1 -0
  84. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js +63 -0
  85. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  86. package/lib/module/integrations/blank-stack/providers/screen-transition-provider.js +6 -0
  87. package/lib/module/integrations/blank-stack/providers/screen-transition-provider.js.map +1 -0
  88. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +60 -0
  89. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  90. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +11 -0
  91. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  92. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +202 -0
  93. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  94. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js +4 -0
  95. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  96. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +10 -0
  97. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  98. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.js +19 -0
  99. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.js.map +1 -0
  100. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +10 -0
  101. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  102. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +9 -0
  103. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  104. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +8 -0
  105. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  106. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js +65 -0
  107. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  108. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  109. package/lib/module/integrations/native-stack/providers/screen-transition-provider.js +6 -0
  110. package/lib/module/integrations/native-stack/providers/screen-transition-provider.js.map +1 -0
  111. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  112. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  113. package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -1
  114. package/lib/module/integrations/native-stack/views/NativeStackView.native.js +1 -1
  115. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  116. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  117. package/lib/module/providers/create-screen-transition-provider.js +31 -0
  118. package/lib/module/providers/create-screen-transition-provider.js.map +1 -0
  119. package/lib/module/providers/keys.js.map +1 -1
  120. package/lib/module/providers/transition-styles.js +19 -5
  121. package/lib/module/providers/transition-styles.js.map +1 -1
  122. package/lib/module/stores/animations.js.map +1 -1
  123. package/lib/module/stores/bounds/index.js.map +1 -1
  124. package/lib/module/stores/gestures.js.map +1 -1
  125. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  126. package/lib/module/types/blank-stack.navigator.js +4 -0
  127. package/lib/{commonjs/types/navigator.js.map → module/types/blank-stack.navigator.js.map} +1 -1
  128. package/lib/module/types/native-stack.navigator.js +4 -0
  129. package/lib/module/types/native-stack.navigator.js.map +1 -0
  130. package/lib/module/utils/animation/derivations.js +1 -14
  131. package/lib/module/utils/animation/derivations.js.map +1 -1
  132. package/lib/module/utils/bounds/constants.js.map +1 -1
  133. package/lib/module/utils/bounds/index.js +24 -91
  134. package/lib/module/utils/bounds/index.js.map +1 -1
  135. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -1
  136. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -1
  137. package/lib/typescript/__configs__/index.d.ts +9 -9
  138. package/lib/typescript/__configs__/index.d.ts.map +1 -1
  139. package/lib/typescript/__configs__/presets.d.ts +1 -1
  140. package/lib/typescript/__configs__/presets.d.ts.map +1 -1
  141. package/lib/typescript/components/controllers/screen-lifecycle.blank.d.ts +7 -0
  142. package/lib/typescript/components/controllers/screen-lifecycle.blank.d.ts.map +1 -0
  143. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  144. package/lib/typescript/constants.d.ts +2 -2
  145. package/lib/typescript/constants.d.ts.map +1 -1
  146. package/lib/typescript/hooks/animation/use-screen-animation.d.ts +1 -1
  147. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  148. package/lib/typescript/index.d.ts +20 -18
  149. package/lib/typescript/index.d.ts.map +1 -1
  150. package/lib/typescript/integrations/blank-stack/components/Header.d.ts +5 -0
  151. package/lib/typescript/integrations/blank-stack/components/Header.d.ts.map +1 -0
  152. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts +15 -0
  153. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts.map +1 -0
  154. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts +2 -0
  155. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts.map +1 -0
  156. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts +16 -0
  157. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts.map +1 -0
  158. package/lib/typescript/integrations/blank-stack/providers/screen-transition-provider.d.ts +8 -0
  159. package/lib/typescript/integrations/blank-stack/providers/screen-transition-provider.d.ts.map +1 -0
  160. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts +8 -0
  161. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts.map +1 -0
  162. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts +2 -0
  163. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts.map +1 -0
  164. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts +20 -0
  165. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts.map +1 -0
  166. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts +23 -0
  167. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts.map +1 -0
  168. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts +3 -0
  169. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts.map +1 -0
  170. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.d.ts +4 -0
  171. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.d.ts.map +1 -0
  172. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts +4 -0
  173. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts.map +1 -0
  174. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts +3 -0
  175. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts.map +1 -0
  176. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts +3 -0
  177. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts.map +1 -0
  178. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts +6 -0
  179. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts.map +1 -0
  180. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +1 -1
  181. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
  182. package/lib/typescript/integrations/native-stack/providers/screen-transition-provider.d.ts +8 -0
  183. package/lib/typescript/integrations/native-stack/providers/screen-transition-provider.d.ts.map +1 -0
  184. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +1 -1
  185. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -1
  186. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +1 -1
  187. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -1
  188. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +1 -1
  189. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -1
  190. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +1 -1
  191. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  192. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +1 -1
  193. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
  194. package/lib/typescript/providers/create-screen-transition-provider.d.ts +15 -0
  195. package/lib/typescript/providers/create-screen-transition-provider.d.ts.map +1 -0
  196. package/lib/typescript/providers/keys.d.ts +15 -13
  197. package/lib/typescript/providers/keys.d.ts.map +1 -1
  198. package/lib/typescript/providers/transition-styles.d.ts.map +1 -1
  199. package/lib/typescript/stores/animations.d.ts +1 -1
  200. package/lib/typescript/stores/animations.d.ts.map +1 -1
  201. package/lib/typescript/stores/bounds/index.d.ts +1 -1
  202. package/lib/typescript/stores/bounds/index.d.ts.map +1 -1
  203. package/lib/typescript/stores/gestures.d.ts +1 -1
  204. package/lib/typescript/stores/gestures.d.ts.map +1 -1
  205. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +1 -1
  206. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  207. package/lib/typescript/types/animation.d.ts +2 -4
  208. package/lib/typescript/types/animation.d.ts.map +1 -1
  209. package/lib/typescript/types/blank-stack.navigator.d.ts +214 -0
  210. package/lib/typescript/types/blank-stack.navigator.d.ts.map +1 -0
  211. package/lib/typescript/types/bounds.d.ts +0 -57
  212. package/lib/typescript/types/bounds.d.ts.map +1 -1
  213. package/lib/typescript/types/{navigator.d.ts → native-stack.navigator.d.ts} +5 -1
  214. package/lib/typescript/types/native-stack.navigator.d.ts.map +1 -0
  215. package/lib/typescript/utils/animation/derivations.d.ts +1 -4
  216. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -1
  217. package/lib/typescript/utils/bounds/_types/builder.d.ts +2 -2
  218. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  219. package/lib/typescript/utils/bounds/_utils/geometry.d.ts +2 -2
  220. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -1
  221. package/lib/typescript/utils/bounds/constants.d.ts +2 -2
  222. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  223. package/lib/typescript/utils/bounds/index.d.ts +4 -4
  224. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  225. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +2 -2
  226. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -1
  227. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +2 -2
  228. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -1
  229. package/package.json +1 -1
  230. package/src/__configs__/presets.ts +590 -590
  231. package/src/components/controllers/screen-lifecycle.blank.ts +62 -0
  232. package/src/components/root-transition-aware.tsx +27 -27
  233. package/src/constants.ts +47 -47
  234. package/src/hooks/animation/use-screen-animation.tsx +52 -47
  235. package/src/index.ts +33 -22
  236. package/src/integrations/blank-stack/components/Header.tsx +141 -0
  237. package/src/integrations/blank-stack/components/Screens.tsx +96 -0
  238. package/src/integrations/blank-stack/components/StackView.tsx +100 -0
  239. package/src/integrations/blank-stack/navigators/createBlankStackNavigator.tsx +111 -0
  240. package/src/integrations/blank-stack/providers/screen-transition-provider.tsx +8 -0
  241. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.tsx +62 -0
  242. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.tsx +11 -0
  243. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.tsx +280 -0
  244. package/src/integrations/blank-stack/utils/with-stack-navigation/_types.ts +36 -0
  245. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.ts +15 -0
  246. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.ts +29 -0
  247. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.ts +17 -0
  248. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.ts +12 -0
  249. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.ts +11 -0
  250. package/src/integrations/blank-stack/utils/with-stack-navigation/index.tsx +93 -0
  251. package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +95 -95
  252. package/src/integrations/native-stack/providers/screen-transition-provider.tsx +8 -0
  253. package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +14 -14
  254. package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +23 -23
  255. package/src/integrations/native-stack/views/NativeStackView.native.tsx +609 -609
  256. package/src/integrations/native-stack/views/NativeStackView.tsx +188 -188
  257. package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +260 -260
  258. package/src/providers/create-screen-transition-provider.tsx +46 -0
  259. package/src/providers/keys.tsx +46 -34
  260. package/src/providers/transition-styles.tsx +24 -11
  261. package/src/stores/animations.ts +23 -23
  262. package/src/stores/bounds/index.ts +82 -82
  263. package/src/stores/gestures.ts +36 -36
  264. package/src/stores/utils/reset-stores-for-screen.ts +4 -4
  265. package/src/types/animation.ts +2 -4
  266. package/src/types/blank-stack.navigator.ts +266 -0
  267. package/src/types/bounds.ts +0 -64
  268. package/src/types/{navigator.ts → native-stack.navigator.ts} +5 -0
  269. package/src/utils/animation/derivations.ts +3 -20
  270. package/src/utils/bounds/_types/builder.ts +111 -111
  271. package/src/utils/bounds/_utils/geometry.ts +2 -2
  272. package/src/utils/bounds/constants.ts +29 -29
  273. package/src/utils/bounds/index.ts +35 -105
  274. package/src/utils/gesture/apply-offset-rules.ts +271 -271
  275. package/src/utils/gesture/check-gesture-activation.ts +260 -260
  276. package/lib/commonjs/providers/screen-transition-provider.js +0 -34
  277. package/lib/commonjs/providers/screen-transition-provider.js.map +0 -1
  278. package/lib/module/providers/screen-transition-provider.js +0 -30
  279. package/lib/module/providers/screen-transition-provider.js.map +0 -1
  280. package/lib/module/types/navigator.js +0 -4
  281. package/lib/typescript/providers/screen-transition-provider.d.ts +0 -11
  282. package/lib/typescript/providers/screen-transition-provider.d.ts.map +0 -1
  283. package/lib/typescript/types/navigator.d.ts.map +0 -1
  284. package/src/providers/screen-transition-provider.tsx +0 -33
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ import { NavigationContext, NavigationRouteContext } from "@react-navigation/native";
4
+ import { useMemo } from "react";
5
+ import { Animated, StyleSheet, View } from "react-native";
6
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
7
+ import { useScreenAnimation } from "../../../hooks/animation/use-screen-animation";
8
+ import { KeysProvider, useKeys } from "../../../providers/keys";
9
+ import { useStackNavigationContext } from "../utils/with-stack-navigation";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const getActiveFloatHeader = (scenes, index) => {
12
+ for (let i = index; i >= 0; i--) {
13
+ const scene = scenes[i];
14
+ const options = scene?.descriptor?.options;
15
+ if (options?.headerMode === "float" && options?.headerShown) {
16
+ return {
17
+ scene,
18
+ headerIndex: i
19
+ };
20
+ }
21
+ }
22
+ return null;
23
+ };
24
+ const HeaderHost = ({
25
+ scene,
26
+ focusedIndex,
27
+ isFloating
28
+ }) => {
29
+ const insets = useSafeAreaInsets();
30
+ const animation = useScreenAnimation();
31
+ const HeaderComponent = scene.descriptor.options.header;
32
+ if (!HeaderComponent) {
33
+ return null;
34
+ }
35
+ const headerProps = {
36
+ route: scene.route,
37
+ navigation: scene.descriptor.navigation,
38
+ animation,
39
+ insets,
40
+ focusedIndex
41
+ };
42
+ return /*#__PURE__*/_jsx(Animated.View, {
43
+ pointerEvents: "box-none",
44
+ style: [styles.container, isFloating ? styles.floating : null, styles.absolute],
45
+ children: /*#__PURE__*/_jsx(NavigationContext.Provider, {
46
+ value: scene.descriptor.navigation,
47
+ children: /*#__PURE__*/_jsx(NavigationRouteContext.Provider, {
48
+ value: scene.route,
49
+ children: /*#__PURE__*/_jsx(View, {
50
+ pointerEvents: "auto",
51
+ style: styles.header,
52
+ children: /*#__PURE__*/_jsx(HeaderComponent, {
53
+ ...headerProps
54
+ })
55
+ })
56
+ })
57
+ })
58
+ });
59
+ };
60
+ const FloatHeader = () => {
61
+ const {
62
+ scenes,
63
+ focusedIndex
64
+ } = useStackNavigationContext();
65
+ const activeHeader = useMemo(() => getActiveFloatHeader(scenes, focusedIndex), [scenes, focusedIndex]);
66
+ if (!activeHeader) {
67
+ return null;
68
+ }
69
+ const {
70
+ scene,
71
+ headerIndex
72
+ } = activeHeader;
73
+ const previous = scenes[headerIndex - 1]?.descriptor;
74
+ const current = scene.descriptor;
75
+ const next = scenes[headerIndex + 1]?.descriptor;
76
+ return /*#__PURE__*/_jsx(KeysProvider, {
77
+ current: current,
78
+ previous: previous,
79
+ next: next,
80
+ children: /*#__PURE__*/_jsx(HeaderHost, {
81
+ scene: scene,
82
+ focusedIndex: focusedIndex,
83
+ isFloating: true
84
+ })
85
+ });
86
+ };
87
+ const ScreenHeader = () => {
88
+ const {
89
+ focusedIndex
90
+ } = useStackNavigationContext();
91
+ const {
92
+ current
93
+ } = useKeys();
94
+ const options = current.options;
95
+ if (!options.headerShown || options.headerMode !== "screen") {
96
+ return null;
97
+ }
98
+ const scene = {
99
+ descriptor: current,
100
+ route: current.route
101
+ };
102
+ return /*#__PURE__*/_jsx(HeaderHost, {
103
+ scene: scene,
104
+ focusedIndex: focusedIndex
105
+ });
106
+ };
107
+ export const Header = {
108
+ Float: FloatHeader,
109
+ Screen: ScreenHeader
110
+ };
111
+ const styles = StyleSheet.create({
112
+ header: {
113
+ position: "absolute",
114
+ top: 0,
115
+ start: 0,
116
+ end: 0
117
+ },
118
+ container: {
119
+ flex: 1
120
+ },
121
+ absolute: {
122
+ position: "absolute",
123
+ top: 0,
124
+ start: 0,
125
+ end: 0
126
+ },
127
+ floating: {
128
+ zIndex: 1000
129
+ }
130
+ });
131
+ //# sourceMappingURL=Header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NavigationContext","NavigationRouteContext","useMemo","Animated","StyleSheet","View","useSafeAreaInsets","useScreenAnimation","KeysProvider","useKeys","useStackNavigationContext","jsx","_jsx","getActiveFloatHeader","scenes","index","i","scene","options","descriptor","headerMode","headerShown","headerIndex","HeaderHost","focusedIndex","isFloating","insets","animation","HeaderComponent","header","headerProps","route","navigation","pointerEvents","style","styles","container","floating","absolute","children","Provider","value","FloatHeader","activeHeader","previous","current","next","ScreenHeader","Header","Float","Screen","create","position","top","start","end","flex","zIndex"],"sourceRoot":"../../../../../src","sources":["integrations/blank-stack/components/Header.tsx"],"mappings":";;AAAA,SACEA,iBAAiB,EACjBC,sBAAsB,QACjB,0BAA0B;AACjC,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACzD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,kBAAkB,QAAQ,+CAA+C;AAClF,SAASC,YAAY,EAAEC,OAAO,QAAQ,yBAAyB;AAM/D,SAASC,yBAAyB,QAAQ,gCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ3E,MAAMC,oBAAoB,GAAGA,CAACC,MAAyB,EAAEC,KAAa,KAAK;EACzE,KAAK,IAAIC,CAAC,GAAGD,KAAK,EAAEC,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC/B,MAAMC,KAAK,GAAGH,MAAM,CAACE,CAAC,CAAC;IACvB,MAAME,OAAO,GAAGD,KAAK,EAAEE,UAAU,EAAED,OAAO;IAE1C,IAAIA,OAAO,EAAEE,UAAU,KAAK,OAAO,IAAIF,OAAO,EAAEG,WAAW,EAAE;MAC3D,OAAO;QAAEJ,KAAK;QAAEK,WAAW,EAAEN;MAAE,CAAC;IAClC;EACF;EAEA,OAAO,IAAI;AACb,CAAC;AAED,MAAMO,UAAU,GAAGA,CAAC;EAAEN,KAAK;EAAEO,YAAY;EAAEC;AAA4B,CAAC,KAAK;EAC3E,MAAMC,MAAM,GAAGpB,iBAAiB,CAAC,CAAC;EAClC,MAAMqB,SAAS,GAAGpB,kBAAkB,CAAC,CAAC;EAEtC,MAAMqB,eAAe,GAAGX,KAAK,CAACE,UAAU,CAACD,OAAO,CAACW,MAAM;EAEvD,IAAI,CAACD,eAAe,EAAE;IACpB,OAAO,IAAI;EACb;EAEA,MAAME,WAAkC,GAAG;IACzCC,KAAK,EAAEd,KAAK,CAACc,KAAK;IAClBC,UAAU,E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EAAE,CAAC;IACRC,GAAG,EAAE;EACP,CAAC;EACDlB,QAAQ,EAAE;IACRoB,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from "react-native";
4
+ import Animated, { interpolate, useAnimatedProps, useDerivedValue, useSharedValue } from "react-native-reanimated";
5
+ import { Screen as RNSScreen } from "react-native-screens";
6
+ import { Animations } from "../../../stores/animations";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const EPSILON = 1e-5;
9
+ const STATE_INACTIVE = 0;
10
+ const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
11
+ const STATE_ON_TOP = 2;
12
+ const AnimatedScreen = Animated.createAnimatedComponent(RNSScreen);
13
+ export const Screen = ({
14
+ routeKey,
15
+ index,
16
+ routes,
17
+ isPreloaded,
18
+ activeScreensLimit,
19
+ children,
20
+ freezeOnBlur,
21
+ shouldFreeze
22
+ }) => {
23
+ const sceneProgress = Animations.getAnimation(routeKey, "progress");
24
+ const screenActivity = useSharedValue(1);
25
+ useDerivedValue(() => {
26
+ if (!sceneProgress) {
27
+ screenActivity.value = STATE_TRANSITIONING_OR_BELOW_TOP;
28
+ return;
29
+ }
30
+ if (index < routes.length - activeScreensLimit - 1 || isPreloaded) {
31
+ screenActivity.value = STATE_INACTIVE;
32
+ } else {
33
+ const outputValue = index === routes.length - 1 ? STATE_ON_TOP : index >= routes.length - activeScreensLimit ? STATE_TRANSITIONING_OR_BELOW_TOP : STATE_INACTIVE;
34
+ const v = interpolate(sceneProgress.value, [0, 1 - EPSILON, 1], [1, 1, outputValue], "clamp");
35
+ const next = Math.trunc(v) ?? STATE_TRANSITIONING_OR_BELOW_TOP;
36
+
37
+ // avoid spamming JS thread
38
+ if (next !== screenActivity.value) {
39
+ screenActivity.value = next;
40
+ }
41
+ }
42
+ });
43
+ const animatedProps = useAnimatedProps(() => {
44
+ return {
45
+ activityState: screenActivity.value,
46
+ shouldFreeze: screenActivity.value === STATE_INACTIVE && shouldFreeze
47
+ };
48
+ });
49
+ return /*#__PURE__*/_jsx(AnimatedScreen, {
50
+ enabled: true,
51
+ style: StyleSheet.absoluteFill,
52
+ pointerEvents: "box-none",
53
+ freezeOnBlur: freezeOnBlur,
54
+ animatedProps: animatedProps,
55
+ children: children
56
+ });
57
+ };
58
+ //# sourceMappingURL=Screens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","Animated","interpolate","useAnimatedProps","useDerivedValue","useSharedValue","Screen","RNSScreen","Animations","jsx","_jsx","EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","AnimatedScreen","createAnimatedComponent","routeKey","index","routes","isPreloaded","activeScreensLimit","children","freezeOnBlur","shouldFreeze","sceneProgress","getAnimation","screenActivity","value","length","outputValue","v","next","Math","trunc","animatedProps","activityState","enabled","style","absoluteFill","pointerEvents"],"sourceRoot":"../../../../../src","sources":["integrations/blank-stack/components/Screens.tsx"],"mappings":";;AAEA,SAASA,UAAU,QAAQ,cAAc;AACzC,OAAOC,QAAQ,IACdC,WAAW,EACXC,gBAAgB,EAChBC,eAAe,EACfC,cAAc,QACR,yBAAyB;AAChC,SAASC,MAAM,IAAIC,SAAS,QAAQ,sBAAsB;AAC1D,SAASC,UAAU,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAaxD,MAAMC,OAAO,GAAG,IAAI;AAEpB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,gCAAgC,GAAG,CAAC;AAC1C,MAAMC,YAAY,GAAG,CAAC;AAEtB,MAAMC,cAAc,GAAGd,QAAQ,CAACe,uBAAuB,CAACT,SAAS,CAAC;AAElE,OAAO,MAAMD,MAAM,GAAGA,CAAC;EACtBW,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,WAAW;EACXC,kBAAkB;EAClBC,QAAQ;EACRC,YAAY;EACZC;AACY,CAAC,KAAK;EAClB,M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AAC,UAAU;IACxBjB,YAAY,EAAEA,YAAa;IAC3BY,aAAa,EAAEA,aAAc;IAAAb,QAAA,EAE5BA;EAAQ,CACM,CAAC;AAEnB,CAAC","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ import { SafeAreaProviderCompat } from "@react-navigation/elements";
4
+ import { NavigationContext, NavigationRouteContext } from "@react-navigation/native";
5
+ import { GestureHandlerRootView } from "react-native-gesture-handler";
6
+ import { ScreenContainer } from "react-native-screens";
7
+ import { withStackNavigationProvider } from "../utils/with-stack-navigation";
8
+ import { Header } from "./Header";
9
+ import { Screen } from "./Screens";
10
+ import { ScreenTransitionProvider } from "../providers/screen-transition-provider";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ function isFabric() {
13
+ return "nativeFabricUIManager" in global;
14
+ }
15
+ const SceneView = ({
16
+ descriptor
17
+ }) => {
18
+ const {
19
+ route,
20
+ navigation,
21
+ render
22
+ } = descriptor;
23
+ return /*#__PURE__*/_jsx(NavigationContext.Provider, {
24
+ value: navigation,
25
+ children: /*#__PURE__*/_jsxs(NavigationRouteContext.Provider, {
26
+ value: route,
27
+ children: [descriptor.options.headerMode === "screen" && /*#__PURE__*/_jsx(Header.Screen, {}), render()]
28
+ })
29
+ });
30
+ };
31
+ export const StackView = withStackNavigationProvider(({
32
+ activeScreensLimit,
33
+ descriptors,
34
+ FloatHeader,
35
+ focusedIndex,
36
+ routes,
37
+ scenes
38
+ }) => {
39
+ return /*#__PURE__*/_jsx(GestureHandlerRootView, {
40
+ children: /*#__PURE__*/_jsxs(SafeAreaProviderCompat, {
41
+ children: [/*#__PURE__*/_jsx(FloatHeader, {}), /*#__PURE__*/_jsx(ScreenContainer, {
42
+ style: {
43
+ flex: 1
44
+ },
45
+ children: scenes.map((scene, sceneIndex) => {
46
+ const descriptor = scene.descriptor;
47
+ const route = scene.route;
48
+ const isFocused = focusedIndex === sceneIndex;
49
+ const isBelowFocused = focusedIndex - 1 === sceneIndex;
50
+ const previousDescriptor = scenes[sceneIndex - 1]?.descriptor ?? undefined;
51
+ const nextDescriptor = scenes[sceneIndex + 1]?.descriptor ?? undefined;
52
+ const isPreloaded = descriptors[route.key] === undefined;
53
+
54
+ // On Fabric, when screen is frozen, animated and reanimated values are not updated
55
+ // due to component being unmounted. To avoid this, we don't freeze the previous screen there
56
+ const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused : !isPreloaded && !isFocused;
57
+ return /*#__PURE__*/_jsx(Screen, {
58
+ isPreloaded: isPreloaded,
59
+ index: sceneIndex,
60
+ activeScreensLimit: activeScreensLimit,
61
+ routeKey: route.key,
62
+ routes: routes,
63
+ shouldFreeze: shouldFreeze,
64
+ freezeOnBlur: descriptor.options.freezeOnBlur,
65
+ children: /*#__PURE__*/_jsx(ScreenTransitionProvider, {
66
+ previous: previousDescriptor,
67
+ current: descriptor,
68
+ next: nextDescriptor,
69
+ children: /*#__PURE__*/_jsx(SceneView, {
70
+ isFocused: isFocused,
71
+ sceneIndex: sceneIndex,
72
+ descriptor: descriptor
73
+ }, route.key)
74
+ })
75
+ }, route.key);
76
+ })
77
+ })]
78
+ })
79
+ });
80
+ });
81
+ //# sourceMappingURL=StackView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SafeAreaProviderCompat","NavigationContext","NavigationRouteContext","GestureHandlerRootView","ScreenContainer","withStackNavigationProvider","Header","Screen","ScreenTransitionProvider","jsx","_jsx","jsxs","_jsxs","isFabric","global","SceneView","descriptor","route","navigation","render","Provider","value","children","options","headerMode","StackView","activeScreensLimit","descriptors","FloatHeader","focusedIndex","routes","scenes","style","flex","map","scene","sceneIndex","isFocused","isBelowFocused","previousDescriptor","undefined","nextDescriptor","isPreloaded","key","shouldFreeze","index","routeKey","freezeOnBlur","previous","current","next"],"sourceRoot":"../../../../../src","sources":["integrations/blank-stack/components/StackView.tsx"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,4BAA4B;AACnE,SACE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GApBtB1B,KAAK,CAAC0B,GAqBL,CAAC;QAEb,CAAC;MAAC,CACa,CAAC;IAAA,CACI;EAAC,CACH,CAAC;AAE7B,CACF,CAAC","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ import { createNavigatorFactory, StackActions, StackRouter, useNavigationBuilder } from "@react-navigation/native";
4
+ import * as React from "react";
5
+ import { StackView } from "../components/StackView";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ function BlankStackNavigator({
8
+ id,
9
+ initialRouteName,
10
+ children,
11
+ layout,
12
+ screenListeners,
13
+ screenOptions,
14
+ screenLayout,
15
+ ...rest
16
+ }) {
17
+ const {
18
+ state,
19
+ describe,
20
+ descriptors,
21
+ navigation,
22
+ NavigationContent
23
+ } = useNavigationBuilder(StackRouter, {
24
+ id,
25
+ initialRouteName,
26
+ children,
27
+ layout,
28
+ screenListeners,
29
+ screenOptions,
30
+ screenLayout
31
+ });
32
+ React.useEffect(() =>
33
+ // @ts-expect-error: there may not be a tab navigator in parent
34
+ navigation?.addListener?.("tabPress", e => {
35
+ const isFocused = navigation.isFocused();
36
+
37
+ // Run the operation in the next frame so we're sure all listeners have been run
38
+ // This is necessary to know if preventDefault() has been called
39
+ requestAnimationFrame(() => {
40
+ if (state.index > 0 && isFocused && !e.defaultPrevented) {
41
+ // When user taps on already focused tab and we're inside the tab,
42
+ // reset the stack to replicate native behaviour
43
+ navigation.dispatch({
44
+ ...StackActions.popToTop(),
45
+ target: state.key
46
+ });
47
+ }
48
+ });
49
+ }), [navigation, state.index, state.key]);
50
+ return /*#__PURE__*/_jsx(NavigationContent, {
51
+ children: /*#__PURE__*/_jsx(StackView, {
52
+ ...rest,
53
+ state: state,
54
+ navigation: navigation,
55
+ descriptors: descriptors,
56
+ describe: describe
57
+ })
58
+ });
59
+ }
60
+ export function createBlankStackNavigator(config) {
61
+ return createNavigatorFactory(BlankStackNavigator)(config);
62
+ }
63
+ //# sourceMappingURL=createBlankStackNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createNavigatorFactory","StackActions","StackRouter","useNavigationBuilder","React","StackView","jsx","_jsx","BlankStackNavigator","id","initialRouteName","children","layout","screenListeners","screenOptions","screenLayout","rest","state","describe","descriptors","navigation","NavigationContent","useEffect","addListener","e","isFocused","requestAnimationFrame","index","defaultPrevented","dispatch","popToTop","target","key","createBlankStackNavigator","config"],"sourceRoot":"../../../../../src","sources":["integrations/blank-stack/navigators/createBlankStackNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAKtBC,YAAY,EAEZC,WAAW,EAIXC,oBAAoB,QACf,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQpD,SAASC,mBAAmBA,CAAC;EAC3BC,EAAE;EACFC,gBAAgB;EAChBC,QAAQ;EACRC,MAAM;EACNC,eAAe;EACfC,aAAa;EACbC,YAAY;EACZ,GAAGC;AACqB,CAAC,EAAE;EAC3B,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GACnElB,oBAAoB,CAMlBD,WAAW,EAAE;IACbO,EAAE;IACFC,gBAAgB;IAChBC,QAAQ;IACRC,MAAM;IACNC,eAAe;IACfC,aAAa;IACbC;EACF,CAAC,CAAC;EAEJX,KAAK,CAACkB,SAAS,CACb;EACE;EACAF,UAAU,EAAEG,WAAW,GAAG,UAAU,EAAGC,CAAM,IAAK;IAChD,MAAMC,SAAS,GAAGL,UAAU,CAACK,SAAS,CAAC,CAAC;;IAExC;IACA;IACAC,qBAAqB,CAAC,MAAM;MAC1B,IACET,KAAK,CAACU,KAAK,GAAG,CAAC,IACfF,SAAS,IACT,CAAED,CAAC,CAAgCI,gBAAgB,EACnD;QACA;QACA;QACAR,UAAU,CAACS,QAAQ,CAAC;UAClB,GAAG5B,YAAY,CAAC6B,QAAQ,CAAC,CAAC;UAC1BC,MAAM,EAAEd,KAAK,CAACe;QAChB,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,EACJ,CAACZ,UAAU,EAAEH,KAAK,CAACU,KAAK,EAAEV,KAAK,CAACe,GAAG,CACrC,CAAC;EAED,oBACEzB,IAAA,CAACc,iBAAiB;IAAAV,QAAA,eAChBJ,IAAA,CAACF,SAAS;MAAA,GACJW,IAAI;MACRC,KAAK,EAAEA,KAAM;MACbG,UAAU,EAAEA,UAAW;MACvBD,WAAW,EAAEA,WAAY;MACzBD,QAAQ,EAAEA;IAAS,CACpB;EAAC,CACe,CAAC;AAExB;AAEA,OAAO,SAASe,yBAAyBA,CAmBvCC,MAAe,EAAmC;EAClD,OAAOlC,sBAAsB,CAACQ,mBAAmB,CAAC,CAAC0B,MAAM,CAAC;AAC5D","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ import { ScreenLifecycleController } from "../../../components/controllers/screen-lifecycle.blank";
4
+ import { createScreenTransitionProvider } from "../../../providers/create-screen-transition-provider";
5
+ export const ScreenTransitionProvider = createScreenTransitionProvider(ScreenLifecycleController);
6
+ //# sourceMappingURL=screen-transition-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScreenLifecycleController","createScreenTransitionProvider","ScreenTransitionProvider"],"sourceRoot":"../../../../../src","sources":["integrations/blank-stack/providers/screen-transition-provider.tsx"],"mappings":";;AACA,SAASA,yBAAyB,QAAQ,wDAAwD;AAClG,SAASC,8BAA8B,QAAQ,sDAAsD;AAErG,OAAO,MAAMC,wBAAwB,GACpCD,8BAA8B,CAC7BD,yBACD,CAAC","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import { useRef } from "react";
4
+ import { useSharedValue } from "react-native-reanimated";
5
+ import useStableCallback from "../../../../../hooks/use-stable-callback";
6
+ export const useClosingRouteKeys = () => {
7
+ const keysRef = useRef(new Set());
8
+ const shared = useSharedValue([]);
9
+ const add = useStableCallback(key => {
10
+ const keys = keysRef.current;
11
+ if (keys.has(key)) {
12
+ return;
13
+ }
14
+ keys.add(key);
15
+ shared.modify(prev => {
16
+ "worklet";
17
+
18
+ if (!prev.includes(key)) {
19
+ prev.push(key);
20
+ }
21
+ return prev;
22
+ });
23
+ });
24
+ const remove = useStableCallback(key => {
25
+ const keys = keysRef.current;
26
+ if (!keys.delete(key)) {
27
+ return;
28
+ }
29
+ shared.modify(prev => {
30
+ "worklet";
31
+
32
+ const index = prev.indexOf(key);
33
+ if (index !== -1) {
34
+ prev.splice(index, 1);
35
+ }
36
+ return prev;
37
+ });
38
+ });
39
+ const clear = useStableCallback(() => {
40
+ const keys = keysRef.current;
41
+ if (!keys.size) {
42
+ return;
43
+ }
44
+ keys.clear();
45
+ shared.modify(prev => {
46
+ "worklet";
47
+
48
+ prev.length = 0;
49
+ return prev;
50
+ });
51
+ });
52
+ return {
53
+ ref: keysRef,
54
+ shared,
55
+ add,
56
+ remove,
57
+ clear
58
+ };
59
+ };
60
+ //# sourceMappingURL=use-closing-route-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRef","useSharedValue","useStableCallback","useClosingRouteKeys","keysRef","Set","shared","add","key","keys","current","has","modify","prev","includes","push","remove","delete","index","indexOf","splice","clear","size","length","ref"],"sourceRoot":"../../../../../../../src","sources":["integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,cAAc,QAAQ,yBAAyB;AACxD,OAAOC,iBAAiB,MAAM,0CAA0C;AAExE,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,OAAO,GAAGJ,MAAM,CAAc,IAAIK,GAAG,CAAC,CAAC,CAAC;EAC9C,MAAMC,MAAM,GAAGL,cAAc,CAAW,EAAE,CAAC;EAE3C,MAAMM,GAAG,GAAGL,iBAAiB,CAAEM,GAAW,IAA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ACNK;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef } from "react";
4
+ export const usePrevious = value => {
5
+ const ref = useRef(null);
6
+ useEffect(() => {
7
+ ref.current = value;
8
+ });
9
+ return ref.current;
10
+ };
11
+ //# sourceMappingURL=use-previous.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","usePrevious","value","ref","current"],"sourceRoot":"../../../../../../../src","sources":["integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,MAAMC,WAAW,GAAQC,KAAQ,IAAe;EACtD,MAAMC,GAAG,GAAGH,MAAM,CAAI,IAAI,CAAC;EAE3BD,SAAS,CAAC,MAAM;IACfI,GAAG,CAACC,OAAO,GAAGF,KAAK;EACpB,CAAC,CAAC;EAEF,OAAOC,GAAG,CAACC,OAAO;AACnB,CAAC","ignoreList":[]}
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+
3
+ import { StackActions } from "@react-navigation/native";
4
+ import { useLayoutEffect, useState } from "react";
5
+ import useStableCallback from "../../../../../hooks/use-stable-callback";
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
+ * Aligns current routes with the latest route data while preserving references
14
+ * when possible for performance optimization
15
+ */
16
+ const alignRoutesWithLatest = (currentRoutes, currentDescriptors, nextRoutes, nextDescriptors) => {
17
+ // Early return for empty current routes
18
+ if (currentRoutes.length === 0) {
19
+ return {
20
+ routes: nextRoutes,
21
+ descriptors: composeDescriptors(nextRoutes, nextDescriptors, currentDescriptors)
22
+ };
23
+ }
24
+
25
+ // Create lookup map for efficient route finding
26
+ const nextRouteLookup = new Map();
27
+ for (const route of nextRoutes) {
28
+ nextRouteLookup.set(route.key, route);
29
+ }
30
+
31
+ // Track if any changes occurred
32
+ let didChange = currentRoutes.length !== nextRoutes.length;
33
+
34
+ // Align routes, updating references where needed
35
+ const alignedRoutes = currentRoutes.map(route => {
36
+ const nextRoute = nextRouteLookup.get(route.key);
37
+ if (!nextRoute) {
38
+ return route; // Keep current route if not in next
39
+ }
40
+ if (nextRoute !== route) {
41
+ didChange = true;
42
+ return nextRoute; // Update to new route reference
43
+ }
44
+ return route; // Keep current route reference
45
+ });
46
+
47
+ // Only create new array if changes occurred
48
+ const routesResult = didChange ? alignedRoutes : currentRoutes;
49
+ return {
50
+ routes: routesResult,
51
+ descriptors: composeDescriptors(routesResult, nextDescriptors, currentDescriptors)
52
+ };
53
+ };
54
+
55
+ /**
56
+ * Synchronizes routes while handling removed routes that may still be animating out.
57
+ * This manages the complex logic of keeping closing routes visible during transitions.
58
+ */
59
+ const syncRoutesWithRemoved = ({
60
+ prevRoutes,
61
+ prevDescriptors,
62
+ nextRoutes,
63
+ nextDescriptors,
64
+ closingRouteKeys
65
+ }) => {
66
+ if (nextRoutes.length === 0) {
67
+ closingRouteKeys.clear();
68
+ return {
69
+ routes: nextRoutes,
70
+ descriptors: {}
71
+ };
72
+ }
73
+
74
+ // Start with next routes, will mutate if needed
75
+ let derivedRoutes = nextRoutes;
76
+ let mutated = false;
77
+
78
+ // Helper to ensure we're working with a mutable copy
79
+ const ensureMutable = () => {
80
+ if (!mutated) {
81
+ derivedRoutes = derivedRoutes.slice();
82
+ mutated = true;
83
+ }
84
+ };
85
+
86
+ // Get focused (last) routes for comparison
87
+ const previousFocusedRoute = prevRoutes[prevRoutes.length - 1];
88
+ const nextFocusedRoute = nextRoutes[nextRoutes.length - 1];
89
+
90
+ // Handle focus changes between routes
91
+ if (previousFocusedRoute && nextFocusedRoute && previousFocusedRoute.key !== nextFocusedRoute.key) {
92
+ const nextRouteWasPresent = prevRoutes.some(route => route.key === nextFocusedRoute.key);
93
+ const previousRouteStillPresent = nextRoutes.some(route => route.key === previousFocusedRoute.key);
94
+ if (nextRouteWasPresent && !previousRouteStillPresent) {
95
+ // Previous route was removed, mark as closing
96
+ closingRouteKeys.add(previousFocusedRoute.key);
97
+ ensureMutable();
98
+ derivedRoutes.push(previousFocusedRoute);
99
+ } else {
100
+ // Next route is now active, not closing
101
+ closingRouteKeys.remove(nextFocusedRoute.key);
102
+ if (!previousRouteStillPresent) {
103
+ // Previous route needs to be inserted for transition
104
+ closingRouteKeys.remove(previousFocusedRoute.key);
105
+ ensureMutable();
106
+ const insertIndex = Math.max(derivedRoutes.length - 1, 0);
107
+ derivedRoutes.splice(insertIndex, 0, previousFocusedRoute);
108
+ }
109
+ }
110
+ } else if (nextFocusedRoute) {
111
+ // Same focused route, ensure it's not marked as closing
112
+ closingRouteKeys.remove(nextFocusedRoute.key);
113
+ }
114
+
115
+ // Clean up closing keys that are no longer in the route list
116
+ const activeKeys = new Set(derivedRoutes.map(route => route.key));
117
+ for (const key of Array.from(closingRouteKeys.ref.current)) {
118
+ if (!activeKeys.has(key)) {
119
+ closingRouteKeys.remove(key);
120
+ }
121
+ }
122
+ const routesResult = mutated ? derivedRoutes : nextRoutes;
123
+ return {
124
+ routes: routesResult,
125
+ descriptors: composeDescriptors(routesResult, nextDescriptors, prevDescriptors)
126
+ };
127
+ };
128
+ export const useStackNavigationState = props => {
129
+ const previousRoutes = usePrevious(props.state.routes) ?? [];
130
+ const closingRouteKeys = useClosingRouteKeys();
131
+ const [localState, setLocalState] = useState(() => ({
132
+ routes: props.state.routes,
133
+ descriptors: props.descriptors
134
+ }));
135
+ useLayoutEffect(() => {
136
+ const nextRoutesSnapshot = props.state.routes;
137
+ const previousRoutesSnapshot = previousRoutes;
138
+ setLocalState(current => {
139
+ const routeKeysUnchanged = haveSameRouteKeys(previousRoutesSnapshot, nextRoutesSnapshot);
140
+ let derivedRoutes;
141
+ let derivedDescriptors;
142
+ if (routeKeysUnchanged) {
143
+ const result = alignRoutesWithLatest(current.routes, current.descriptors, nextRoutesSnapshot, props.descriptors);
144
+ derivedRoutes = result.routes;
145
+ derivedDescriptors = result.descriptors;
146
+ } else {
147
+ const fallbackRoutes = previousRoutesSnapshot.length > 0 ? previousRoutesSnapshot : current.routes;
148
+ const result = syncRoutesWithRemoved({
149
+ prevRoutes: fallbackRoutes,
150
+ prevDescriptors: current.descriptors,
151
+ nextRoutes: nextRoutesSnapshot,
152
+ nextDescriptors: props.descriptors,
153
+ closingRouteKeys
154
+ });
155
+ derivedRoutes = result.routes;
156
+ derivedDescriptors = result.descriptors;
157
+ }
158
+ const routesChanged = !routesAreIdentical(current.routes, derivedRoutes);
159
+ const descriptorsChanged = !areDescriptorsEqual(current.descriptors, derivedDescriptors);
160
+ if (!routesChanged && !descriptorsChanged) {
161
+ return current;
162
+ }
163
+ return {
164
+ routes: routesChanged ? derivedRoutes : current.routes,
165
+ descriptors: descriptorsChanged ? derivedDescriptors : current.descriptors
166
+ };
167
+ });
168
+ }, [props.state.routes, props.descriptors, previousRoutes, closingRouteKeys]);
169
+ const handleCloseRoute = useStableCallback(({
170
+ route
171
+ }) => {
172
+ if (props.state.routes.some(r => r.key === route.key)) {
173
+ props.navigation.dispatch({
174
+ ...StackActions.pop(),
175
+ source: route.key,
176
+ target: props.state.key
177
+ });
178
+ return;
179
+ }
180
+ closingRouteKeys.remove(route.key);
181
+ setLocalState(current => {
182
+ if (!current.routes.some(candidate => candidate.key === route.key)) {
183
+ return current;
184
+ }
185
+ const nextRoutes = current.routes.filter(candidate => candidate.key !== route.key);
186
+ const nextDescriptors = {
187
+ ...current.descriptors
188
+ };
189
+ delete nextDescriptors[route.key];
190
+ return {
191
+ routes: nextRoutes,
192
+ descriptors: nextDescriptors
193
+ };
194
+ });
195
+ });
196
+ return {
197
+ state: localState,
198
+ handleCloseRoute,
199
+ closingRouteKeys
200
+ };
201
+ };
202
+ //# sourceMappingURL=use-stack-navigation-state.js.map