react-native-screen-transitions 2.4.0 → 2.4.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/lib/commonjs/__configs__/presets.js.map +1 -1
  2. package/lib/commonjs/components/root-transition-aware.js.map +1 -1
  3. package/lib/commonjs/constants.js.map +1 -1
  4. package/lib/commonjs/hooks/animation/use-screen-animation.js +9 -5
  5. package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
  6. package/lib/commonjs/index.js +7 -0
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/integrations/blank-stack/components/Header.js +142 -0
  9. package/lib/commonjs/integrations/blank-stack/components/Header.js.map +1 -0
  10. package/lib/commonjs/integrations/blank-stack/components/Screens.js +64 -0
  11. package/lib/commonjs/integrations/blank-stack/components/Screens.js.map +1 -0
  12. package/lib/commonjs/integrations/blank-stack/components/StackView.js +94 -0
  13. package/lib/commonjs/integrations/blank-stack/components/StackView.js.map +1 -0
  14. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js +74 -0
  15. package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  16. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +66 -0
  17. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  18. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +16 -0
  19. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  20. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +208 -0
  21. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  22. package/lib/commonjs/{types/navigator.js → integrations/blank-stack/utils/with-stack-navigation/_types.js} +1 -1
  23. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  24. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +15 -0
  25. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  26. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +23 -0
  27. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
  28. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +15 -0
  29. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  30. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +14 -0
  31. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  32. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +13 -0
  33. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  34. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js +71 -0
  35. package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  36. package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  37. package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  38. package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  39. package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -1
  40. package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  41. package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  42. package/lib/commonjs/providers/keys.js.map +1 -1
  43. package/lib/commonjs/providers/screen-transition-provider.js.map +1 -1
  44. package/lib/commonjs/providers/transition-styles.js +18 -4
  45. package/lib/commonjs/providers/transition-styles.js.map +1 -1
  46. package/lib/commonjs/stores/animations.js.map +1 -1
  47. package/lib/commonjs/stores/bounds/index.js.map +1 -1
  48. package/lib/commonjs/stores/gestures.js.map +1 -1
  49. package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
  50. package/lib/commonjs/types/blank-stack.navigator.js +6 -0
  51. package/lib/commonjs/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
  52. package/lib/commonjs/types/native-stack.navigator.js +6 -0
  53. package/lib/commonjs/types/native-stack.navigator.js.map +1 -0
  54. package/lib/commonjs/utils/animation/derivations.js +1 -14
  55. package/lib/commonjs/utils/animation/derivations.js.map +1 -1
  56. package/lib/commonjs/utils/bounds/_utils/styles.js.map +1 -1
  57. package/lib/commonjs/utils/bounds/constants.js.map +1 -1
  58. package/lib/commonjs/utils/bounds/index.js +23 -90
  59. package/lib/commonjs/utils/bounds/index.js.map +1 -1
  60. package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -1
  61. package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -1
  62. package/lib/commonjs/utils/gesture/reset-gesture-values.js.map +1 -1
  63. package/lib/commonjs/utils/gesture/velocity.js +2 -2
  64. package/lib/commonjs/utils/gesture/velocity.js.map +1 -1
  65. package/lib/module/__configs__/presets.js.map +1 -1
  66. package/lib/module/components/root-transition-aware.js.map +1 -1
  67. package/lib/module/constants.js.map +1 -1
  68. package/lib/module/hooks/animation/use-screen-animation.js +9 -5
  69. package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
  70. package/lib/module/index.js +1 -0
  71. package/lib/module/index.js.map +1 -1
  72. package/lib/module/integrations/blank-stack/components/Header.js +138 -0
  73. package/lib/module/integrations/blank-stack/components/Header.js.map +1 -0
  74. package/lib/module/integrations/blank-stack/components/Screens.js +58 -0
  75. package/lib/module/integrations/blank-stack/components/Screens.js.map +1 -0
  76. package/lib/module/integrations/blank-stack/components/StackView.js +90 -0
  77. package/lib/module/integrations/blank-stack/components/StackView.js.map +1 -0
  78. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js +68 -0
  79. package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
  80. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +60 -0
  81. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
  82. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +11 -0
  83. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
  84. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +202 -0
  85. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
  86. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js +4 -0
  87. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
  88. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +10 -0
  89. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
  90. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +19 -0
  91. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
  92. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +10 -0
  93. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
  94. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +9 -0
  95. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
  96. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +8 -0
  97. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
  98. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js +65 -0
  99. package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
  100. package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  101. package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
  102. package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
  103. package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -1
  104. package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
  105. package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
  106. package/lib/module/providers/keys.js.map +1 -1
  107. package/lib/module/providers/screen-transition-provider.js.map +1 -1
  108. package/lib/module/providers/transition-styles.js +19 -5
  109. package/lib/module/providers/transition-styles.js.map +1 -1
  110. package/lib/module/stores/animations.js.map +1 -1
  111. package/lib/module/stores/bounds/index.js.map +1 -1
  112. package/lib/module/stores/gestures.js.map +1 -1
  113. package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
  114. package/lib/module/types/blank-stack.navigator.js +4 -0
  115. package/lib/module/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
  116. package/lib/module/types/native-stack.navigator.js +4 -0
  117. package/lib/module/types/native-stack.navigator.js.map +1 -0
  118. package/lib/module/utils/animation/derivations.js +1 -14
  119. package/lib/module/utils/animation/derivations.js.map +1 -1
  120. package/lib/module/utils/bounds/_utils/styles.js.map +1 -1
  121. package/lib/module/utils/bounds/constants.js.map +1 -1
  122. package/lib/module/utils/bounds/index.js +24 -91
  123. package/lib/module/utils/bounds/index.js.map +1 -1
  124. package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -1
  125. package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -1
  126. package/lib/module/utils/gesture/reset-gesture-values.js.map +1 -1
  127. package/lib/module/utils/gesture/velocity.js +2 -2
  128. package/lib/module/utils/gesture/velocity.js.map +1 -1
  129. package/lib/typescript/__configs__/index.d.ts +9 -9
  130. package/lib/typescript/__configs__/index.d.ts.map +1 -1
  131. package/lib/typescript/__configs__/presets.d.ts +1 -1
  132. package/lib/typescript/__configs__/presets.d.ts.map +1 -1
  133. package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
  134. package/lib/typescript/constants.d.ts +2 -2
  135. package/lib/typescript/constants.d.ts.map +1 -1
  136. package/lib/typescript/hooks/animation/use-screen-animation.d.ts +1 -1
  137. package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
  138. package/lib/typescript/index.d.ts +20 -18
  139. package/lib/typescript/index.d.ts.map +1 -1
  140. package/lib/typescript/integrations/blank-stack/components/Header.d.ts +5 -0
  141. package/lib/typescript/integrations/blank-stack/components/Header.d.ts.map +1 -0
  142. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts +15 -0
  143. package/lib/typescript/integrations/blank-stack/components/Screens.d.ts.map +1 -0
  144. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts +2 -0
  145. package/lib/typescript/integrations/blank-stack/components/StackView.d.ts.map +1 -0
  146. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts +109 -0
  147. package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts.map +1 -0
  148. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts +8 -0
  149. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts.map +1 -0
  150. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts +2 -0
  151. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts.map +1 -0
  152. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts +20 -0
  153. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts.map +1 -0
  154. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts +23 -0
  155. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts.map +1 -0
  156. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts +3 -0
  157. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts.map +1 -0
  158. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts +4 -0
  159. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts.map +1 -0
  160. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts +4 -0
  161. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts.map +1 -0
  162. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts +3 -0
  163. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts.map +1 -0
  164. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts +3 -0
  165. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts.map +1 -0
  166. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts +6 -0
  167. package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts.map +1 -0
  168. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +1 -1
  169. package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
  170. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +1 -1
  171. package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -1
  172. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +1 -1
  173. package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -1
  174. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +1 -1
  175. package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -1
  176. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +1 -1
  177. package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  178. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +1 -1
  179. package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
  180. package/lib/typescript/providers/keys.d.ts +1 -1
  181. package/lib/typescript/providers/keys.d.ts.map +1 -1
  182. package/lib/typescript/providers/screen-transition-provider.d.ts +1 -1
  183. package/lib/typescript/providers/screen-transition-provider.d.ts.map +1 -1
  184. package/lib/typescript/providers/transition-styles.d.ts.map +1 -1
  185. package/lib/typescript/stores/animations.d.ts +1 -1
  186. package/lib/typescript/stores/animations.d.ts.map +1 -1
  187. package/lib/typescript/stores/bounds/index.d.ts +1 -1
  188. package/lib/typescript/stores/bounds/index.d.ts.map +1 -1
  189. package/lib/typescript/stores/gestures.d.ts +1 -1
  190. package/lib/typescript/stores/gestures.d.ts.map +1 -1
  191. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +1 -1
  192. package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
  193. package/lib/typescript/types/animation.d.ts +2 -4
  194. package/lib/typescript/types/animation.d.ts.map +1 -1
  195. package/lib/typescript/types/blank-stack.navigator.d.ts +219 -0
  196. package/lib/typescript/types/blank-stack.navigator.d.ts.map +1 -0
  197. package/lib/typescript/types/bounds.d.ts +0 -57
  198. package/lib/typescript/types/bounds.d.ts.map +1 -1
  199. package/lib/typescript/types/{navigator.d.ts → native-stack.navigator.d.ts} +5 -1
  200. package/lib/typescript/types/native-stack.navigator.d.ts.map +1 -0
  201. package/lib/typescript/types/utils.d.ts.map +1 -1
  202. package/lib/typescript/utils/animation/derivations.d.ts +1 -4
  203. package/lib/typescript/utils/animation/derivations.d.ts.map +1 -1
  204. package/lib/typescript/utils/bounds/_types/builder.d.ts +2 -2
  205. package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
  206. package/lib/typescript/utils/bounds/_utils/geometry.d.ts +2 -2
  207. package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -1
  208. package/lib/typescript/utils/bounds/_utils/styles.d.ts +2 -1
  209. package/lib/typescript/utils/bounds/_utils/styles.d.ts.map +1 -1
  210. package/lib/typescript/utils/bounds/constants.d.ts +2 -2
  211. package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
  212. package/lib/typescript/utils/bounds/index.d.ts +4 -4
  213. package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
  214. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +2 -2
  215. package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -1
  216. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +2 -2
  217. package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -1
  218. package/lib/typescript/utils/gesture/reset-gesture-values.d.ts.map +1 -1
  219. package/lib/typescript/utils/gesture/velocity.d.ts +1 -1
  220. package/lib/typescript/utils/gesture/velocity.d.ts.map +1 -1
  221. package/package.json +1 -1
  222. package/src/__configs__/presets.ts +590 -590
  223. package/src/components/root-transition-aware.tsx +27 -27
  224. package/src/constants.ts +47 -47
  225. package/src/hooks/animation/use-screen-animation.tsx +52 -47
  226. package/src/index.ts +33 -22
  227. package/src/integrations/blank-stack/components/Header.tsx +143 -0
  228. package/src/integrations/blank-stack/components/Screens.tsx +96 -0
  229. package/src/integrations/blank-stack/components/StackView.tsx +106 -0
  230. package/src/integrations/blank-stack/navigators/createBlankStackNavigator.tsx +122 -0
  231. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.tsx +62 -0
  232. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.tsx +11 -0
  233. package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.tsx +280 -0
  234. package/src/integrations/blank-stack/utils/with-stack-navigation/_types.ts +36 -0
  235. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.ts +15 -0
  236. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.ts +29 -0
  237. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.ts +17 -0
  238. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.ts +12 -0
  239. package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.ts +11 -0
  240. package/src/integrations/blank-stack/utils/with-stack-navigation/index.tsx +93 -0
  241. package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +95 -95
  242. package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +14 -14
  243. package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +23 -23
  244. package/src/integrations/native-stack/views/NativeStackView.native.tsx +608 -608
  245. package/src/integrations/native-stack/views/NativeStackView.tsx +188 -188
  246. package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +260 -260
  247. package/src/providers/keys.tsx +22 -22
  248. package/src/providers/screen-transition-provider.tsx +20 -20
  249. package/src/providers/transition-styles.tsx +24 -11
  250. package/src/stores/animations.ts +23 -23
  251. package/src/stores/bounds/index.ts +82 -82
  252. package/src/stores/gestures.ts +36 -36
  253. package/src/stores/utils/reset-stores-for-screen.ts +4 -4
  254. package/src/types/animation.ts +2 -4
  255. package/src/types/blank-stack.navigator.ts +271 -0
  256. package/src/types/bounds.ts +0 -64
  257. package/src/types/{navigator.ts → native-stack.navigator.ts} +5 -0
  258. package/src/types/utils.ts +1 -0
  259. package/src/utils/animation/derivations.ts +3 -20
  260. package/src/utils/bounds/_types/builder.ts +111 -111
  261. package/src/utils/bounds/_utils/geometry.ts +2 -2
  262. package/src/utils/bounds/_utils/styles.ts +2 -1
  263. package/src/utils/bounds/constants.ts +29 -29
  264. package/src/utils/bounds/index.ts +35 -105
  265. package/src/utils/gesture/apply-offset-rules.ts +271 -271
  266. package/src/utils/gesture/check-gesture-activation.ts +260 -260
  267. package/src/utils/gesture/reset-gesture-values.ts +1 -0
  268. package/src/utils/gesture/velocity.ts +1 -2
  269. package/lib/module/types/navigator.js +0 -4
  270. package/lib/typescript/types/navigator.d.ts.map +0 -1
@@ -5,40 +5,40 @@ import { NO_STYLES } from "../constants";
5
5
  import { useTransitionStyles } from "../providers/transition-styles";
6
6
 
7
7
  type Props = {
8
- children: React.ReactNode;
8
+ children: React.ReactNode;
9
9
  };
10
10
 
11
11
  export const RootTransitionAware = memo(({ children }: Props) => {
12
- const { stylesMap } = useTransitionStyles();
12
+ const { stylesMap } = useTransitionStyles();
13
13
 
14
- const animatedContentStyle = useAnimatedStyle(() => {
15
- "worklet";
16
- return stylesMap.value.contentStyle || NO_STYLES;
17
- });
14
+ const animatedContentStyle = useAnimatedStyle(() => {
15
+ "worklet";
16
+ return stylesMap.value.contentStyle || NO_STYLES;
17
+ });
18
18
 
19
- const animatedOverlayStyle = useAnimatedStyle(() => {
20
- "worklet";
21
- return stylesMap.value.overlayStyle || NO_STYLES;
22
- });
19
+ const animatedOverlayStyle = useAnimatedStyle(() => {
20
+ "worklet";
21
+ return stylesMap.value.overlayStyle || NO_STYLES;
22
+ });
23
23
 
24
- return (
25
- <View style={styles.container}>
26
- <Animated.View
27
- style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
28
- pointerEvents="none"
29
- />
30
- <Animated.View style={[styles.content, animatedContentStyle]}>
31
- {children}
32
- </Animated.View>
33
- </View>
34
- );
24
+ return (
25
+ <View style={styles.container}>
26
+ <Animated.View
27
+ style={[StyleSheet.absoluteFillObject, animatedOverlayStyle]}
28
+ pointerEvents="none"
29
+ />
30
+ <Animated.View style={[styles.content, animatedContentStyle]}>
31
+ {children}
32
+ </Animated.View>
33
+ </View>
34
+ );
35
35
  });
36
36
 
37
37
  const styles = StyleSheet.create({
38
- container: {
39
- flex: 1,
40
- },
41
- content: {
42
- flex: 1,
43
- },
38
+ container: {
39
+ flex: 1,
40
+ },
41
+ content: {
42
+ flex: 1,
43
+ },
44
44
  });
package/src/constants.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { ParamListBase, RouteProp } from "@react-navigation/native";
2
- import type { ScaledSize } from "react-native";
3
2
  import type { MeasuredDimensions } from "react-native-reanimated";
4
3
  import type { ScreenTransitionState } from "./types/animation";
5
4
  import type { BoundEntry } from "./types/bounds";
6
5
  import type { ActivationArea } from "./types/gesture";
6
+ import type { Layout } from "./types/native-stack.navigator";
7
7
  import type { Complete } from "./types/utils";
8
8
  import type { BoundsBuilderOptions } from "./utils/bounds/_types/builder";
9
9
 
@@ -22,22 +22,22 @@ export const NO_STYLES = Object.freeze({});
22
22
  * Default screen transition state
23
23
  */
24
24
  export const DEFAULT_SCREEN_TRANSITION_STATE: ScreenTransitionState =
25
- Object.freeze({
26
- progress: 0,
27
- closing: 0,
28
- animating: 0,
29
- gesture: {
30
- x: 0,
31
- y: 0,
32
- normalizedX: 0,
33
- normalizedY: 0,
34
- isDismissing: 0,
35
- isDragging: 0,
36
- direction: null,
37
- },
38
- bounds: {} as Record<string, BoundEntry>,
39
- route: {} as RouteProp<ParamListBase>,
40
- });
25
+ Object.freeze({
26
+ progress: 0,
27
+ closing: 0,
28
+ animating: 0,
29
+ gesture: {
30
+ x: 0,
31
+ y: 0,
32
+ normalizedX: 0,
33
+ normalizedY: 0,
34
+ isDismissing: 0,
35
+ isDragging: 0,
36
+ direction: null,
37
+ },
38
+ bounds: {} as Record<string, BoundEntry>,
39
+ route: {} as RouteProp<ParamListBase>,
40
+ });
41
41
 
42
42
  /**
43
43
  * Bounds API Defaults
@@ -45,46 +45,46 @@ export const DEFAULT_SCREEN_TRANSITION_STATE: ScreenTransitionState =
45
45
  export const NO_BOUNDS_MAP: Record<string, BoundEntry> = Object.freeze({});
46
46
  export const EMPTY_BOUND_HELPER_RESULT = Object.freeze({});
47
47
  export const EMPTY_BOUND_HELPER_RESULT_RAW = Object.freeze({
48
- scaleX: 1,
49
- scaleY: 1,
50
- scale: 1,
51
- translateX: 0,
52
- translateY: 0,
53
- width: 0,
54
- height: 0,
48
+ scaleX: 1,
49
+ scaleY: 1,
50
+ scale: 1,
51
+ translateX: 0,
52
+ translateY: 0,
53
+ width: 0,
54
+ height: 0,
55
55
  });
56
56
  export const ENTER_RANGE = [0, 1] as const;
57
57
  export const EXIT_RANGE = [1, 2] as const;
58
58
 
59
59
  export const FULLSCREEN_DIMENSIONS = (
60
- dimensions: ScaledSize,
60
+ dimensions: Layout
61
61
  ): MeasuredDimensions => {
62
- "worklet";
63
- return {
64
- x: 0,
65
- y: 0,
66
- pageX: 0,
67
- pageY: 0,
68
- width: dimensions.width,
69
- height: dimensions.height,
70
- };
62
+ "worklet";
63
+ return {
64
+ x: 0,
65
+ y: 0,
66
+ pageX: 0,
67
+ pageY: 0,
68
+ width: dimensions.width,
69
+ height: dimensions.height,
70
+ };
71
71
  };
72
72
 
73
73
  export const DEFAULT_BUILDER_OPTIONS: Complete<
74
- Omit<BoundsBuilderOptions, "id">
74
+ Omit<BoundsBuilderOptions, "id">
75
75
  > = Object.freeze({
76
- gestures: { x: 0, y: 0 },
77
- toFullscreen: false,
78
- absolute: false,
79
- relative: true,
80
- method: "transform",
81
- contentScaleMode: "auto",
82
- //
83
- space: "relative",
84
- target: "bound",
85
- scaleMode: "match",
86
- anchor: "center",
87
- raw: false,
76
+ gestures: { x: 0, y: 0 },
77
+ toFullscreen: false,
78
+ absolute: false,
79
+ relative: true,
80
+ method: "transform",
81
+ contentScaleMode: "auto",
82
+ //
83
+ space: "relative",
84
+ target: "bound",
85
+ scaleMode: "match",
86
+ anchor: "center",
87
+ raw: false,
88
88
  } as const);
89
89
 
90
90
  /**
@@ -16,8 +16,9 @@ import type {
16
16
  ScreenTransitionState,
17
17
  } from "../../types/animation";
18
18
 
19
- import type { NativeStackDescriptor } from "../../types/navigator";
19
+ import type { NativeStackDescriptor } from "../../types/native-stack.navigator";
20
20
  import { derivations } from "../../utils/animation/derivations";
21
+ import { createBounds } from "../../utils/bounds";
21
22
 
22
23
  type BuiltState = {
23
24
  progress: SharedValue<number>;
@@ -84,51 +85,49 @@ export function _useScreenAnimation() {
84
85
  const nextAnimation = useBuildScreenTransitionState(nextDescriptor);
85
86
  const prevAnimation = useBuildScreenTransitionState(previousDescriptor);
86
87
 
87
- const screenInterpolatorProps = useDerivedValue<ScreenInterpolationProps>(
88
- (): ScreenInterpolationProps => {
89
- "worklet";
90
-
91
- const previous = unwrap(prevAnimation, previousDescriptor?.route.key);
92
-
93
- const next = nextDescriptor?.options?.enableTransitions
94
- ? unwrap(nextAnimation, nextDescriptor?.route.key)
95
- : undefined;
96
-
97
- const current =
98
- unwrap(currentAnimation, currentDescriptor?.route.key) ??
99
- DEFAULT_SCREEN_TRANSITION_STATE;
100
-
101
- const {
102
- progress,
103
- focused,
104
- activeBoundId,
105
- bounds,
106
- active,
107
- isActiveTransitioning,
108
- isDismissing,
109
- } = derivations({
110
- current,
111
- next,
112
- previous,
113
- dimensions,
114
- });
115
-
116
- return {
117
- layouts: { screen: dimensions },
118
- insets,
119
- previous,
120
- current,
121
- next,
122
- focused,
123
- activeBoundId,
124
- progress,
125
- bounds,
126
- active,
127
- isActiveTransitioning,
128
- isDismissing,
129
- };
130
- },
131
- );
88
+ const screenInterpolatorProps = useDerivedValue<
89
+ Omit<ScreenInterpolationProps, "bounds">
90
+ >(() => {
91
+ "worklet";
92
+
93
+ const previous = unwrap(prevAnimation, previousDescriptor?.route.key);
94
+
95
+ const next = nextDescriptor?.options?.enableTransitions
96
+ ? unwrap(nextAnimation, nextDescriptor?.route.key)
97
+ : undefined;
98
+
99
+ const current =
100
+ unwrap(currentAnimation, currentDescriptor?.route.key) ??
101
+ DEFAULT_SCREEN_TRANSITION_STATE;
102
+
103
+ const {
104
+ progress,
105
+ focused,
106
+ activeBoundId,
107
+ active,
108
+ isActiveTransitioning,
109
+ isDismissing,
110
+ } = derivations({
111
+ current,
112
+ next,
113
+ previous,
114
+ });
115
+
116
+ return {
117
+ layouts: { screen: dimensions },
118
+ insets,
119
+ previous,
120
+ current,
121
+ next,
122
+ focused,
123
+ activeBoundId,
124
+ progress,
125
+
126
+ active,
127
+ isActiveTransitioning,
128
+ isDismissing,
129
+ };
130
+ });
132
131
 
133
132
  const nextInterpolator = nextDescriptor?.options.screenStyleInterpolator;
134
133
  const currentInterpolator =
@@ -142,5 +141,11 @@ export function _useScreenAnimation() {
142
141
  export function useScreenAnimation() {
143
142
  const { screenInterpolatorProps } = _useScreenAnimation();
144
143
 
145
- return useDerivedValue(() => screenInterpolatorProps.value);
144
+ return useDerivedValue<ScreenInterpolationProps>(() => {
145
+ const props = screenInterpolatorProps.value;
146
+ return {
147
+ ...props,
148
+ bounds: createBounds(props),
149
+ };
150
+ });
146
151
  }
package/src/index.ts CHANGED
@@ -4,31 +4,42 @@ import { createTransitionAwareComponent } from "./components/create-transition-a
4
4
  import MaskedView from "./components/integrations/masked-view";
5
5
 
6
6
  export default {
7
- View: createTransitionAwareComponent(View),
8
- Pressable: createTransitionAwareComponent(Pressable),
9
- ScrollView: createTransitionAwareComponent(ScrollView, {
10
- isScrollable: true,
11
- }),
12
- FlatList: createTransitionAwareComponent(FlatList, {
13
- isScrollable: true,
14
- }),
15
- MaskedView: MaskedView,
16
- presets,
17
- specs,
18
- createTransitionAwareComponent,
7
+ View: createTransitionAwareComponent(View),
8
+ Pressable: createTransitionAwareComponent(Pressable),
9
+ ScrollView: createTransitionAwareComponent(ScrollView, {
10
+ isScrollable: true,
11
+ }),
12
+ FlatList: createTransitionAwareComponent(FlatList, {
13
+ isScrollable: true,
14
+ }),
15
+ MaskedView: MaskedView,
16
+ presets,
17
+ specs,
18
+ createTransitionAwareComponent,
19
19
  };
20
20
 
21
21
  export { useScreenAnimation } from "./hooks/animation/use-screen-animation";
22
22
  export { createNativeStackNavigator } from "./integrations/native-stack/navigators/createNativeStackNavigator";
23
+ export { createBlankStackNavigator } from "./integrations/blank-stack/navigators/createBlankStackNavigator";
23
24
 
24
25
  export type {
25
- NativeStackHeaderLeftProps,
26
- NativeStackHeaderProps,
27
- NativeStackHeaderRightProps,
28
- NativeStackNavigationEventMap,
29
- NativeStackNavigationOptions,
30
- NativeStackNavigationProp,
31
- NativeStackNavigatorProps,
32
- NativeStackOptionsArgs,
33
- NativeStackScreenProps,
34
- } from "./types/navigator";
26
+ NativeStackHeaderLeftProps,
27
+ NativeStackHeaderProps,
28
+ NativeStackHeaderRightProps,
29
+ NativeStackNavigationEventMap,
30
+ NativeStackNavigationOptions,
31
+ NativeStackNavigationProp,
32
+ NativeStackNavigatorProps,
33
+ NativeStackOptionsArgs,
34
+ NativeStackScreenProps,
35
+ } from "./types/native-stack.navigator";
36
+
37
+ export type {
38
+ BlankStackHeaderProps,
39
+ BlankStackNavigationEventMap,
40
+ BlankStackNavigationOptions,
41
+ BlankStackNavigationProp,
42
+ BlankStackNavigatorProps,
43
+ BlankStackOptionsArgs,
44
+ BlankStackScreenProps,
45
+ } from "./types/blank-stack.navigator";
@@ -0,0 +1,143 @@
1
+ import {
2
+ NavigationContext,
3
+ NavigationRouteContext,
4
+ } from "@react-navigation/native";
5
+ import { useMemo } from "react";
6
+ import { Animated, StyleSheet, View } from "react-native";
7
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
8
+ import { useScreenAnimation } from "../../../hooks/animation/use-screen-animation";
9
+ import { KeysProvider, useKeys } from "../../../providers/keys";
10
+ import type {
11
+ BlankStackHeaderProps,
12
+ BlankStackScene,
13
+ } from "../../../types/blank-stack.navigator";
14
+ import { useStackNavigationContext } from "../utils/with-stack-navigation";
15
+
16
+ type HeaderHostProps = {
17
+ scene: BlankStackScene;
18
+ focusedIndex: number;
19
+ isFloating?: boolean;
20
+ };
21
+
22
+ const getActiveFloatHeader = (scenes: BlankStackScene[], index: number) => {
23
+ for (let i = index; i >= 0; i--) {
24
+ const scene = scenes[i];
25
+ const options = scene?.descriptor?.options;
26
+
27
+ if (options?.headerMode === "float" && options?.headerShown) {
28
+ return { scene, headerIndex: i };
29
+ }
30
+ }
31
+
32
+ return null;
33
+ };
34
+
35
+ const HeaderHost = ({ scene, focusedIndex, isFloating }: HeaderHostProps) => {
36
+ const insets = useSafeAreaInsets();
37
+ const animation = useScreenAnimation();
38
+
39
+ const HeaderComponent = scene.descriptor.options.header;
40
+
41
+ if (!HeaderComponent) {
42
+ return null;
43
+ }
44
+
45
+ const headerProps: BlankStackHeaderProps = {
46
+ route: scene.route,
47
+ navigation: scene.descriptor.navigation,
48
+ animation,
49
+ insets,
50
+ focusedIndex,
51
+ };
52
+
53
+ return (
54
+ <Animated.View
55
+ pointerEvents="box-none"
56
+ style={[
57
+ styles.container,
58
+ isFloating ? styles.floating : null,
59
+ styles.absolute,
60
+ ]}
61
+ >
62
+ <NavigationContext.Provider value={scene.descriptor.navigation}>
63
+ <NavigationRouteContext.Provider value={scene.route}>
64
+ <View pointerEvents="auto" style={styles.header}>
65
+ <HeaderComponent {...headerProps} />
66
+ </View>
67
+ </NavigationRouteContext.Provider>
68
+ </NavigationContext.Provider>
69
+ </Animated.View>
70
+ );
71
+ };
72
+
73
+ const FloatHeader = () => {
74
+ const { scenes, focusedIndex } = useStackNavigationContext();
75
+
76
+ const activeHeader = useMemo(
77
+ () => getActiveFloatHeader(scenes, focusedIndex),
78
+ [scenes, focusedIndex]
79
+ );
80
+
81
+ if (!activeHeader) {
82
+ return null;
83
+ }
84
+
85
+ const { scene, headerIndex } = activeHeader;
86
+
87
+ const previous = scenes[headerIndex - 1]?.descriptor;
88
+ const current = scene.descriptor;
89
+ const next = scenes[headerIndex + 1]?.descriptor;
90
+
91
+ return (
92
+ //@ts-expect-error
93
+ <KeysProvider current={current} previous={previous} next={next}>
94
+ <HeaderHost scene={scene} focusedIndex={focusedIndex} isFloating />
95
+ </KeysProvider>
96
+ );
97
+ };
98
+
99
+ const ScreenHeader = () => {
100
+ const { focusedIndex } = useStackNavigationContext();
101
+ const { current } = useKeys();
102
+
103
+ const options = current.options;
104
+
105
+ // @ts-expect-error
106
+ if (!options.headerShown || options.headerMode !== "screen") {
107
+ return null;
108
+ }
109
+
110
+ const scene: BlankStackScene = {
111
+ //@ts-expect-error
112
+ descriptor: current,
113
+ route: current.route,
114
+ };
115
+
116
+ return <HeaderHost scene={scene} focusedIndex={focusedIndex} />;
117
+ };
118
+
119
+ export const Header = {
120
+ Float: FloatHeader,
121
+ Screen: ScreenHeader,
122
+ };
123
+
124
+ const styles = StyleSheet.create({
125
+ header: {
126
+ position: "absolute",
127
+ top: 0,
128
+ start: 0,
129
+ end: 0,
130
+ },
131
+ container: {
132
+ flex: 1,
133
+ },
134
+ absolute: {
135
+ position: "absolute",
136
+ top: 0,
137
+ start: 0,
138
+ end: 0,
139
+ },
140
+ floating: {
141
+ zIndex: 1000,
142
+ },
143
+ });
@@ -0,0 +1,96 @@
1
+ import type { NavigationRoute, ParamListBase } from "@react-navigation/native";
2
+ import type * as React from "react";
3
+ import { StyleSheet } from "react-native";
4
+ import Animated, {
5
+ interpolate,
6
+ useAnimatedProps,
7
+ useDerivedValue,
8
+ useSharedValue,
9
+ } from "react-native-reanimated";
10
+ import { Screen as RNSScreen } from "react-native-screens";
11
+ import { Animations } from "../../../stores/animations";
12
+
13
+ interface ScreenProps {
14
+ routeKey: string;
15
+ index: number;
16
+ routes: NavigationRoute<ParamListBase, string>[];
17
+ isPreloaded: boolean;
18
+ children: React.ReactNode;
19
+ freezeOnBlur?: boolean;
20
+ shouldFreeze?: boolean;
21
+ activeScreensLimit: number;
22
+ }
23
+
24
+ const EPSILON = 1e-5;
25
+
26
+ const STATE_INACTIVE = 0;
27
+ const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
28
+ const STATE_ON_TOP = 2;
29
+
30
+ const AnimatedScreen = Animated.createAnimatedComponent(RNSScreen);
31
+
32
+ export const Screen = ({
33
+ routeKey,
34
+ index,
35
+ routes,
36
+ isPreloaded,
37
+ activeScreensLimit,
38
+ children,
39
+ freezeOnBlur,
40
+ shouldFreeze,
41
+ }: ScreenProps) => {
42
+ const sceneProgress = Animations.getAnimation(routeKey, "progress");
43
+ const screenActivity = useSharedValue<0 | 1 | 2>(1);
44
+
45
+ useDerivedValue(() => {
46
+ if (!sceneProgress) {
47
+ screenActivity.value = STATE_TRANSITIONING_OR_BELOW_TOP;
48
+ return;
49
+ }
50
+
51
+ if (index < routes.length - activeScreensLimit - 1 || isPreloaded) {
52
+ screenActivity.value = STATE_INACTIVE;
53
+ } else {
54
+ const outputValue =
55
+ index === routes.length - 1
56
+ ? STATE_ON_TOP
57
+ : index >= routes.length - activeScreensLimit
58
+ ? STATE_TRANSITIONING_OR_BELOW_TOP
59
+ : STATE_INACTIVE;
60
+
61
+ const v = interpolate(
62
+ sceneProgress.value,
63
+ [0, 1 - EPSILON, 1],
64
+ [1, 1, outputValue],
65
+ "clamp",
66
+ );
67
+
68
+ const next =
69
+ (Math.trunc(v) as 0 | 1 | 2) ?? STATE_TRANSITIONING_OR_BELOW_TOP;
70
+
71
+ // avoid spamming JS thread
72
+ if (next !== screenActivity.value) {
73
+ screenActivity.value = next;
74
+ }
75
+ }
76
+ });
77
+
78
+ const animatedProps = useAnimatedProps(() => {
79
+ return {
80
+ activityState: screenActivity.value,
81
+ shouldFreeze: screenActivity.value === STATE_INACTIVE && shouldFreeze,
82
+ };
83
+ });
84
+
85
+ return (
86
+ <AnimatedScreen
87
+ enabled
88
+ style={StyleSheet.absoluteFill}
89
+ pointerEvents="box-none"
90
+ freezeOnBlur={freezeOnBlur}
91
+ animatedProps={animatedProps}
92
+ >
93
+ {children}
94
+ </AnimatedScreen>
95
+ );
96
+ };