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
@@ -1,38 +1,50 @@
1
1
  import { createContext, useContext, useMemo } from "react";
2
- import type { NativeStackDescriptor } from "../types/navigator";
3
-
4
- interface KeysContextType {
5
- previous?: NativeStackDescriptor;
6
- current: NativeStackDescriptor;
7
- next?: NativeStackDescriptor;
8
- }
9
-
10
- const KeysContext = createContext<KeysContextType | undefined>(undefined);
11
-
12
- interface KeysProviderProps {
13
- children: React.ReactNode;
14
- previous?: NativeStackDescriptor;
15
- current: NativeStackDescriptor;
16
- next?: NativeStackDescriptor;
17
- }
18
-
19
- export const KeysProvider = ({
20
- children,
21
- previous,
22
- current,
23
- next,
24
- }: KeysProviderProps) => {
25
- const value = useMemo(
26
- () => ({ previous, current, next }),
27
- [previous, current, next],
28
- );
29
- return <KeysContext.Provider value={value}>{children}</KeysContext.Provider>;
2
+ import type { Descriptor } from "@react-navigation/native";
3
+ import type { NativeStackDescriptor } from "../types/native-stack.navigator";
4
+
5
+ type AnyDescriptor = Descriptor<any, any, any>;
6
+
7
+ type KeysContextValue = {
8
+ previous?: AnyDescriptor;
9
+ current: AnyDescriptor;
10
+ next?: AnyDescriptor;
11
+ };
12
+
13
+ type KeysProviderProps<DescriptorType extends AnyDescriptor> = {
14
+ children: React.ReactNode;
15
+ previous?: DescriptorType;
16
+ current: DescriptorType;
17
+ next?: DescriptorType;
18
+ };
19
+
20
+ type KeysContextType<DescriptorType extends AnyDescriptor> = {
21
+ previous?: DescriptorType;
22
+ current: DescriptorType;
23
+ next?: DescriptorType;
24
+ };
25
+
26
+ const KeysContext = createContext<KeysContextValue | undefined>(undefined);
27
+
28
+ export const KeysProvider = <DescriptorType extends AnyDescriptor>({
29
+ children,
30
+ previous,
31
+ current,
32
+ next,
33
+ }: KeysProviderProps<DescriptorType>) => {
34
+ const value = useMemo(
35
+ () => ({ previous, current, next }),
36
+ [previous, current, next]
37
+ ) as KeysContextValue;
38
+
39
+ return <KeysContext.Provider value={value}>{children}</KeysContext.Provider>;
30
40
  };
31
41
 
32
- export const useKeys = (): KeysContextType => {
33
- const context = useContext(KeysContext);
34
- if (context === undefined) {
35
- throw new Error("useKeys must be used within a KeysProvider");
36
- }
37
- return context;
42
+ export const useKeys = <
43
+ DescriptorType extends AnyDescriptor = NativeStackDescriptor
44
+ >(): KeysContextType<DescriptorType> => {
45
+ const context = useContext(KeysContext);
46
+ if (context === undefined) {
47
+ throw new Error("useKeys must be used within a KeysProvider");
48
+ }
49
+ return context as KeysContextType<DescriptorType>;
38
50
  };
@@ -1,8 +1,9 @@
1
1
  import { createContext, useContext, useMemo } from "react";
2
- import { isWorkletFunction, useDerivedValue } from "react-native-reanimated";
2
+ import { useDerivedValue } from "react-native-reanimated";
3
3
  import { NO_STYLES } from "../constants";
4
4
  import { _useScreenAnimation } from "../hooks/animation/use-screen-animation";
5
5
  import type { TransitionInterpolatedStyle } from "../types/animation";
6
+ import { createBounds } from "../utils/bounds";
6
7
 
7
8
  type Props = {
8
9
  children: React.ReactNode;
@@ -18,21 +19,33 @@ export function TransitionStylesProvider({ children }: Props) {
18
19
  const { screenInterpolatorProps, screenStyleInterpolator } =
19
20
  _useScreenAnimation();
20
21
 
21
- const isFunctionWorklet = isWorkletFunction(screenStyleInterpolator);
22
-
23
22
  const stylesMap = useDerivedValue<TransitionInterpolatedStyle>(() => {
24
23
  "worklet";
25
24
 
26
- if (screenStyleInterpolator && !isFunctionWorklet && __DEV__) {
27
- console.warn(
28
- `[react-native-screen-transitions] screenStyleInterpolator is not a worklet function`,
29
- );
25
+ /**
26
+ * ### Maintainer note
27
+ *
28
+ * From my understanding, reanimated will serialize the DerivedValue result. Thus resulting in us receiving a `bounds is not a function, it is an object` error. We'll build the bounds function inside here (the final step) and pass it alongside the interpolator instead.
29
+ */
30
+ const props = screenInterpolatorProps.value;
31
+
32
+ const bounds = createBounds(props);
33
+ try {
34
+ if (!screenStyleInterpolator) return NO_STYLES;
35
+
36
+ return screenStyleInterpolator({
37
+ ...props,
38
+ bounds,
39
+ });
40
+ } catch (err) {
41
+ if (__DEV__) {
42
+ console.warn(
43
+ "[react-native-screen-transitions] screenStyleInterpolator must be a worklet",
44
+ err,
45
+ );
46
+ }
30
47
  return NO_STYLES;
31
48
  }
32
-
33
- return screenStyleInterpolator
34
- ? screenStyleInterpolator(screenInterpolatorProps.value)
35
- : NO_STYLES;
36
49
  });
37
50
 
38
51
  const value = useMemo(() => {
@@ -1,45 +1,45 @@
1
1
  import { makeMutable, type SharedValue } from "react-native-reanimated";
2
- import type { ScreenKey } from "../types/navigator";
2
+ import type { ScreenKey } from "../types/native-stack.navigator";
3
3
 
4
4
  export type AnimationMap = {
5
- progress: SharedValue<number>;
6
- closing: SharedValue<number>;
7
- animating: SharedValue<number>;
5
+ progress: SharedValue<number>;
6
+ closing: SharedValue<number>;
7
+ animating: SharedValue<number>;
8
8
  };
9
9
 
10
10
  const store: Record<ScreenKey, AnimationMap> = {};
11
11
 
12
12
  const ensure = (key: ScreenKey) => {
13
- let bag = store[key];
14
- if (!bag) {
15
- bag = {
16
- progress: makeMutable(0),
17
- closing: makeMutable(0),
18
- animating: makeMutable(0),
19
- };
20
- store[key] = bag;
21
- }
22
- return bag;
13
+ let bag = store[key];
14
+ if (!bag) {
15
+ bag = {
16
+ progress: makeMutable(0),
17
+ closing: makeMutable(0),
18
+ animating: makeMutable(0),
19
+ };
20
+ store[key] = bag;
21
+ }
22
+ return bag;
23
23
  };
24
24
 
25
25
  export function getAnimation(
26
- key: ScreenKey,
27
- type: "progress" | "closing" | "animating",
26
+ key: ScreenKey,
27
+ type: "progress" | "closing" | "animating"
28
28
  ): SharedValue<number> {
29
- return ensure(key)[type];
29
+ return ensure(key)[type];
30
30
  }
31
31
 
32
32
  export function getAll(key: ScreenKey) {
33
- return ensure(key);
33
+ return ensure(key);
34
34
  }
35
35
 
36
36
  function clear(routeKey: ScreenKey) {
37
- "worklet";
38
- delete store[routeKey];
37
+ "worklet";
38
+ delete store[routeKey];
39
39
  }
40
40
 
41
41
  export const Animations = {
42
- getAnimation,
43
- clear,
44
- getAll,
42
+ getAnimation,
43
+ clear,
44
+ getAll,
45
45
  };
@@ -1,16 +1,16 @@
1
1
  import {
2
- type MeasuredDimensions,
3
- makeMutable,
4
- type StyleProps,
2
+ type MeasuredDimensions,
3
+ makeMutable,
4
+ type StyleProps,
5
5
  } from "react-native-reanimated";
6
6
  import type { ScreenTransitionState } from "../../types/animation";
7
- import type { ScreenKey } from "../../types/navigator";
7
+ import type { ScreenKey } from "../../types/native-stack.navigator";
8
8
  import type { Any } from "../../types/utils";
9
9
  import { pairKey, resolveActiveBound } from "./_utils";
10
10
 
11
11
  type BoundsDict = Record<
12
- string,
13
- Record<string, { bounds: MeasuredDimensions; styles: StyleProps }>
12
+ string,
13
+ Record<string, { bounds: MeasuredDimensions; styles: StyleProps }>
14
14
  >;
15
15
 
16
16
  const registry = makeMutable<BoundsDict>({});
@@ -18,108 +18,108 @@ const pairCache = makeMutable<Record<string, string>>({});
18
18
  const lastActiveByRoute = makeMutable<Record<string, string>>({});
19
19
 
20
20
  function setBounds(
21
- screenId: string,
22
- boundId: string,
23
- bounds: MeasuredDimensions | null = null,
24
- styles: StyleProps = {},
21
+ screenId: string,
22
+ boundId: string,
23
+ bounds: MeasuredDimensions | null = null,
24
+ styles: StyleProps = {}
25
25
  ) {
26
- "worklet";
27
- registry.modify((state: Any) => {
28
- "worklet";
29
- if (!state[screenId]) {
30
- state[screenId] = {};
31
- }
32
- state[screenId][boundId] = { bounds, styles };
26
+ "worklet";
27
+ registry.modify((state: Any) => {
28
+ "worklet";
29
+ if (!state[screenId]) {
30
+ state[screenId] = {};
31
+ }
32
+ state[screenId][boundId] = { bounds, styles };
33
33
 
34
- return state;
35
- });
34
+ return state;
35
+ });
36
36
  }
37
37
 
38
38
  function getBounds(screenId: string) {
39
- "worklet";
40
- return registry.value[screenId] ?? {};
39
+ "worklet";
40
+ return registry.value[screenId] ?? {};
41
41
  }
42
42
 
43
43
  function setRouteActive(routeKey: string, boundId: string) {
44
- "worklet";
45
- lastActiveByRoute.modify((state: Any) => {
46
- "worklet";
47
- state[routeKey] = boundId;
48
- return state;
49
- });
44
+ "worklet";
45
+ lastActiveByRoute.modify((state: Any) => {
46
+ "worklet";
47
+ state[routeKey] = boundId;
48
+ return state;
49
+ });
50
50
  }
51
51
 
52
52
  function getRouteActive(routeKey: string) {
53
- "worklet";
54
- return lastActiveByRoute.value[routeKey] ?? null;
53
+ "worklet";
54
+ return lastActiveByRoute.value[routeKey] ?? null;
55
55
  }
56
56
 
57
57
  function setPairCache(fromKey: string, toKey: string, boundId: string) {
58
- "worklet";
59
- const key = pairKey(fromKey, toKey);
60
- if (!key) return;
61
- pairCache.modify((state: Any) => {
62
- "worklet";
63
- state[key] = boundId;
64
- return state;
65
- });
58
+ "worklet";
59
+ const key = pairKey(fromKey, toKey);
60
+ if (!key) return;
61
+ pairCache.modify((state: Any) => {
62
+ "worklet";
63
+ state[key] = boundId;
64
+ return state;
65
+ });
66
66
  }
67
67
 
68
68
  function getPairCache(fromKey: string, toKey: string) {
69
- "worklet";
70
- const key = pairKey(fromKey, toKey);
71
- if (!key) return null;
72
- return pairCache.value[key] ?? null;
69
+ "worklet";
70
+ const key = pairKey(fromKey, toKey);
71
+ if (!key) return null;
72
+ return pairCache.value[key] ?? null;
73
73
  }
74
74
 
75
75
  function clear(routeKey: ScreenKey) {
76
- "worklet";
77
- registry.modify((state) => {
78
- "worklet";
79
- delete state[routeKey];
80
- return state;
81
- });
82
- lastActiveByRoute.modify((state) => {
83
- "worklet";
84
- if (state[routeKey]) delete state[routeKey];
85
- return state;
86
- });
76
+ "worklet";
77
+ registry.modify((state) => {
78
+ "worklet";
79
+ delete state[routeKey];
80
+ return state;
81
+ });
82
+ lastActiveByRoute.modify((state) => {
83
+ "worklet";
84
+ if (state[routeKey]) delete state[routeKey];
85
+ return state;
86
+ });
87
87
 
88
- pairCache.modify((state) => {
89
- "worklet";
90
- const keys = Object.keys(state);
91
- for (let i = 0; i < keys.length; i++) {
92
- const k = keys[i];
93
- const [from, to] = k.split("|");
94
- if (from === routeKey || to === routeKey) {
95
- delete state[k];
96
- }
97
- }
98
- return state;
99
- });
88
+ pairCache.modify((state) => {
89
+ "worklet";
90
+ const keys = Object.keys(state);
91
+ for (let i = 0; i < keys.length; i++) {
92
+ const k = keys[i];
93
+ const [from, to] = k.split("|");
94
+ if (from === routeKey || to === routeKey) {
95
+ delete state[k];
96
+ }
97
+ }
98
+ return state;
99
+ });
100
100
  }
101
101
 
102
102
  function getActiveBound(
103
- current: ScreenTransitionState,
104
- next: ScreenTransitionState | undefined,
105
- previous: ScreenTransitionState | undefined,
103
+ current: ScreenTransitionState,
104
+ next: ScreenTransitionState | undefined,
105
+ previous: ScreenTransitionState | undefined
106
106
  ) {
107
- "worklet";
108
- return resolveActiveBound({
109
- current,
110
- next,
111
- previous,
112
- getPairCache,
113
- setPairCache,
114
- getRouteActive,
115
- });
107
+ "worklet";
108
+ return resolveActiveBound({
109
+ current,
110
+ next,
111
+ previous,
112
+ getPairCache,
113
+ setPairCache,
114
+ getRouteActive,
115
+ });
116
116
  }
117
117
 
118
118
  export const Bounds = {
119
- setBounds,
120
- getBounds,
121
- setRouteActive,
122
- getRouteActive,
123
- clear,
124
- getActiveBound,
119
+ setBounds,
120
+ getBounds,
121
+ setRouteActive,
122
+ getRouteActive,
123
+ clear,
124
+ getActiveBound,
125
125
  };
@@ -1,60 +1,60 @@
1
1
  import { makeMutable, type SharedValue } from "react-native-reanimated";
2
2
  import type { GestureDirection } from "../types/gesture";
3
- import type { ScreenKey } from "../types/navigator";
3
+ import type { ScreenKey } from "../types/native-stack.navigator";
4
4
 
5
5
  export type GestureKey =
6
- | "x"
7
- | "y"
8
- | "normalizedX"
9
- | "normalizedY"
10
- | "isDismissing"
11
- | "isDragging";
6
+ | "x"
7
+ | "y"
8
+ | "normalizedX"
9
+ | "normalizedY"
10
+ | "isDismissing"
11
+ | "isDragging";
12
12
 
13
13
  export type GestureMap = {
14
- x: SharedValue<number>;
15
- y: SharedValue<number>;
16
- normalizedX: SharedValue<number>;
17
- normalizedY: SharedValue<number>;
18
- isDismissing: SharedValue<number>;
19
- isDragging: SharedValue<number>;
20
- direction: SharedValue<Omit<GestureDirection, "bidirectional"> | null>;
14
+ x: SharedValue<number>;
15
+ y: SharedValue<number>;
16
+ normalizedX: SharedValue<number>;
17
+ normalizedY: SharedValue<number>;
18
+ isDismissing: SharedValue<number>;
19
+ isDragging: SharedValue<number>;
20
+ direction: SharedValue<Omit<GestureDirection, "bidirectional"> | null>;
21
21
  };
22
22
 
23
23
  const store: Record<ScreenKey, GestureMap> = {};
24
24
 
25
25
  function ensure(routeKey: ScreenKey): GestureMap {
26
- let bag = store[routeKey];
27
- if (!bag) {
28
- bag = {
29
- x: makeMutable(0),
30
- y: makeMutable(0),
31
- normalizedX: makeMutable(0),
32
- normalizedY: makeMutable(0),
33
- isDismissing: makeMutable(0),
34
- isDragging: makeMutable(0),
35
- direction: makeMutable<Omit<GestureDirection, "bidirectional"> | null>(
36
- null,
37
- ),
38
- };
39
- store[routeKey] = bag;
40
- }
41
- return bag;
26
+ let bag = store[routeKey];
27
+ if (!bag) {
28
+ bag = {
29
+ x: makeMutable(0),
30
+ y: makeMutable(0),
31
+ normalizedX: makeMutable(0),
32
+ normalizedY: makeMutable(0),
33
+ isDismissing: makeMutable(0),
34
+ isDragging: makeMutable(0),
35
+ direction: makeMutable<Omit<GestureDirection, "bidirectional"> | null>(
36
+ null
37
+ ),
38
+ };
39
+ store[routeKey] = bag;
40
+ }
41
+ return bag;
42
42
  }
43
43
 
44
44
  function getGesture(routeKey: ScreenKey, gestureKey: GestureKey) {
45
- return ensure(routeKey)[gestureKey];
45
+ return ensure(routeKey)[gestureKey];
46
46
  }
47
47
 
48
48
  function getRouteGestures(routeKey: ScreenKey) {
49
- return ensure(routeKey);
49
+ return ensure(routeKey);
50
50
  }
51
51
 
52
52
  function clear(routeKey: ScreenKey) {
53
- delete store[routeKey];
53
+ delete store[routeKey];
54
54
  }
55
55
 
56
56
  export const Gestures = {
57
- getGesture,
58
- getRouteGestures,
59
- clear,
57
+ getGesture,
58
+ getRouteGestures,
59
+ clear,
60
60
  };
@@ -1,4 +1,4 @@
1
- import type { NativeStackDescriptor } from "../../types/navigator";
1
+ import type { NativeStackDescriptor } from "../../types/native-stack.navigator";
2
2
  import { Animations } from "../animations";
3
3
  import { Bounds } from "../bounds";
4
4
  import { Gestures } from "../gestures";
@@ -7,7 +7,7 @@ import { Gestures } from "../gestures";
7
7
  * Reset all stores for a given screen
8
8
  */
9
9
  export const resetStoresForScreen = (current: NativeStackDescriptor) => {
10
- Animations.clear(current.route.key);
11
- Gestures.clear(current.route.key);
12
- Bounds.clear(current.route.key);
10
+ Animations.clear(current.route.key);
11
+ Gestures.clear(current.route.key);
12
+ Bounds.clear(current.route.key);
13
13
  };
@@ -7,6 +7,7 @@ import type {
7
7
  import type { EdgeInsets } from "react-native-safe-area-context";
8
8
  import type { BoundEntry, BoundsAccessor } from "./bounds";
9
9
  import type { GestureValues } from "./gesture";
10
+ import type { Layout } from "./native-stack.navigator";
10
11
 
11
12
  export type ScreenTransitionState = {
12
13
  progress: number;
@@ -27,10 +28,7 @@ export interface ScreenInterpolationProps {
27
28
  /** Layout measurements for the screen. */
28
29
  layouts: {
29
30
  /** The `width` and `height` of the screen container. */
30
- screen: {
31
- width: number;
32
- height: number;
33
- };
31
+ screen: Layout;
34
32
  };
35
33
  /** The safe area insets for the screen. */
36
34
  insets: EdgeInsets;