react-native-screen-transitions 3.0.0-rc.1 → 3.0.0-rc.3

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 (233) hide show
  1. package/README.md +421 -371
  2. package/lib/commonjs/blank-stack/components/{Overlay.js → overlay.js} +11 -12
  3. package/lib/commonjs/blank-stack/components/overlay.js.map +1 -0
  4. package/lib/commonjs/blank-stack/components/{Screens.js → screens.js} +8 -10
  5. package/lib/commonjs/blank-stack/components/screens.js.map +1 -0
  6. package/lib/commonjs/blank-stack/components/stack-view.js +95 -0
  7. package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -0
  8. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js +2 -3
  9. package/lib/commonjs/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  10. package/lib/commonjs/blank-stack/index.js +1 -8
  11. package/lib/commonjs/blank-stack/index.js.map +1 -1
  12. package/lib/commonjs/blank-stack/navigators/{createBlankStackNavigator.js → create-blank-stack-navigator.js} +3 -3
  13. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -0
  14. package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.js.map +1 -0
  15. package/lib/{module/blank-stack/utils/with-stack-navigation/_utils → commonjs/blank-stack/utils/with-stack-navigation/helpers}/calculate-active-screens-limit.js.map +1 -1
  16. package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js +15 -0
  17. package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js.map +1 -0
  18. package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.js.map +1 -0
  19. package/lib/commonjs/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.js.map +1 -0
  20. package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-closing-route-keys.js +1 -12
  21. package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-closing-route-keys.js.map +1 -0
  22. package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-previous.js.map +1 -0
  23. package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-stack-navigation-state.js +4 -4
  24. package/lib/commonjs/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js.map +1 -0
  25. package/lib/commonjs/blank-stack/utils/with-stack-navigation/index.js +50 -56
  26. package/lib/commonjs/blank-stack/utils/with-stack-navigation/index.js.map +1 -1
  27. package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_types.js → types.js} +1 -1
  28. package/lib/commonjs/blank-stack/utils/with-stack-navigation/types.js.map +1 -0
  29. package/lib/commonjs/shared/configs/presets.js +8 -2
  30. package/lib/commonjs/shared/configs/presets.js.map +1 -1
  31. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +42 -21
  32. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
  33. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  34. package/lib/commonjs/shared/providers/flags.provider.js +25 -0
  35. package/lib/commonjs/shared/providers/flags.provider.js.map +1 -0
  36. package/lib/commonjs/shared/providers/register-bounds.provider.js +71 -45
  37. package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
  38. package/lib/commonjs/shared/stores/bounds.store.js +91 -47
  39. package/lib/commonjs/shared/stores/bounds.store.js.map +1 -1
  40. package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js +1 -1
  41. package/lib/commonjs/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -1
  42. package/lib/commonjs/shared/utils/bounds/index.js +4 -5
  43. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  44. package/lib/commonjs/shared/utils/create-provider.js +20 -1
  45. package/lib/commonjs/shared/utils/create-provider.js.map +1 -1
  46. package/lib/commonjs/shared/utils/reset-stores-for-screen.js +2 -0
  47. package/lib/commonjs/shared/utils/reset-stores-for-screen.js.map +1 -1
  48. package/lib/module/blank-stack/components/{Overlay.js → overlay.js} +11 -12
  49. package/lib/module/blank-stack/components/overlay.js.map +1 -0
  50. package/lib/module/blank-stack/components/{Screens.js → screens.js} +8 -10
  51. package/lib/module/blank-stack/components/screens.js.map +1 -0
  52. package/lib/module/blank-stack/components/stack-view.js +90 -0
  53. package/lib/module/blank-stack/components/stack-view.js.map +1 -0
  54. package/lib/module/blank-stack/hooks/use-overlay-animation.js +2 -3
  55. package/lib/module/blank-stack/hooks/use-overlay-animation.js.map +1 -1
  56. package/lib/module/blank-stack/index.js +1 -2
  57. package/lib/module/blank-stack/index.js.map +1 -1
  58. package/lib/module/blank-stack/navigators/{createBlankStackNavigator.js → create-blank-stack-navigator.js} +2 -2
  59. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -0
  60. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.js.map +1 -0
  61. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.js.map +1 -0
  62. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js +10 -0
  63. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.js.map +1 -0
  64. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.js.map +1 -0
  65. package/lib/module/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.js.map +1 -0
  66. package/lib/module/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-closing-route-keys.js +1 -12
  67. package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-closing-route-keys.js.map +1 -0
  68. package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-previous.js.map +1 -0
  69. package/lib/module/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-stack-navigation-state.js +4 -4
  70. package/lib/module/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.js.map +1 -0
  71. package/lib/module/blank-stack/utils/with-stack-navigation/index.js +49 -55
  72. package/lib/module/blank-stack/utils/with-stack-navigation/index.js.map +1 -1
  73. package/lib/module/blank-stack/utils/with-stack-navigation/types.js +4 -0
  74. package/lib/module/blank-stack/utils/with-stack-navigation/types.js.map +1 -0
  75. package/lib/module/shared/configs/presets.js +8 -2
  76. package/lib/module/shared/configs/presets.js.map +1 -1
  77. package/lib/module/shared/hooks/animation/use-screen-animation.js +42 -21
  78. package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
  79. package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  80. package/lib/module/shared/providers/flags.provider.js +19 -0
  81. package/lib/module/shared/providers/flags.provider.js.map +1 -0
  82. package/lib/module/shared/providers/register-bounds.provider.js +71 -45
  83. package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
  84. package/lib/module/shared/stores/bounds.store.js +91 -47
  85. package/lib/module/shared/stores/bounds.store.js.map +1 -1
  86. package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js +1 -1
  87. package/lib/module/shared/utils/bounds/helpers/is-bounds-equal.js.map +1 -1
  88. package/lib/module/shared/utils/bounds/index.js +4 -5
  89. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  90. package/lib/module/shared/utils/create-provider.js +20 -1
  91. package/lib/module/shared/utils/create-provider.js.map +1 -1
  92. package/lib/module/shared/utils/reset-stores-for-screen.js +2 -0
  93. package/lib/module/shared/utils/reset-stores-for-screen.js.map +1 -1
  94. package/lib/typescript/blank-stack/components/{Overlay.d.ts → overlay.d.ts} +1 -1
  95. package/lib/typescript/blank-stack/components/overlay.d.ts.map +1 -0
  96. package/lib/typescript/blank-stack/components/{Screens.d.ts → screens.d.ts} +1 -1
  97. package/lib/typescript/blank-stack/components/{Screens.d.ts.map → screens.d.ts.map} +1 -1
  98. package/lib/typescript/blank-stack/components/stack-view.d.ts +3 -0
  99. package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -0
  100. package/lib/typescript/blank-stack/index.d.ts +1 -2
  101. package/lib/typescript/blank-stack/index.d.ts.map +1 -1
  102. package/lib/typescript/blank-stack/navigators/{createBlankStackNavigator.d.ts → create-blank-stack-navigator.d.ts} +1 -1
  103. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -0
  104. package/lib/typescript/blank-stack/types.d.ts +23 -105
  105. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  106. package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/are-descriptors-equal.d.ts.map +1 -0
  107. package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/calculate-active-screens-limit.d.ts.map +1 -0
  108. package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/compose-descriptors.d.ts.map +1 -0
  109. package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/have-same-route-keys.d.ts.map +1 -0
  110. package/lib/typescript/blank-stack/utils/with-stack-navigation/helpers/routes-are-identical.d.ts.map +1 -0
  111. package/lib/typescript/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-closing-route-keys.d.ts.map +1 -1
  112. package/lib/typescript/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-previous.d.ts.map +1 -1
  113. package/lib/typescript/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-stack-navigation-state.d.ts +1 -1
  114. package/lib/typescript/blank-stack/utils/with-stack-navigation/hooks/use-stack-navigation-state.d.ts.map +1 -0
  115. package/lib/typescript/blank-stack/utils/with-stack-navigation/index.d.ts +3 -5
  116. package/lib/typescript/blank-stack/utils/with-stack-navigation/index.d.ts.map +1 -1
  117. package/lib/typescript/blank-stack/utils/with-stack-navigation/{_types.d.ts → types.d.ts} +1 -1
  118. package/lib/typescript/blank-stack/utils/with-stack-navigation/types.d.ts.map +1 -0
  119. package/lib/typescript/native-stack/types.d.ts +7 -1
  120. package/lib/typescript/native-stack/types.d.ts.map +1 -1
  121. package/lib/typescript/shared/configs/index.d.ts.map +1 -1
  122. package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
  123. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
  124. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  125. package/lib/typescript/shared/index.d.ts +32 -32
  126. package/lib/typescript/shared/index.d.ts.map +1 -1
  127. package/lib/typescript/shared/providers/flags.provider.d.ts +10 -0
  128. package/lib/typescript/shared/providers/flags.provider.d.ts.map +1 -0
  129. package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
  130. package/lib/typescript/shared/stores/bounds.store.d.ts +23 -11
  131. package/lib/typescript/shared/stores/bounds.store.d.ts.map +1 -1
  132. package/lib/typescript/shared/types/bounds.types.d.ts +2 -2
  133. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  134. package/lib/typescript/shared/types/core.types.d.ts +0 -4
  135. package/lib/typescript/shared/types/core.types.d.ts.map +1 -1
  136. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  137. package/lib/typescript/shared/utils/create-provider.d.ts +2 -2
  138. package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -1
  139. package/lib/typescript/shared/utils/reset-stores-for-screen.d.ts.map +1 -1
  140. package/package.json +2 -1
  141. package/src/blank-stack/components/{Overlay.tsx → overlay.tsx} +9 -12
  142. package/src/blank-stack/components/{Screens.tsx → screens.tsx} +7 -9
  143. package/src/blank-stack/components/stack-view.tsx +104 -0
  144. package/src/blank-stack/hooks/use-overlay-animation.tsx +11 -11
  145. package/src/blank-stack/index.ts +1 -2
  146. package/src/blank-stack/navigators/{createBlankStackNavigator.tsx → create-blank-stack-navigator.tsx} +1 -1
  147. package/src/blank-stack/types.ts +31 -109
  148. package/src/blank-stack/utils/with-stack-navigation/{_utils → helpers}/compose-descriptors.ts +1 -8
  149. package/src/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-closing-route-keys.tsx +1 -12
  150. package/src/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-stack-navigation-state.tsx +5 -5
  151. package/src/blank-stack/utils/with-stack-navigation/index.tsx +43 -63
  152. package/src/native-stack/types.ts +8 -1
  153. package/src/shared/__tests__/bounds.store.test.ts +398 -167
  154. package/src/shared/__tests__/determine-dismissal.test.ts +2 -12
  155. package/src/shared/__tests__/geometry.test.ts +1 -1
  156. package/src/shared/__tests__/gesture.velocity.test.ts +2 -10
  157. package/src/shared/configs/presets.ts +8 -2
  158. package/src/shared/hooks/animation/use-screen-animation.tsx +65 -31
  159. package/src/shared/hooks/gestures/use-build-gestures.tsx +4 -1
  160. package/src/shared/providers/flags.provider.tsx +21 -0
  161. package/src/shared/providers/register-bounds.provider.tsx +85 -54
  162. package/src/shared/stores/bounds.store.ts +90 -54
  163. package/src/shared/types/bounds.types.ts +2 -2
  164. package/src/shared/types/core.types.ts +4 -6
  165. package/src/shared/utils/bounds/helpers/is-bounds-equal.ts +1 -1
  166. package/src/shared/utils/bounds/index.ts +7 -10
  167. package/src/shared/utils/create-provider.tsx +35 -1
  168. package/src/shared/utils/reset-stores-for-screen.ts +2 -0
  169. package/lib/commonjs/blank-stack/components/Overlay.js.map +0 -1
  170. package/lib/commonjs/blank-stack/components/Screens.js.map +0 -1
  171. package/lib/commonjs/blank-stack/components/StackView.js +0 -93
  172. package/lib/commonjs/blank-stack/components/StackView.js.map +0 -1
  173. package/lib/commonjs/blank-stack/navigators/createBlankStackNavigator.js.map +0 -1
  174. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +0 -1
  175. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +0 -1
  176. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +0 -1
  177. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_types.js.map +0 -1
  178. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +0 -1
  179. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.js.map +0 -1
  180. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +0 -25
  181. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +0 -1
  182. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +0 -1
  183. package/lib/commonjs/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +0 -1
  184. package/lib/module/blank-stack/components/Overlay.js.map +0 -1
  185. package/lib/module/blank-stack/components/Screens.js.map +0 -1
  186. package/lib/module/blank-stack/components/StackView.js +0 -88
  187. package/lib/module/blank-stack/components/StackView.js.map +0 -1
  188. package/lib/module/blank-stack/navigators/createBlankStackNavigator.js.map +0 -1
  189. package/lib/module/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +0 -1
  190. package/lib/module/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +0 -1
  191. package/lib/module/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +0 -1
  192. package/lib/module/blank-stack/utils/with-stack-navigation/_types.js +0 -4
  193. package/lib/module/blank-stack/utils/with-stack-navigation/_types.js.map +0 -1
  194. package/lib/module/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +0 -1
  195. package/lib/module/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +0 -20
  196. package/lib/module/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +0 -1
  197. package/lib/module/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +0 -1
  198. package/lib/module/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +0 -1
  199. package/lib/typescript/blank-stack/components/Overlay.d.ts.map +0 -1
  200. package/lib/typescript/blank-stack/components/StackView.d.ts +0 -2
  201. package/lib/typescript/blank-stack/components/StackView.d.ts.map +0 -1
  202. package/lib/typescript/blank-stack/navigators/createBlankStackNavigator.d.ts.map +0 -1
  203. package/lib/typescript/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts.map +0 -1
  204. package/lib/typescript/blank-stack/utils/with-stack-navigation/_types.d.ts.map +0 -1
  205. package/lib/typescript/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts.map +0 -1
  206. package/lib/typescript/blank-stack/utils/with-stack-navigation/_utils/calculate-active-screens-limit.d.ts.map +0 -1
  207. package/lib/typescript/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts.map +0 -1
  208. package/lib/typescript/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts.map +0 -1
  209. package/lib/typescript/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts.map +0 -1
  210. package/src/blank-stack/components/StackView.tsx +0 -108
  211. /package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_utils → helpers}/are-descriptors-equal.js +0 -0
  212. /package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_utils → helpers}/calculate-active-screens-limit.js +0 -0
  213. /package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_utils → helpers}/have-same-route-keys.js +0 -0
  214. /package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_utils → helpers}/routes-are-identical.js +0 -0
  215. /package/lib/commonjs/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-previous.js +0 -0
  216. /package/lib/module/blank-stack/utils/with-stack-navigation/{_utils → helpers}/are-descriptors-equal.js +0 -0
  217. /package/lib/module/blank-stack/utils/with-stack-navigation/{_utils → helpers}/calculate-active-screens-limit.js +0 -0
  218. /package/lib/module/blank-stack/utils/with-stack-navigation/{_utils → helpers}/have-same-route-keys.js +0 -0
  219. /package/lib/module/blank-stack/utils/with-stack-navigation/{_utils → helpers}/routes-are-identical.js +0 -0
  220. /package/lib/module/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-previous.js +0 -0
  221. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_utils → helpers}/are-descriptors-equal.d.ts +0 -0
  222. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_utils → helpers}/calculate-active-screens-limit.d.ts +0 -0
  223. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_utils → helpers}/compose-descriptors.d.ts +0 -0
  224. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_utils → helpers}/have-same-route-keys.d.ts +0 -0
  225. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_utils → helpers}/routes-are-identical.d.ts +0 -0
  226. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-closing-route-keys.d.ts +0 -0
  227. /package/lib/typescript/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-previous.d.ts +0 -0
  228. /package/src/blank-stack/utils/with-stack-navigation/{_utils → helpers}/are-descriptors-equal.ts +0 -0
  229. /package/src/blank-stack/utils/with-stack-navigation/{_utils → helpers}/calculate-active-screens-limit.ts +0 -0
  230. /package/src/blank-stack/utils/with-stack-navigation/{_utils → helpers}/have-same-route-keys.ts +0 -0
  231. /package/src/blank-stack/utils/with-stack-navigation/{_utils → helpers}/routes-are-identical.ts +0 -0
  232. /package/src/blank-stack/utils/with-stack-navigation/{_hooks → hooks}/use-previous.tsx +0 -0
  233. /package/src/blank-stack/utils/with-stack-navigation/{_types.ts → types.ts} +0 -0
@@ -13,6 +13,7 @@ export const SlideFromTop = (
13
13
  config: Partial<ScreenTransitionConfig> = {},
14
14
  ): ScreenTransitionConfig => {
15
15
  return {
16
+ //@ts-expect-error - Should not lead to any issues
16
17
  enableTransitions: true,
17
18
  gestureEnabled: true,
18
19
  gestureDirection: "vertical-inverted",
@@ -45,6 +46,7 @@ export const ZoomIn = (
45
46
  config: Partial<ScreenTransitionConfig> = {},
46
47
  ): ScreenTransitionConfig => {
47
48
  return {
49
+ //@ts-expect-error - Should not lead to any issues
48
50
  enableTransitions: true,
49
51
  gestureEnabled: false,
50
52
  screenStyleInterpolator: ({ progress }) => {
@@ -83,6 +85,7 @@ export const SlideFromBottom = (
83
85
  config: Partial<ScreenTransitionConfig> = {},
84
86
  ): ScreenTransitionConfig => {
85
87
  return {
88
+ //@ts-expect-error - Should not lead to any issues
86
89
  enableTransitions: true,
87
90
  gestureEnabled: true,
88
91
  gestureDirection: "vertical",
@@ -114,6 +117,7 @@ export const DraggableCard = (
114
117
  config: Partial<ScreenTransitionConfig> = {},
115
118
  ): ScreenTransitionConfig => {
116
119
  return {
120
+ //@ts-expect-error - Should not lead to any issues
117
121
  enableTransitions: true,
118
122
  gestureEnabled: true,
119
123
  gestureDirection: ["horizontal", "vertical"],
@@ -159,6 +163,7 @@ export const ElasticCard = (
159
163
  } = { elasticFactor: 0.5 },
160
164
  ): ScreenTransitionConfig => {
161
165
  return {
166
+ //@ts-expect-error - Should not lead to any issues
162
167
  enableTransitions: true,
163
168
  gestureEnabled: true,
164
169
  gestureDirection: "bidirectional",
@@ -535,7 +540,7 @@ export const SharedAppleMusic = ({
535
540
  damping: 500,
536
541
  mass: 3,
537
542
  overshootClamping: true,
538
- //@ts-expect-error
543
+ //@ts-expect-error - Should not lead to any issues
539
544
  restSpeedThreshold: 0.02,
540
545
  },
541
546
  close: {
@@ -543,7 +548,7 @@ export const SharedAppleMusic = ({
543
548
  damping: 60,
544
549
  mass: 4,
545
550
  overshootClamping: false,
546
- //@ts-expect-error
551
+ //@ts-expect-error - Should not lead to any issues
547
552
  restSpeedThreshold: 0.02,
548
553
  restDisplacementThreshold: 0.002,
549
554
  },
@@ -559,6 +564,7 @@ export const SharedXImage = ({
559
564
  sharedBoundTag: string;
560
565
  }): ScreenTransitionConfig => {
561
566
  return {
567
+ //@ts-expect-error - Should not lead to any issues
562
568
  enableTransitions: true,
563
569
  gestureEnabled: true,
564
570
  gestureDirection: ["vertical", "vertical-inverted"],
@@ -3,16 +3,21 @@ import { useMemo } from "react";
3
3
  import { useWindowDimensions } from "react-native";
4
4
  import { type SharedValue, useDerivedValue } from "react-native-reanimated";
5
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
6
-
6
+ import type { NativeStackScreenTransitionConfig } from "../../../native-stack/types";
7
7
  import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../constants";
8
- import { type TransitionDescriptor, useKeys } from "../../providers/keys.provider";
9
-
8
+ import { useFlagsContext } from "../../providers/flags.provider";
9
+ import {
10
+ type TransitionDescriptor,
11
+ useKeys,
12
+ } from "../../providers/keys.provider";
10
13
  import { AnimationStore } from "../../stores/animation.store";
11
14
  import { GestureStore, type GestureStoreMap } from "../../stores/gesture.store";
12
15
  import type {
13
16
  ScreenInterpolationProps,
14
17
  ScreenTransitionState,
15
18
  } from "../../types/animation.types";
19
+ import type { ScreenTransitionConfig } from "../../types/core.types";
20
+ import type { GestureDirection } from "../../types/gesture.types";
16
21
  import { derivations } from "../../utils/animation/derivations";
17
22
  import { createBounds } from "../../utils/bounds";
18
23
 
@@ -22,30 +27,45 @@ type BuiltState = {
22
27
  animating: SharedValue<number>;
23
28
  gesture: GestureStoreMap;
24
29
  route: RouteProp<ParamListBase>;
30
+ unwrapped: ScreenTransitionState;
25
31
  };
26
32
 
27
- const unwrap = (
28
- s: BuiltState | undefined,
29
- key: string | undefined,
30
- ): ScreenTransitionState | undefined => {
33
+ const createScreenTransitionState = (
34
+ route: RouteProp<ParamListBase>,
35
+ ): ScreenTransitionState => ({
36
+ progress: 0,
37
+ closing: 0,
38
+ animating: 0,
39
+ gesture: {
40
+ x: 0,
41
+ y: 0,
42
+ normalizedX: 0,
43
+ normalizedY: 0,
44
+ isDismissing: 0,
45
+ isDragging: 0,
46
+ direction: null,
47
+ },
48
+ route,
49
+ });
50
+
51
+ const unwrapInto = (s: BuiltState): ScreenTransitionState => {
31
52
  "worklet";
32
- if (!s || !key) return undefined;
33
-
34
- return {
35
- progress: s.progress.value,
36
- closing: s.closing.value,
37
- animating: s.animating.value,
38
- gesture: {
39
- x: s.gesture.x.value,
40
- y: s.gesture.y.value,
41
- normalizedX: s.gesture.normalizedX.value,
42
- normalizedY: s.gesture.normalizedY.value,
43
- isDismissing: s.gesture.isDismissing.value,
44
- isDragging: s.gesture.isDragging.value,
45
- direction: s.gesture.direction.value,
46
- },
47
- route: s.route,
48
- };
53
+ const out = s.unwrapped;
54
+ out.progress = s.progress.value;
55
+ out.closing = s.closing.value;
56
+ out.animating = s.animating.value;
57
+ out.gesture.x = s.gesture.x.value;
58
+ out.gesture.y = s.gesture.y.value;
59
+ out.gesture.normalizedX = s.gesture.normalizedX.value;
60
+ out.gesture.normalizedY = s.gesture.normalizedY.value;
61
+ out.gesture.isDismissing = s.gesture.isDismissing.value;
62
+ out.gesture.isDragging = s.gesture.isDragging.value;
63
+ out.gesture.direction = s.gesture.direction.value as Omit<
64
+ GestureDirection,
65
+ "bidirectional"
66
+ > | null;
67
+
68
+ return out;
49
69
  };
50
70
 
51
71
  const useBuildScreenTransitionState = (
@@ -62,13 +82,25 @@ const useBuildScreenTransitionState = (
62
82
  animating: AnimationStore.getAnimation(key, "animating"),
63
83
  gesture: GestureStore.getRouteGestures(key),
64
84
  route: descriptor.route,
85
+ unwrapped: createScreenTransitionState(descriptor.route),
65
86
  };
66
87
  }, [key, descriptor?.route]);
67
88
  };
68
89
 
90
+ const hasTransitionsEnabled = (
91
+ options: ScreenTransitionConfig | undefined,
92
+ alwaysOn: boolean,
93
+ ) => {
94
+ "worklet";
95
+ if (alwaysOn) return true;
96
+ return !!(options as NativeStackScreenTransitionConfig)?.enableTransitions;
97
+ };
98
+
69
99
  export function _useScreenAnimation() {
70
100
  const dimensions = useWindowDimensions();
71
101
  const insets = useSafeAreaInsets();
102
+ const flags = useFlagsContext();
103
+ const transitionsAlwaysOn = flags?.TRANSITIONS_ALWAYS_ON ?? false;
72
104
 
73
105
  const {
74
106
  current: currentDescriptor,
@@ -85,15 +117,17 @@ export function _useScreenAnimation() {
85
117
  >(() => {
86
118
  "worklet";
87
119
 
88
- const previous = unwrap(prevAnimation, previousDescriptor?.route.key);
120
+ const previous = prevAnimation ? unwrapInto(prevAnimation) : undefined;
89
121
 
90
- const next = nextDescriptor?.options?.enableTransitions
91
- ? unwrap(nextAnimation, nextDescriptor?.route.key)
92
- : undefined;
122
+ const next =
123
+ nextAnimation &&
124
+ hasTransitionsEnabled(nextDescriptor?.options, transitionsAlwaysOn)
125
+ ? unwrapInto(nextAnimation)
126
+ : undefined;
93
127
 
94
- const current =
95
- unwrap(currentAnimation, currentDescriptor?.route.key) ??
96
- DEFAULT_SCREEN_TRANSITION_STATE;
128
+ const current = currentAnimation
129
+ ? unwrapInto(currentAnimation)
130
+ : DEFAULT_SCREEN_TRANSITION_STATE;
97
131
 
98
132
  const helpers = derivations({
99
133
  current,
@@ -26,7 +26,10 @@ import { useKeys } from "../../providers/keys.provider";
26
26
  import { AnimationStore } from "../../stores/animation.store";
27
27
  import { GestureStore, type GestureStoreMap } from "../../stores/gesture.store";
28
28
 
29
- import { type GestureDirection, GestureOffsetState } from "../../types/gesture.types";
29
+ import {
30
+ type GestureDirection,
31
+ GestureOffsetState,
32
+ } from "../../types/gesture.types";
30
33
  import { startScreenTransition } from "../../utils/animation/start-screen-transition";
31
34
  import { applyOffsetRules } from "../../utils/gesture/check-gesture-activation";
32
35
  import { determineDismissal } from "../../utils/gesture/determine-dismissal";
@@ -0,0 +1,21 @@
1
+ import createProvider from "../utils/create-provider";
2
+
3
+ interface FlagsValue {
4
+ TRANSITIONS_ALWAYS_ON: boolean;
5
+ }
6
+
7
+ interface FlagsProviderProps {
8
+ TRANSITIONS_ALWAYS_ON?: boolean;
9
+ children: React.ReactNode;
10
+ }
11
+
12
+ const { FlagsProvider, useFlagsContext } = createProvider("Flags", {
13
+ guarded: false,
14
+ })<FlagsProviderProps, FlagsValue>(
15
+ ({ TRANSITIONS_ALWAYS_ON = false, children }) => ({
16
+ value: { TRANSITIONS_ALWAYS_ON },
17
+ children,
18
+ }),
19
+ );
20
+
21
+ export { FlagsProvider, useFlagsContext };
@@ -43,27 +43,26 @@ interface RegisterBoundsContextValue {
43
43
  }
44
44
 
45
45
  /**
46
- * Gets the parent screen's route key for nested navigators.
47
- * Returns undefined if we're not inside a nested navigator.
46
+ * Builds the full ancestor key chain for nested navigators.
47
+ * Returns an array of screen keys from immediate parent to root.
48
+ * [parentKey, grandparentKey, greatGrandparentKey, ...]
48
49
  */
49
- const getParentScreenKey = (current: TransitionDescriptor) => {
50
- const parent = current.navigation.getParent();
51
- if (!parent) return undefined;
52
-
53
- const parentState = parent.getState();
54
- if (!parentState?.routes) return undefined;
55
-
56
- // Check if our route key exists directly in parent's routes
57
- const existsInParent = parentState.routes.some(
58
- (r) => r.key === current.route.key,
59
- );
60
-
61
- // If we don't exist in parent's routes, we're nested inside the focused route
62
- if (!existsInParent && parentState.index !== undefined) {
63
- return parentState.routes[parentState.index]?.key;
50
+ const getAncestorKeys = (current: TransitionDescriptor): string[] => {
51
+ const ancestors: string[] = [];
52
+ let nav = current.navigation.getParent();
53
+
54
+ while (nav) {
55
+ const state = nav.getState();
56
+ if (state?.routes && state.index !== undefined) {
57
+ const focusedRoute = state.routes[state.index];
58
+ if (focusedRoute?.key) {
59
+ ancestors.push(focusedRoute.key);
60
+ }
61
+ }
62
+ nav = nav.getParent();
64
63
  }
65
64
 
66
- return undefined;
65
+ return ancestors;
67
66
  };
68
67
 
69
68
  /**
@@ -73,13 +72,13 @@ const getParentScreenKey = (current: TransitionDescriptor) => {
73
72
  const useInitialLayoutHandler = (params: {
74
73
  sharedBoundTag?: string;
75
74
  currentScreenKey: string;
76
- parentScreenKey?: string;
75
+ ancestorKeys: string[];
77
76
  maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
78
77
  }) => {
79
78
  const {
80
79
  sharedBoundTag,
81
80
  currentScreenKey,
82
- parentScreenKey,
81
+ ancestorKeys,
83
82
  maybeMeasureAndStore,
84
83
  } = params;
85
84
 
@@ -87,57 +86,84 @@ const useInitialLayoutHandler = (params: {
87
86
  currentScreenKey,
88
87
  "animating",
89
88
  );
90
- const isParentAnimating = parentScreenKey
91
- ? AnimationStore.getAnimation(parentScreenKey, "animating")
92
- : null;
89
+
90
+ // Check if any ancestor is animating
91
+ const ancestorAnimations = ancestorKeys.map((key) =>
92
+ AnimationStore.getAnimation(key, "animating"),
93
+ );
93
94
 
94
95
  const hasMeasuredOnLayout = useSharedValue(false);
95
96
 
96
97
  return useCallback(() => {
97
98
  "worklet";
98
- if (!sharedBoundTag || hasMeasuredOnLayout.value) return;
99
- if (!isAnimating.value && !isParentAnimating?.value) return;
99
+ if (!sharedBoundTag || hasMeasuredOnLayout.get()) return;
100
+
101
+ // Check if current or any ancestor is animating
102
+ let isAnyAnimating = isAnimating.get();
103
+ for (let i = 0; i < ancestorAnimations.length; i++) {
104
+ if (ancestorAnimations[i].get()) {
105
+ isAnyAnimating = 1;
106
+ break;
107
+ }
108
+ }
109
+
110
+ if (!isAnyAnimating) return;
100
111
 
101
112
  maybeMeasureAndStore({
102
113
  shouldSetSource: false,
103
114
  shouldSetDestination: true,
104
115
  });
105
116
 
106
- hasMeasuredOnLayout.value = true;
117
+ hasMeasuredOnLayout.set(true);
107
118
  }, [
108
119
  sharedBoundTag,
109
120
  hasMeasuredOnLayout,
110
121
  isAnimating,
111
- isParentAnimating,
122
+ ancestorAnimations,
112
123
  maybeMeasureAndStore,
113
124
  ]);
114
125
  };
115
126
 
127
+ /**
128
+ * Measures non-pressable elements when screen becomes blurred.
129
+ * Captures bounds right before transition starts.
130
+ */
116
131
  /**
117
132
  * Measures non-pressable elements when screen becomes blurred.
118
133
  * Captures bounds right before transition starts.
119
134
  */
120
135
  const useBlurMeasurement = (params: {
121
136
  sharedBoundTag?: string;
137
+ ancestorKeys: string[];
122
138
  maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
123
139
  }) => {
124
- const { sharedBoundTag, maybeMeasureAndStore } = params;
125
- const isFocused = useRef(true);
140
+ const { current } = useKeys();
141
+ const { sharedBoundTag, ancestorKeys, maybeMeasureAndStore } = params;
126
142
  const hasCapturedSource = useRef(false);
127
143
 
144
+ const ancestorClosing = [current.route.key, ...ancestorKeys].map((key) =>
145
+ AnimationStore.getAnimation(key, "closing"),
146
+ );
147
+
148
+ const maybeMeasureOnBlur = useStableCallbackValue(() => {
149
+ "worklet";
150
+
151
+ // Don't measure if current / any ancestor is closing
152
+ const isOneClosing = ancestorClosing.some((closing) => closing.get());
153
+ if (isOneClosing) return;
154
+
155
+ maybeMeasureAndStore({ shouldSetSource: true });
156
+ });
157
+
128
158
  useFocusEffect(
129
159
  useCallback(() => {
130
- isFocused.current = true;
131
160
  hasCapturedSource.current = false;
132
161
 
133
162
  return () => {
134
- if (!sharedBoundTag) return;
135
- if (hasCapturedSource.current) return;
136
-
137
- isFocused.current = false;
138
- runOnUI(maybeMeasureAndStore)({ shouldSetSource: true });
163
+ if (!sharedBoundTag || hasCapturedSource.current) return;
164
+ runOnUI(maybeMeasureOnBlur)();
139
165
  };
140
- }, [sharedBoundTag, maybeMeasureAndStore]),
166
+ }, [sharedBoundTag, maybeMeasureOnBlur]),
141
167
  );
142
168
 
143
169
  return {
@@ -157,7 +183,7 @@ const useParentSyncReaction = (params: {
157
183
  const { parentContext, maybeMeasureAndStore } = params;
158
184
 
159
185
  useAnimatedReaction(
160
- () => parentContext?.updateSignal.value,
186
+ () => parentContext?.updateSignal.get(),
161
187
  (value) => {
162
188
  "worklet";
163
189
  if (value === 0 || value === undefined) return;
@@ -173,11 +199,12 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
173
199
  ({ style, onPress, sharedBoundTag, animatedRef, children }) => {
174
200
  const { current } = useKeys();
175
201
  const currentScreenKey = current.route.key;
176
- const parentScreenKey = getParentScreenKey(current);
202
+ const ancestorKeys = useMemo(() => getAncestorKeys(current), [current]);
177
203
 
178
204
  // Context & signals
179
205
  const parentContext: RegisterBoundsContextValue | null =
180
206
  useRegisterBoundsContext();
207
+
181
208
  const ownSignal = useSharedValue(0);
182
209
  const updateSignal: SharedValue<number> =
183
210
  parentContext?.updateSignal ?? ownSignal;
@@ -191,7 +218,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
191
218
  const emitUpdate = useStableCallbackValue(() => {
192
219
  "worklet";
193
220
  const isRoot = !parentContext;
194
- if (isRoot) updateSignal.value = updateSignal.value + 1;
221
+ if (isRoot) updateSignal.set(updateSignal.get() + 1);
195
222
  });
196
223
 
197
224
  const maybeMeasureAndStore = useStableCallbackValue(
@@ -208,28 +235,31 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
208
235
 
209
236
  emitUpdate();
210
237
 
211
- // Always register occurrence
212
- BoundStore.registerOccurrence(
238
+ BoundStore.registerSnapshot(
213
239
  sharedBoundTag,
214
240
  currentScreenKey,
215
241
  measured,
216
242
  preparedStyles,
243
+ ancestorKeys,
217
244
  );
218
245
 
219
- // Set as source (on press or blur)
220
246
  if (shouldSetSource) {
221
- if (isAnimating.value) {
222
- const existing = BoundStore.getOccurrence(
223
- sharedBoundTag,
224
- currentScreenKey,
225
- );
226
- BoundStore.setLinkSource(
247
+ if (isAnimating.get()) {
248
+ // If animation is already in progress,
249
+ // lets use the existing measuremenets.
250
+ const existing = BoundStore.getSnapshot(
227
251
  sharedBoundTag,
228
252
  currentScreenKey,
229
- existing.bounds,
230
- preparedStyles,
231
- parentScreenKey,
232
253
  );
254
+ if (existing) {
255
+ BoundStore.setLinkSource(
256
+ sharedBoundTag,
257
+ currentScreenKey,
258
+ existing.bounds,
259
+ preparedStyles,
260
+ ancestorKeys,
261
+ );
262
+ }
233
263
  return;
234
264
  }
235
265
  BoundStore.setLinkSource(
@@ -237,7 +267,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
237
267
  currentScreenKey,
238
268
  measured,
239
269
  preparedStyles,
240
- parentScreenKey,
270
+ ancestorKeys,
241
271
  );
242
272
  }
243
273
 
@@ -248,7 +278,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
248
278
  currentScreenKey,
249
279
  measured,
250
280
  preparedStyles,
251
- parentScreenKey,
281
+ ancestorKeys,
252
282
  );
253
283
  }
254
284
 
@@ -259,7 +289,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
259
289
  const handleInitialLayout = useInitialLayoutHandler({
260
290
  sharedBoundTag,
261
291
  currentScreenKey,
262
- parentScreenKey,
292
+ ancestorKeys,
263
293
  maybeMeasureAndStore,
264
294
  });
265
295
 
@@ -267,6 +297,7 @@ const { RegisterBoundsProvider, useRegisterBoundsContext } = createProvider(
267
297
  const { markSourceCaptured } = useBlurMeasurement({
268
298
  sharedBoundTag,
269
299
  maybeMeasureAndStore,
300
+ ancestorKeys,
270
301
  });
271
302
 
272
303
  useParentSyncReaction({ parentContext, maybeMeasureAndStore });