react-native-screen-transitions 3.6.0-beta.0 → 3.7.0-alpha.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 (381) hide show
  1. package/README.md +2 -2
  2. package/lib/commonjs/blank-stack/components/stack-view.js +35 -39
  3. package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
  4. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +7 -14
  5. package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  6. package/lib/commonjs/component-stack/components/stack-view.js +4 -11
  7. package/lib/commonjs/component-stack/components/stack-view.js.map +1 -1
  8. package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +1 -1
  9. package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +6 -0
  10. package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  11. package/lib/commonjs/shared/adapters/with-screen-transitions/context.js +28 -0
  12. package/lib/commonjs/shared/adapters/with-screen-transitions/context.js.map +1 -0
  13. package/lib/commonjs/shared/adapters/with-screen-transitions/index.js +75 -0
  14. package/lib/commonjs/shared/adapters/with-screen-transitions/index.js.map +1 -0
  15. package/lib/commonjs/shared/adapters/with-screen-transitions/options.js +103 -0
  16. package/lib/commonjs/shared/adapters/with-screen-transitions/options.js.map +1 -0
  17. package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js +143 -0
  18. package/lib/commonjs/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -0
  19. package/lib/commonjs/shared/adapters/with-screen-transitions/types.js +6 -0
  20. package/lib/commonjs/shared/adapters/with-screen-transitions/types.js.map +1 -0
  21. package/lib/commonjs/shared/components/activity/helpers.js +9 -0
  22. package/lib/commonjs/shared/components/activity/helpers.js.map +1 -0
  23. package/lib/commonjs/shared/components/activity/index.js +20 -0
  24. package/lib/commonjs/shared/components/activity/index.js.map +1 -0
  25. package/lib/commonjs/shared/components/activity/variants/activity-container.js +29 -0
  26. package/lib/commonjs/shared/components/activity/variants/activity-container.js.map +1 -0
  27. package/lib/commonjs/shared/components/activity/variants/activity-screen.js +107 -0
  28. package/lib/commonjs/shared/components/activity/variants/activity-screen.js.map +1 -0
  29. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js +10 -4
  30. package/lib/commonjs/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  31. package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js +13 -1
  32. package/lib/commonjs/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -1
  33. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js +8 -17
  34. package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
  35. package/lib/commonjs/shared/components/screen-lifecycle/index.js +1 -1
  36. package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
  37. package/lib/commonjs/shared/hooks/navigation/use-navigation-helpers.js +10 -4
  38. package/lib/commonjs/shared/hooks/navigation/use-navigation-helpers.js.map +1 -1
  39. package/lib/commonjs/shared/hooks/navigation/use-stack.js +63 -6
  40. package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
  41. package/lib/commonjs/shared/index.js +8 -0
  42. package/lib/commonjs/shared/index.js.map +1 -1
  43. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js +18 -29
  44. package/lib/commonjs/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  45. package/lib/commonjs/shared/providers/screen/descriptors/index.js +6 -0
  46. package/lib/commonjs/shared/providers/screen/descriptors/index.js.map +1 -1
  47. package/lib/commonjs/shared/providers/screen/gestures/ownership/resolve-ownership.js +2 -1
  48. package/lib/commonjs/shared/providers/screen/gestures/ownership/resolve-ownership.js.map +1 -1
  49. package/lib/commonjs/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js +1 -1
  50. package/lib/commonjs/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js.map +1 -1
  51. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js +4 -1
  52. package/lib/commonjs/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
  53. package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js +4 -3
  54. package/lib/commonjs/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
  55. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +4 -1
  56. package/lib/commonjs/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
  57. package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +4 -3
  58. package/lib/commonjs/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
  59. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +16 -1
  60. package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  61. package/lib/commonjs/shared/providers/stack/direct.provider.js +4 -3
  62. package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
  63. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +199 -0
  64. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -0
  65. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +62 -0
  66. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -0
  67. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +81 -0
  68. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -0
  69. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +123 -0
  70. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -0
  71. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/types.js +6 -0
  72. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/helpers/types.js.map +1 -0
  73. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/index.js +24 -0
  74. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/index.js.map +1 -0
  75. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +131 -0
  76. package/lib/commonjs/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -0
  77. package/lib/commonjs/shared/providers/stack/managed.provider.js +18 -29
  78. package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
  79. package/lib/commonjs/shared/types/stack.types.js.map +1 -1
  80. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +47 -50
  81. package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  82. package/lib/commonjs/shared/utils/bounds/navigation/zoom/config.js +1 -1
  83. package/lib/commonjs/shared/utils/create-provider.js +99 -10
  84. package/lib/commonjs/shared/utils/create-provider.js.map +1 -1
  85. package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js +8 -5
  86. package/lib/commonjs/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
  87. package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js +23 -6
  88. package/lib/commonjs/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
  89. package/lib/commonjs/shared/utils/visibility-block-offset.js +13 -0
  90. package/lib/commonjs/shared/utils/visibility-block-offset.js.map +1 -0
  91. package/lib/module/blank-stack/components/stack-view.js +36 -40
  92. package/lib/module/blank-stack/components/stack-view.js.map +1 -1
  93. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +7 -14
  94. package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
  95. package/lib/module/component-stack/components/stack-view.js +4 -11
  96. package/lib/module/component-stack/components/stack-view.js.map +1 -1
  97. package/lib/module/component-stack/navigators/create-component-stack-navigator.js +1 -1
  98. package/lib/module/native-stack/navigators/createNativeStackNavigator.js +6 -0
  99. package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
  100. package/lib/module/shared/adapters/with-screen-transitions/context.js +23 -0
  101. package/lib/module/shared/adapters/with-screen-transitions/context.js.map +1 -0
  102. package/lib/module/shared/adapters/with-screen-transitions/index.js +66 -0
  103. package/lib/module/shared/adapters/with-screen-transitions/index.js.map +1 -0
  104. package/lib/module/shared/adapters/with-screen-transitions/options.js +98 -0
  105. package/lib/module/shared/adapters/with-screen-transitions/options.js.map +1 -0
  106. package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js +138 -0
  107. package/lib/module/shared/adapters/with-screen-transitions/stack-layout.js.map +1 -0
  108. package/lib/module/shared/adapters/with-screen-transitions/types.js +4 -0
  109. package/lib/module/shared/adapters/with-screen-transitions/types.js.map +1 -0
  110. package/lib/module/shared/components/activity/helpers.js +5 -0
  111. package/lib/module/shared/components/activity/helpers.js.map +1 -0
  112. package/lib/module/shared/components/activity/index.js +5 -0
  113. package/lib/module/shared/components/activity/index.js.map +1 -0
  114. package/lib/module/shared/components/activity/variants/activity-container.js +24 -0
  115. package/lib/module/shared/components/activity/variants/activity-container.js.map +1 -0
  116. package/lib/module/shared/components/activity/variants/activity-screen.js +103 -0
  117. package/lib/module/shared/components/activity/variants/activity-screen.js.map +1 -0
  118. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js +11 -5
  119. package/lib/module/shared/components/create-boundary-component/hooks/use-measurer.js.map +1 -1
  120. package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js +11 -0
  121. package/lib/module/shared/components/create-boundary-component/utils/measured-bounds.js.map +1 -1
  122. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js +8 -17
  123. package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition-intent.js.map +1 -1
  124. package/lib/module/shared/components/screen-lifecycle/index.js +1 -1
  125. package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
  126. package/lib/module/shared/hooks/navigation/use-navigation-helpers.js +11 -5
  127. package/lib/module/shared/hooks/navigation/use-navigation-helpers.js.map +1 -1
  128. package/lib/module/shared/hooks/navigation/use-stack.js +63 -6
  129. package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
  130. package/lib/module/shared/index.js +3 -0
  131. package/lib/module/shared/index.js.map +1 -1
  132. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js +17 -29
  133. package/lib/module/shared/providers/screen/descriptors/descriptors.provider.js.map +1 -1
  134. package/lib/module/shared/providers/screen/descriptors/index.js +1 -1
  135. package/lib/module/shared/providers/screen/descriptors/index.js.map +1 -1
  136. package/lib/module/shared/providers/screen/gestures/ownership/resolve-ownership.js +2 -1
  137. package/lib/module/shared/providers/screen/gestures/ownership/resolve-ownership.js.map +1 -1
  138. package/lib/module/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js +2 -2
  139. package/lib/module/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.js.map +1 -1
  140. package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js +5 -2
  141. package/lib/module/shared/providers/screen/gestures/pan/pan-lifecycle.js.map +1 -1
  142. package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js +4 -3
  143. package/lib/module/shared/providers/screen/gestures/pan/use-pan-behavior.js.map +1 -1
  144. package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js +5 -2
  145. package/lib/module/shared/providers/screen/gestures/pinch/pinch-lifecycle.js.map +1 -1
  146. package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js +4 -3
  147. package/lib/module/shared/providers/screen/gestures/pinch/use-pinch-behavior.js.map +1 -1
  148. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +16 -1
  149. package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
  150. package/lib/module/shared/providers/stack/direct.provider.js +5 -4
  151. package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
  152. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js +194 -0
  153. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.js.map +1 -0
  154. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js +57 -0
  155. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.js.map +1 -0
  156. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js +69 -0
  157. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.js.map +1 -0
  158. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js +118 -0
  159. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.js.map +1 -0
  160. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/types.js +4 -0
  161. package/lib/module/shared/providers/stack/helpers/managed-stack-state/helpers/types.js.map +1 -0
  162. package/lib/module/shared/providers/stack/helpers/managed-stack-state/index.js +19 -0
  163. package/lib/module/shared/providers/stack/helpers/managed-stack-state/index.js.map +1 -0
  164. package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js +126 -0
  165. package/lib/module/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.js.map +1 -0
  166. package/lib/module/shared/providers/stack/managed.provider.js +19 -30
  167. package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
  168. package/lib/module/shared/types/stack.types.js.map +1 -1
  169. package/lib/module/shared/utils/bounds/navigation/zoom/build.js +45 -48
  170. package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
  171. package/lib/module/shared/utils/bounds/navigation/zoom/config.js +1 -1
  172. package/lib/module/shared/utils/create-provider.js +100 -11
  173. package/lib/module/shared/utils/create-provider.js.map +1 -1
  174. package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js +8 -5
  175. package/lib/module/shared/utils/navigation/resolve-scene-neighbors.js.map +1 -1
  176. package/lib/module/shared/utils/navigation/sync-routes-with-removed.js +23 -6
  177. package/lib/module/shared/utils/navigation/sync-routes-with-removed.js.map +1 -1
  178. package/lib/module/shared/utils/visibility-block-offset.js +8 -0
  179. package/lib/module/shared/utils/visibility-block-offset.js.map +1 -0
  180. package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
  181. package/lib/typescript/blank-stack/index.d.ts +1 -1
  182. package/lib/typescript/blank-stack/index.d.ts.map +1 -1
  183. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +4 -6
  184. package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
  185. package/lib/typescript/blank-stack/types.d.ts +41 -29
  186. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  187. package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -1
  188. package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +1 -1
  189. package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +5 -0
  190. package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
  191. package/lib/typescript/native-stack/types.d.ts +25 -0
  192. package/lib/typescript/native-stack/types.d.ts.map +1 -1
  193. package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts +15 -0
  194. package/lib/typescript/shared/adapters/with-screen-transitions/context.d.ts.map +1 -0
  195. package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts +11 -0
  196. package/lib/typescript/shared/adapters/with-screen-transitions/index.d.ts.map +1 -0
  197. package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts +16 -0
  198. package/lib/typescript/shared/adapters/with-screen-transitions/options.d.ts.map +1 -0
  199. package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts +12 -0
  200. package/lib/typescript/shared/adapters/with-screen-transitions/stack-layout.d.ts.map +1 -0
  201. package/lib/typescript/shared/adapters/with-screen-transitions/types.d.ts +24 -0
  202. package/lib/typescript/shared/adapters/with-screen-transitions/types.d.ts.map +1 -0
  203. package/lib/typescript/shared/components/activity/helpers.d.ts +4 -0
  204. package/lib/typescript/shared/components/activity/helpers.d.ts.map +1 -0
  205. package/lib/typescript/shared/components/activity/index.d.ts +3 -0
  206. package/lib/typescript/shared/components/activity/index.d.ts.map +1 -0
  207. package/lib/typescript/shared/components/activity/variants/activity-container.d.ts +6 -0
  208. package/lib/typescript/shared/components/activity/variants/activity-container.d.ts.map +1 -0
  209. package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts +13 -0
  210. package/lib/typescript/shared/components/activity/variants/activity-screen.d.ts.map +1 -0
  211. package/lib/typescript/shared/components/create-boundary-component/hooks/use-measurer.d.ts.map +1 -1
  212. package/lib/typescript/shared/components/create-boundary-component/index.d.ts +2 -2
  213. package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts +1 -0
  214. package/lib/typescript/shared/components/create-boundary-component/utils/measured-bounds.d.ts.map +1 -1
  215. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts +1 -2
  216. package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition-intent.d.ts.map +1 -1
  217. package/lib/typescript/shared/hooks/navigation/use-navigation-helpers.d.ts +1 -0
  218. package/lib/typescript/shared/hooks/navigation/use-navigation-helpers.d.ts.map +1 -1
  219. package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +13 -1
  220. package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
  221. package/lib/typescript/shared/index.d.ts +15 -11
  222. package/lib/typescript/shared/index.d.ts.map +1 -1
  223. package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts +11 -3
  224. package/lib/typescript/shared/providers/screen/descriptors/descriptors.provider.d.ts.map +1 -1
  225. package/lib/typescript/shared/providers/screen/descriptors/index.d.ts +1 -1
  226. package/lib/typescript/shared/providers/screen/descriptors/index.d.ts.map +1 -1
  227. package/lib/typescript/shared/providers/screen/gestures/ownership/resolve-ownership.d.ts.map +1 -1
  228. package/lib/typescript/shared/providers/screen/gestures/pan/pan-lifecycle.d.ts +1 -1
  229. package/lib/typescript/shared/providers/screen/gestures/pan/pan-lifecycle.d.ts.map +1 -1
  230. package/lib/typescript/shared/providers/screen/gestures/pan/use-pan-behavior.d.ts.map +1 -1
  231. package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-lifecycle.d.ts +1 -1
  232. package/lib/typescript/shared/providers/screen/gestures/pinch/pinch-lifecycle.d.ts.map +1 -1
  233. package/lib/typescript/shared/providers/screen/gestures/pinch/use-pinch-behavior.d.ts.map +1 -1
  234. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +3 -1
  235. package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
  236. package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
  237. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.d.ts +13 -0
  238. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.d.ts.map +1 -0
  239. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.d.ts +12 -0
  240. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.d.ts.map +1 -0
  241. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts +11 -0
  242. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.d.ts.map +1 -0
  243. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.d.ts +12 -0
  244. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.d.ts.map +1 -0
  245. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/types.d.ts +40 -0
  246. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/helpers/types.d.ts.map +1 -0
  247. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/index.d.ts +12 -0
  248. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/index.d.ts.map +1 -0
  249. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.d.ts +13 -0
  250. package/lib/typescript/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.d.ts.map +1 -0
  251. package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
  252. package/lib/typescript/shared/types/bounds.types.d.ts +27 -0
  253. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  254. package/lib/typescript/shared/types/index.d.ts +2 -2
  255. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  256. package/lib/typescript/shared/types/providers/managed-stack.types.d.ts +3 -9
  257. package/lib/typescript/shared/types/providers/managed-stack.types.d.ts.map +1 -1
  258. package/lib/typescript/shared/types/screen.types.d.ts +24 -0
  259. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  260. package/lib/typescript/shared/types/stack.types.d.ts +7 -0
  261. package/lib/typescript/shared/types/stack.types.d.ts.map +1 -1
  262. package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
  263. package/lib/typescript/shared/utils/bounds/navigation/zoom/config.d.ts +1 -1
  264. package/lib/typescript/shared/utils/create-provider.d.ts +17 -3
  265. package/lib/typescript/shared/utils/create-provider.d.ts.map +1 -1
  266. package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts +2 -1
  267. package/lib/typescript/shared/utils/navigation/resolve-scene-neighbors.d.ts.map +1 -1
  268. package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts +2 -1
  269. package/lib/typescript/shared/utils/navigation/sync-routes-with-removed.d.ts.map +1 -1
  270. package/lib/typescript/shared/utils/visibility-block-offset.d.ts +2 -0
  271. package/lib/typescript/shared/utils/visibility-block-offset.d.ts.map +1 -0
  272. package/package.json +11 -1
  273. package/src/blank-stack/components/stack-view.tsx +54 -48
  274. package/src/blank-stack/index.ts +1 -0
  275. package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +7 -15
  276. package/src/blank-stack/types.ts +44 -29
  277. package/src/component-stack/components/stack-view.tsx +4 -11
  278. package/src/component-stack/navigators/create-component-stack-navigator.tsx +1 -1
  279. package/src/native-stack/navigators/createNativeStackNavigator.tsx +5 -0
  280. package/src/native-stack/types.ts +25 -0
  281. package/src/shared/adapters/with-screen-transitions/context.tsx +42 -0
  282. package/src/shared/adapters/with-screen-transitions/index.tsx +155 -0
  283. package/src/shared/adapters/with-screen-transitions/options.ts +172 -0
  284. package/src/shared/adapters/with-screen-transitions/stack-layout.tsx +233 -0
  285. package/src/shared/adapters/with-screen-transitions/types.ts +28 -0
  286. package/src/shared/components/activity/helpers.ts +8 -0
  287. package/src/shared/components/activity/index.tsx +2 -0
  288. package/src/shared/components/activity/variants/activity-container.tsx +25 -0
  289. package/src/shared/components/activity/variants/activity-screen.tsx +133 -0
  290. package/src/shared/components/create-boundary-component/hooks/use-measurer.ts +23 -4
  291. package/src/shared/components/create-boundary-component/utils/measured-bounds.ts +15 -0
  292. package/src/shared/components/screen-lifecycle/hooks/use-close-transition-intent.ts +9 -26
  293. package/src/shared/components/screen-lifecycle/index.tsx +1 -1
  294. package/src/shared/hooks/navigation/use-navigation-helpers.ts +9 -3
  295. package/src/shared/hooks/navigation/use-stack.tsx +115 -6
  296. package/src/shared/index.ts +9 -0
  297. package/src/shared/providers/screen/descriptors/descriptors.provider.tsx +31 -31
  298. package/src/shared/providers/screen/descriptors/index.tsx +1 -0
  299. package/src/shared/providers/screen/gestures/ownership/resolve-ownership.ts +2 -1
  300. package/src/shared/providers/screen/gestures/ownership/use-walk-up-and-register-shadowing-claims.ts +2 -2
  301. package/src/shared/providers/screen/gestures/pan/pan-lifecycle.ts +7 -2
  302. package/src/shared/providers/screen/gestures/pan/use-pan-behavior.ts +10 -2
  303. package/src/shared/providers/screen/gestures/pinch/pinch-lifecycle.ts +7 -2
  304. package/src/shared/providers/screen/gestures/pinch/use-pinch-behavior.ts +8 -3
  305. package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +17 -1
  306. package/src/shared/providers/stack/direct.provider.tsx +13 -4
  307. package/src/shared/providers/stack/helpers/managed-stack-state/helpers/build-managed-stack-state.ts +368 -0
  308. package/src/shared/providers/stack/helpers/managed-stack-state/helpers/derive-managed-stack-state.ts +129 -0
  309. package/src/shared/providers/stack/helpers/managed-stack-state/helpers/helpers.ts +139 -0
  310. package/src/shared/providers/stack/helpers/managed-stack-state/helpers/reconcile-managed-routes.ts +198 -0
  311. package/src/shared/providers/stack/helpers/managed-stack-state/helpers/types.ts +57 -0
  312. package/src/shared/providers/stack/helpers/managed-stack-state/index.ts +40 -0
  313. package/src/shared/providers/stack/helpers/managed-stack-state/managed-stack-controller.ts +160 -0
  314. package/src/shared/providers/stack/managed.provider.tsx +23 -39
  315. package/src/shared/types/bounds.types.ts +27 -0
  316. package/src/shared/types/index.ts +3 -0
  317. package/src/shared/types/providers/managed-stack.types.ts +6 -8
  318. package/src/shared/types/screen.types.ts +25 -0
  319. package/src/shared/types/stack.types.ts +11 -0
  320. package/src/shared/utils/bounds/navigation/zoom/build.ts +62 -71
  321. package/src/shared/utils/bounds/navigation/zoom/config.ts +1 -1
  322. package/src/shared/utils/create-provider.tsx +183 -8
  323. package/src/shared/utils/navigation/resolve-scene-neighbors.ts +9 -4
  324. package/src/shared/utils/navigation/sync-routes-with-removed.ts +38 -7
  325. package/src/shared/utils/visibility-block-offset.ts +4 -0
  326. package/lib/commonjs/blank-stack/components/stack-view.native.js +0 -64
  327. package/lib/commonjs/blank-stack/components/stack-view.native.js.map +0 -1
  328. package/lib/commonjs/shared/components/native-screen-container.js +0 -42
  329. package/lib/commonjs/shared/components/native-screen-container.js.map +0 -1
  330. package/lib/commonjs/shared/components/native-screen.js +0 -125
  331. package/lib/commonjs/shared/components/native-screen.js.map +0 -1
  332. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js +0 -51
  333. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js.map +0 -1
  334. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js +0 -15
  335. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js.map +0 -1
  336. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js +0 -14
  337. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js.map +0 -1
  338. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js +0 -13
  339. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js.map +0 -1
  340. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/index.js +0 -101
  341. package/lib/commonjs/shared/providers/stack/helpers/use-local-routes/index.js.map +0 -1
  342. package/lib/module/blank-stack/components/stack-view.native.js +0 -60
  343. package/lib/module/blank-stack/components/stack-view.native.js.map +0 -1
  344. package/lib/module/shared/components/native-screen-container.js +0 -37
  345. package/lib/module/shared/components/native-screen-container.js.map +0 -1
  346. package/lib/module/shared/components/native-screen.js +0 -119
  347. package/lib/module/shared/components/native-screen.js.map +0 -1
  348. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js +0 -47
  349. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.js.map +0 -1
  350. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js +0 -10
  351. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.js.map +0 -1
  352. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js +0 -9
  353. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.js.map +0 -1
  354. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js +0 -8
  355. package/lib/module/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.js.map +0 -1
  356. package/lib/module/shared/providers/stack/helpers/use-local-routes/index.js +0 -95
  357. package/lib/module/shared/providers/stack/helpers/use-local-routes/index.js.map +0 -1
  358. package/lib/typescript/blank-stack/components/stack-view.native.d.ts +0 -3
  359. package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +0 -1
  360. package/lib/typescript/shared/components/native-screen-container.d.ts +0 -6
  361. package/lib/typescript/shared/components/native-screen-container.d.ts.map +0 -1
  362. package/lib/typescript/shared/components/native-screen.d.ts +0 -12
  363. package/lib/typescript/shared/components/native-screen.d.ts.map +0 -1
  364. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.d.ts +0 -10
  365. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.d.ts.map +0 -1
  366. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.d.ts +0 -2
  367. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.d.ts.map +0 -1
  368. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.d.ts +0 -3
  369. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.d.ts.map +0 -1
  370. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.d.ts +0 -3
  371. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.d.ts.map +0 -1
  372. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/index.d.ts +0 -19
  373. package/lib/typescript/shared/providers/stack/helpers/use-local-routes/index.d.ts.map +0 -1
  374. package/src/blank-stack/components/stack-view.native.tsx +0 -74
  375. package/src/shared/components/native-screen-container.tsx +0 -33
  376. package/src/shared/components/native-screen.tsx +0 -176
  377. package/src/shared/providers/stack/helpers/use-local-routes/helpers/align-routes-with-latest.ts +0 -65
  378. package/src/shared/providers/stack/helpers/use-local-routes/helpers/are-descriptors-equal.ts +0 -15
  379. package/src/shared/providers/stack/helpers/use-local-routes/helpers/have-same-route-keys.ts +0 -12
  380. package/src/shared/providers/stack/helpers/use-local-routes/helpers/routes-are-identical.ts +0 -11
  381. package/src/shared/providers/stack/helpers/use-local-routes/index.ts +0 -147
@@ -0,0 +1,172 @@
1
+ import type { ScreenProps } from "react-native-screens";
2
+ import type { ScreenTransitionConfig } from "../../types";
3
+
4
+ type NativeStackTransitionResetOptions = {
5
+ presentation: "containedTransparentModal";
6
+ animation: "none";
7
+ headerShown: false;
8
+ gestureEnabled: false;
9
+ };
10
+
11
+ export type NativeStackNativeGestureOptions = {
12
+ nativeGestureEnabled?: boolean;
13
+ nativeGestureDirection?: ScreenProps["swipeDirection"];
14
+ nativeGestureResponseDistance?: ScreenProps["gestureResponseDistance"];
15
+ };
16
+
17
+ export type ScreenTransitionDescriptorOptions = ScreenTransitionConfig & {
18
+ enableTransitions?: boolean;
19
+ screenTransition?: ScreenTransitionConfig | null | false;
20
+ };
21
+
22
+ export type NativeStackAdapterOptions<
23
+ TNativeOptions extends object = Record<string, unknown>,
24
+ > = Omit<
25
+ TNativeOptions,
26
+ | keyof ScreenTransitionDescriptorOptions
27
+ | keyof NativeStackNativeGestureOptions
28
+ > &
29
+ ScreenTransitionDescriptorOptions &
30
+ NativeStackNativeGestureOptions;
31
+
32
+ const NATIVE_STACK_TRANSITION_RESET_OPTIONS: NativeStackTransitionResetOptions =
33
+ {
34
+ presentation: "containedTransparentModal",
35
+ animation: "none",
36
+ headerShown: false,
37
+ gestureEnabled: false,
38
+ };
39
+
40
+ const COLLIDING_TRANSITION_OPTION_KEYS = [
41
+ "gestureEnabled",
42
+ "gestureDirection",
43
+ "gestureResponseDistance",
44
+ ] as const satisfies readonly (keyof ScreenTransitionConfig)[];
45
+
46
+ type CollidingTransitionOptionKey =
47
+ (typeof COLLIDING_TRANSITION_OPTION_KEYS)[number];
48
+
49
+ export type NativeStackAdapterOptionInput =
50
+ | Record<string, unknown>
51
+ | ((...args: any[]) => Record<string, unknown> | undefined);
52
+
53
+ function isPlainOptions(value: unknown): value is Record<string, unknown> {
54
+ return typeof value === "object" && value !== null;
55
+ }
56
+
57
+ function extractCollidingTransitionOptions(
58
+ options: Record<string, unknown>,
59
+ ): ScreenTransitionConfig | undefined {
60
+ let screenTransition: ScreenTransitionConfig | undefined;
61
+
62
+ for (const key of COLLIDING_TRANSITION_OPTION_KEYS) {
63
+ if (!(key in options)) {
64
+ continue;
65
+ }
66
+
67
+ screenTransition ??= {};
68
+ screenTransition[key] = options[key] as never;
69
+ }
70
+
71
+ return screenTransition;
72
+ }
73
+
74
+ function removeCollidingTransitionOptions<
75
+ TOptions extends Record<string, unknown>,
76
+ >(options: TOptions): Omit<TOptions, CollidingTransitionOptionKey> {
77
+ const nativeOptions = { ...options };
78
+
79
+ for (const key of COLLIDING_TRANSITION_OPTION_KEYS) {
80
+ delete nativeOptions[key];
81
+ }
82
+
83
+ return nativeOptions;
84
+ }
85
+
86
+ function applyNativeGestureAliases<TOptions extends Record<string, unknown>>(
87
+ options: TOptions,
88
+ ): TOptions {
89
+ const nativeOptions: Record<string, unknown> = { ...options };
90
+ const {
91
+ nativeGestureEnabled,
92
+ nativeGestureDirection,
93
+ nativeGestureResponseDistance,
94
+ } = options;
95
+ delete nativeOptions.nativeGestureEnabled;
96
+ delete nativeOptions.nativeGestureDirection;
97
+ delete nativeOptions.nativeGestureResponseDistance;
98
+
99
+ if (nativeGestureEnabled !== undefined) {
100
+ nativeOptions.gestureEnabled = nativeGestureEnabled;
101
+ }
102
+
103
+ if (nativeGestureDirection !== undefined) {
104
+ nativeOptions.gestureDirection = nativeGestureDirection;
105
+ }
106
+
107
+ if (nativeGestureResponseDistance !== undefined) {
108
+ nativeOptions.gestureResponseDistance = nativeGestureResponseDistance;
109
+ }
110
+
111
+ return nativeOptions as TOptions;
112
+ }
113
+
114
+ export function adaptNativeStackTransitionOptions<
115
+ TOptions extends NativeStackAdapterOptionInput | undefined,
116
+ >(options: TOptions): TOptions {
117
+ if (typeof options === "function") {
118
+ return ((...args: any[]) =>
119
+ adaptNativeStackTransitionOptions(options(...args))) as TOptions;
120
+ }
121
+
122
+ if (!isPlainOptions(options)) {
123
+ return options;
124
+ }
125
+
126
+ const inlineScreenTransition = extractCollidingTransitionOptions(options);
127
+ const explicitScreenTransition = options.screenTransition;
128
+ const hasTransitionsEnabled =
129
+ options.enableTransitions === true || !!explicitScreenTransition;
130
+
131
+ if (!hasTransitionsEnabled) {
132
+ return applyNativeGestureAliases(options) as TOptions;
133
+ }
134
+
135
+ const nativeOptions = applyNativeGestureAliases(
136
+ removeCollidingTransitionOptions(options),
137
+ );
138
+ const nativeGestureEnabled = nativeOptions.gestureEnabled;
139
+ const screenTransition =
140
+ explicitScreenTransition && isPlainOptions(explicitScreenTransition)
141
+ ? {
142
+ ...inlineScreenTransition,
143
+ ...explicitScreenTransition,
144
+ }
145
+ : inlineScreenTransition;
146
+
147
+ return {
148
+ ...nativeOptions,
149
+ ...NATIVE_STACK_TRANSITION_RESET_OPTIONS,
150
+ ...(nativeGestureEnabled !== undefined
151
+ ? { gestureEnabled: nativeGestureEnabled }
152
+ : null),
153
+ enableTransitions: true,
154
+ ...(screenTransition ? { screenTransition } : null),
155
+ } as TOptions;
156
+ }
157
+
158
+ export function resolveScreenTransitionOptions<
159
+ TOptions extends ScreenTransitionDescriptorOptions,
160
+ >(options: TOptions): TOptions & ScreenTransitionConfig {
161
+ const screenTransition = options.screenTransition;
162
+
163
+ if (!screenTransition) {
164
+ return options;
165
+ }
166
+
167
+ return {
168
+ ...options,
169
+ ...screenTransition,
170
+ enableTransitions: true,
171
+ };
172
+ }
@@ -0,0 +1,233 @@
1
+ import type { NavigationState, Route } from "@react-navigation/native";
2
+ import { useMemo } from "react";
3
+ import { Overlay } from "../../components/overlay";
4
+ import {
5
+ type StackContextValue,
6
+ StackProvider,
7
+ } from "../../hooks/navigation/use-stack";
8
+ import { ScreenComposer } from "../../providers/screen/screen-composer";
9
+ import {
10
+ useStackCoreContext,
11
+ withStackCore,
12
+ } from "../../providers/stack/core.provider";
13
+ import { useStackDerived } from "../../providers/stack/helpers/use-stack-derived";
14
+ import {
15
+ AnimationStore,
16
+ type AnimationStoreMap,
17
+ } from "../../stores/animation.store";
18
+ import type { BaseStackDescriptor, BaseStackRoute } from "../../types";
19
+ import { StackType } from "../../types/stack.types";
20
+ import { isOverlayVisible } from "../../utils/overlay/visibility";
21
+ import {
22
+ ScreenTransitionsAdapterProvider,
23
+ type ScreenTransitionsAdapterScene,
24
+ useScreenTransitionsAdapterContext,
25
+ } from "./context";
26
+ import {
27
+ resolveScreenTransitionOptions,
28
+ type ScreenTransitionDescriptorOptions,
29
+ } from "./options";
30
+ import type {
31
+ NavigatorLayout,
32
+ NavigatorLayoutArgs,
33
+ ScreenLayout,
34
+ ScreenLayoutArgs,
35
+ } from "./types";
36
+
37
+ type DescriptorMap = Record<string, BaseStackDescriptor>;
38
+
39
+ type NavigationStateWithPreloads = NavigationState & {
40
+ preloadedRoutes?: Route<string>[];
41
+ };
42
+
43
+ type TransitionStackState = {
44
+ routes: BaseStackRoute[];
45
+ routeKeys: string[];
46
+ scenes: ScreenTransitionsAdapterScene[];
47
+ animationMaps: AnimationStoreMap[];
48
+ routeIndexByKey: Map<string, number>;
49
+ shouldShowFloatOverlay: boolean;
50
+ };
51
+
52
+ const EMPTY_PRELOADED_ROUTES: Route<string>[] = [];
53
+
54
+ function getPreloadedRoutes(state: NavigationState): Route<string>[] {
55
+ return (
56
+ (state as NavigationStateWithPreloads).preloadedRoutes ??
57
+ EMPTY_PRELOADED_ROUTES
58
+ );
59
+ }
60
+
61
+ function normalizeDescriptor(
62
+ descriptor: BaseStackDescriptor,
63
+ ): BaseStackDescriptor {
64
+ return {
65
+ ...descriptor,
66
+ options: resolveScreenTransitionOptions(
67
+ descriptor.options as ScreenTransitionDescriptorOptions,
68
+ ),
69
+ };
70
+ }
71
+
72
+ function buildTransitionStackState({
73
+ state,
74
+ descriptors,
75
+ }: {
76
+ state: NavigationState;
77
+ descriptors: DescriptorMap;
78
+ }): TransitionStackState {
79
+ const routes = state.routes as BaseStackRoute[];
80
+ const preloadedRoutes = getPreloadedRoutes(state) as BaseStackRoute[];
81
+ const allRoutes = routes.concat(preloadedRoutes);
82
+ const routeKeys: string[] = [];
83
+ const scenes: ScreenTransitionsAdapterScene[] = [];
84
+ const animationMaps: AnimationStoreMap[] = [];
85
+ const routeIndexByKey = new Map<string, number>();
86
+ let shouldShowFloatOverlay = false;
87
+
88
+ for (const route of allRoutes) {
89
+ const descriptor = descriptors[route.key];
90
+ if (!descriptor) {
91
+ if (preloadedRoutes.includes(route)) {
92
+ continue;
93
+ }
94
+
95
+ throw new Error(
96
+ `withScreenTransitions could not find a descriptor for route "${route.key}".`,
97
+ );
98
+ }
99
+
100
+ const normalizedDescriptor = normalizeDescriptor(descriptor);
101
+ const sceneIndex = scenes.length;
102
+ const previousDescriptor = scenes[sceneIndex - 1]?.descriptor;
103
+
104
+ if (previousDescriptor) {
105
+ scenes[sceneIndex - 1] = {
106
+ ...scenes[sceneIndex - 1],
107
+ nextDescriptor: normalizedDescriptor,
108
+ };
109
+ }
110
+
111
+ scenes.push({
112
+ route,
113
+ descriptor: normalizedDescriptor,
114
+ previousDescriptor,
115
+ });
116
+ routeKeys.push(route.key);
117
+ animationMaps.push(AnimationStore.getBag(route.key));
118
+ routeIndexByKey.set(route.key, sceneIndex);
119
+
120
+ if (
121
+ !shouldShowFloatOverlay &&
122
+ (normalizedDescriptor.options as ScreenTransitionDescriptorOptions)
123
+ .enableTransitions &&
124
+ isOverlayVisible(normalizedDescriptor.options)
125
+ ) {
126
+ shouldShowFloatOverlay = true;
127
+ }
128
+ }
129
+
130
+ return {
131
+ routes: allRoutes,
132
+ routeKeys,
133
+ scenes,
134
+ animationMaps,
135
+ routeIndexByKey,
136
+ shouldShowFloatOverlay,
137
+ };
138
+ }
139
+
140
+ type ScreenTransitionsStackContentProps = {
141
+ layout?: NavigatorLayout;
142
+ layoutArgs: NavigatorLayoutArgs;
143
+ };
144
+
145
+ function ScreenTransitionsStackContent({
146
+ layout,
147
+ layoutArgs,
148
+ }: ScreenTransitionsStackContentProps) {
149
+ const { flags } = useStackCoreContext();
150
+ const transitionState = useMemo(
151
+ () =>
152
+ buildTransitionStackState({
153
+ state: layoutArgs.state,
154
+ descriptors: layoutArgs.descriptors as DescriptorMap,
155
+ }),
156
+ [layoutArgs.state, layoutArgs.descriptors],
157
+ );
158
+ const { optimisticFocusedIndex } = useStackDerived(
159
+ transitionState.animationMaps,
160
+ );
161
+ const stackContextValue = useMemo<StackContextValue>(
162
+ () => ({
163
+ flags,
164
+ navigatorKey: layoutArgs.state.key,
165
+ routeKeys: transitionState.routeKeys,
166
+ routes: transitionState.routes as Route<string>[],
167
+ scenes: transitionState.scenes,
168
+ optimisticFocusedIndex,
169
+ focusedIndex: layoutArgs.state.index,
170
+ }),
171
+ [
172
+ flags,
173
+ layoutArgs.state.key,
174
+ layoutArgs.state.index,
175
+ transitionState.routeKeys,
176
+ transitionState.routes,
177
+ transitionState.scenes,
178
+ optimisticFocusedIndex,
179
+ ],
180
+ );
181
+ const adapterContextValue = useMemo(
182
+ () => ({
183
+ routeIndexByKey: transitionState.routeIndexByKey,
184
+ scenes: transitionState.scenes,
185
+ }),
186
+ [transitionState.routeIndexByKey, transitionState.scenes],
187
+ );
188
+ const children = layout ? layout(layoutArgs) : layoutArgs.children;
189
+
190
+ return (
191
+ <ScreenTransitionsAdapterProvider value={adapterContextValue}>
192
+ <StackProvider value={stackContextValue}>
193
+ {transitionState.shouldShowFloatOverlay ? <Overlay.Float /> : null}
194
+ {children}
195
+ </StackProvider>
196
+ </ScreenTransitionsAdapterProvider>
197
+ );
198
+ }
199
+
200
+ export const ScreenTransitionsStackLayout = withStackCore(
201
+ { TRANSITIONS_ALWAYS_ON: false, STACK_TYPE: StackType.NATIVE },
202
+ ScreenTransitionsStackContent,
203
+ );
204
+
205
+ export function ScreenTransitionsScreenLayout({
206
+ screenLayout,
207
+ screenLayoutArgs,
208
+ }: {
209
+ screenLayout?: ScreenLayout;
210
+ screenLayoutArgs: ScreenLayoutArgs;
211
+ }) {
212
+ const { routeIndexByKey, scenes } = useScreenTransitionsAdapterContext();
213
+ const sceneIndex = routeIndexByKey.get(screenLayoutArgs.route.key);
214
+ const children = screenLayout
215
+ ? screenLayout(screenLayoutArgs)
216
+ : screenLayoutArgs.children;
217
+
218
+ if (sceneIndex === undefined) {
219
+ return <>{children}</>;
220
+ }
221
+
222
+ const scene = scenes[sceneIndex];
223
+
224
+ return (
225
+ <ScreenComposer
226
+ previous={scene.previousDescriptor}
227
+ current={scene.descriptor}
228
+ next={scene.nextDescriptor}
229
+ >
230
+ {children}
231
+ </ScreenComposer>
232
+ );
233
+ }
@@ -0,0 +1,28 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+
3
+ export type NavigatorLayoutArgs = {
4
+ state: any;
5
+ navigation: any;
6
+ descriptors: Record<string, any>;
7
+ children: ReactNode;
8
+ };
9
+
10
+ export type NavigatorLayout = (
11
+ props: NavigatorLayoutArgs,
12
+ ) => React.ReactElement;
13
+
14
+ export type ScreenLayoutArgs = {
15
+ route: { key: string };
16
+ navigation: any;
17
+ options: any;
18
+ theme: any;
19
+ children: ReactNode;
20
+ };
21
+
22
+ export type ScreenLayout = (props: ScreenLayoutArgs) => React.ReactElement;
23
+
24
+ export type NavigatorWithScreenTransitions = {
25
+ Navigator: ComponentType<any>;
26
+ Screen: unknown;
27
+ Group: unknown;
28
+ };
@@ -0,0 +1,8 @@
1
+ import { IS_WEB } from "../../constants";
2
+ import type { InactiveBehavior } from "../../types/screen.types";
3
+
4
+ export type { InactiveBehavior } from "../../types/screen.types";
5
+
6
+ export const DEFAULT_INACTIVE_BEHAVIOR: InactiveBehavior = IS_WEB
7
+ ? "unmount"
8
+ : "detach";
@@ -0,0 +1,2 @@
1
+ export { ActivityContainer } from "./variants/activity-container";
2
+ export { ActivityScreen } from "./variants/activity-screen";
@@ -0,0 +1,25 @@
1
+ import { StyleSheet, View } from "react-native";
2
+
3
+ import { ScreenContainer } from "react-native-screens";
4
+ import { IS_WEB } from "../../../constants";
5
+ import { useStack } from "../../../hooks/navigation/use-stack";
6
+
7
+ interface Props {
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ export const ActivityContainer = ({ children }: Props) => {
12
+ const nativeScreenDisabled = useStack((s) => s.flags.DISABLE_NATIVE_SCREENS);
13
+ const Component = IS_WEB || nativeScreenDisabled ? View : ScreenContainer;
14
+ return (
15
+ <Component collapsable={false} style={styles.container}>
16
+ {children}
17
+ </Component>
18
+ );
19
+ };
20
+
21
+ const styles = StyleSheet.create({
22
+ container: {
23
+ flex: 1,
24
+ },
25
+ });
@@ -0,0 +1,133 @@
1
+ import type * as React from "react";
2
+ import { memo } from "react";
3
+ import { StyleSheet, View, type ViewProps } from "react-native";
4
+ import { useDerivedValue } from "react-native-reanimated";
5
+ import { Screen } from "react-native-screens";
6
+ import { IS_WEB } from "../../../constants";
7
+ import { useStack } from "../../../hooks/navigation/use-stack";
8
+ import { useSharedValueState } from "../../../hooks/reanimated/use-shared-value-state";
9
+ import { AnimationStore } from "../../../stores/animation.store";
10
+ import type { StackSceneActivity } from "../../../types/stack.types";
11
+ import { DEFAULT_INACTIVE_BEHAVIOR, type InactiveBehavior } from "../helpers";
12
+
13
+ type ActivityState = 0 | 1 | 2;
14
+ const ActivityStateByActivity = {
15
+ active: 2,
16
+ inert: 1,
17
+ inactive: 0,
18
+ closing: 1,
19
+ } satisfies Record<StackSceneActivity, ActivityState>;
20
+
21
+ const PointerEventsByActivity = {
22
+ active: "auto",
23
+ inert: "auto",
24
+ inactive: "none",
25
+ closing: "none",
26
+ } satisfies Record<StackSceneActivity, ViewProps["pointerEvents"]>;
27
+
28
+ interface ActivityScreenProps {
29
+ activity: StackSceneActivity;
30
+ children: React.ReactNode;
31
+ inactiveBehavior?: InactiveBehavior;
32
+ paintDriverRouteKey?: string;
33
+ hasNestedState?: boolean;
34
+ }
35
+
36
+ export const ActivityScreen = memo(function ActivityScreen({
37
+ activity,
38
+ children,
39
+ inactiveBehavior = DEFAULT_INACTIVE_BEHAVIOR,
40
+ paintDriverRouteKey,
41
+ hasNestedState,
42
+ }: ActivityScreenProps) {
43
+ const nativeScreenDisabled = useStack((s) => s.flags.DISABLE_NATIVE_SCREENS);
44
+ const paintDriverAnimations = paintDriverRouteKey
45
+ ? AnimationStore.getBag(paintDriverRouteKey)
46
+ : undefined;
47
+
48
+ /**
49
+ * Avoid hiding inactive content until the screen that exposes it has settled.
50
+ *
51
+ * For A(inactive), B(inert), C(active), A's paint depends on C finishing its
52
+ * transition. Watching B can still leave a brief blank frame, so we wait for
53
+ * C's progress to reach its settled value of 1 before hiding A.
54
+ */
55
+ const isPaintDriverSettled = useDerivedValue(() => {
56
+ "worklet";
57
+
58
+ if (!paintDriverAnimations) {
59
+ return false;
60
+ }
61
+
62
+ return paintDriverAnimations.progress.get() >= 1;
63
+ });
64
+
65
+ const isPaintDriverSettledOnJS = useSharedValueState(isPaintDriverSettled);
66
+
67
+ let activityState: ActivityState = ActivityStateByActivity[activity];
68
+ let shouldFreeze = false;
69
+ let visible = activity !== "inactive";
70
+
71
+ const shouldWaitForPaintDriver = !isPaintDriverSettledOnJS;
72
+
73
+ if (activity === "inactive") {
74
+ if (inactiveBehavior === "keep") {
75
+ activityState = 1;
76
+ visible = true;
77
+ } else if (shouldWaitForPaintDriver) {
78
+ // Delay hiding until the paint driver has settled to avoid
79
+ // a blank frame during the transition.
80
+ activityState = 1;
81
+ visible = true;
82
+ } else if (inactiveBehavior === "freeze") {
83
+ activityState = 1;
84
+ shouldFreeze = true;
85
+ visible = true;
86
+ } else {
87
+ // `detach` hides native presentation. Non-nested `unmount`
88
+ // removes the React subtree through the JS guard below.
89
+ activityState = 0;
90
+ visible = false;
91
+ }
92
+ }
93
+
94
+ const shouldUnmount =
95
+ inactiveBehavior === "unmount" &&
96
+ activity === "inactive" &&
97
+ !hasNestedState &&
98
+ isPaintDriverSettledOnJS;
99
+
100
+ const pointerEvents = PointerEventsByActivity[activity];
101
+
102
+ if (shouldUnmount) {
103
+ return null;
104
+ }
105
+
106
+ const style = [StyleSheet.absoluteFill, visible ? undefined : styles.hidden];
107
+
108
+ if (IS_WEB || nativeScreenDisabled) {
109
+ return (
110
+ <View style={style} pointerEvents={pointerEvents} collapsable={false}>
111
+ {children}
112
+ </View>
113
+ );
114
+ }
115
+
116
+ return (
117
+ <Screen
118
+ style={style}
119
+ activityState={activityState}
120
+ shouldFreeze={shouldFreeze}
121
+ pointerEvents={pointerEvents}
122
+ collapsable={false}
123
+ >
124
+ {children}
125
+ </Screen>
126
+ );
127
+ });
128
+
129
+ const styles = StyleSheet.create({
130
+ hidden: {
131
+ display: "none",
132
+ },
133
+ });
@@ -9,8 +9,10 @@ import {
9
9
  } from "../../../stores/bounds/internals/links";
10
10
  import { ScrollStore } from "../../../stores/scroll.store";
11
11
  import { SystemStore } from "../../../stores/system.store";
12
+ import { getVisibilityBlockOffset } from "../../../utils/visibility-block-offset";
12
13
  import type { MeasureBoundary } from "../types";
13
14
  import {
15
+ applyVisibilityBlockOffset,
14
16
  isMeasurementInViewport,
15
17
  measureWithOverscrollAwareness,
16
18
  } from "../utils/measured-bounds";
@@ -55,6 +57,19 @@ export const useMeasurer = ({
55
57
 
56
58
  if (!measured) return;
57
59
 
60
+ // Source boundaries do not need offset correction. Only destination
61
+ // captures can measure while the visibility gate is still blocked.
62
+ const shouldAdjustBlockedDestination =
63
+ target.type === "destination" &&
64
+ pendingLifecycleStartBlockCount.get() > 0;
65
+
66
+ const normalizedMeasured = shouldAdjustBlockedDestination
67
+ ? applyVisibilityBlockOffset(
68
+ measured,
69
+ getVisibilityBlockOffset(viewportHeight),
70
+ )
71
+ : measured;
72
+
58
73
  /**
59
74
  * - Destination Pass -
60
75
  * Be strict while lifecycle start is blocked for destination capture.
@@ -68,14 +83,18 @@ export const useMeasurer = ({
68
83
  const viewportAllowsDestinationWrite =
69
84
  target.type !== "destination" ||
70
85
  !shouldGuardDestinationViewport ||
71
- isMeasurementInViewport(measured, viewportWidth, viewportHeight);
86
+ isMeasurementInViewport(
87
+ normalizedMeasured,
88
+ viewportWidth,
89
+ viewportHeight,
90
+ );
72
91
 
73
92
  if (!viewportAllowsDestinationWrite) return;
74
93
 
75
94
  // Set the bounds entry on every measure to avoid any stale measurements
76
95
  // for the public read API.
77
96
  setEntry(entryTag, currentScreenKey, {
78
- bounds: measured,
97
+ bounds: normalizedMeasured,
79
98
  });
80
99
 
81
100
  if (target.type === "source") {
@@ -83,7 +102,7 @@ export const useMeasurer = ({
83
102
  target.pairKey,
84
103
  linkId,
85
104
  currentScreenKey,
86
- measured,
105
+ normalizedMeasured,
87
106
  preparedStyles,
88
107
  group,
89
108
  );
@@ -94,7 +113,7 @@ export const useMeasurer = ({
94
113
  target.pairKey,
95
114
  linkId,
96
115
  currentScreenKey,
97
- measured,
116
+ normalizedMeasured,
98
117
  preparedStyles,
99
118
  group,
100
119
  );
@@ -46,6 +46,21 @@ export const adjustedMeasuredBoundsForOverscrollDeltas = (
46
46
  };
47
47
  };
48
48
 
49
+ export const applyVisibilityBlockOffset = (
50
+ measured: MeasuredDimensions,
51
+ offset: number,
52
+ ): MeasuredDimensions => {
53
+ "worklet";
54
+ if (offset === 0) {
55
+ return measured;
56
+ }
57
+
58
+ return {
59
+ ...measured,
60
+ pageY: measured.pageY - offset,
61
+ };
62
+ };
63
+
49
64
  export const isMeasurementInViewport = (
50
65
  measured: MeasuredDimensions,
51
66
  viewportWidth: number,