react-native-screen-transitions 3.2.0-beta.2 → 3.2.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 (239) hide show
  1. package/README.md +346 -620
  2. package/lib/commonjs/blank-stack/components/stack-view.js +0 -2
  3. package/lib/commonjs/blank-stack/components/stack-view.js.map +1 -1
  4. package/lib/commonjs/blank-stack/components/stack-view.native.js +0 -2
  5. package/lib/commonjs/blank-stack/components/stack-view.native.js.map +1 -1
  6. package/lib/commonjs/component-stack/components/stack-view.js +16 -20
  7. package/lib/commonjs/component-stack/components/stack-view.js.map +1 -1
  8. package/lib/commonjs/native-stack/views/NativeStackView.native.js +3 -3
  9. package/lib/commonjs/native-stack/views/NativeStackView.native.js.map +1 -1
  10. package/lib/commonjs/shared/components/overlay/variations/float-overlay.js +1 -6
  11. package/lib/commonjs/shared/components/overlay/variations/float-overlay.js.map +1 -1
  12. package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +16 -64
  13. package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -1
  14. package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js +5 -8
  15. package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js.map +1 -1
  16. package/lib/commonjs/shared/components/screen-lifecycle.js +29 -0
  17. package/lib/commonjs/shared/components/screen-lifecycle.js.map +1 -0
  18. package/lib/commonjs/shared/constants.js +4 -2
  19. package/lib/commonjs/shared/constants.js.map +1 -1
  20. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +3 -0
  21. package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
  22. package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
  23. package/lib/commonjs/shared/hooks/lifecycle/use-close-transition.js +127 -0
  24. package/lib/commonjs/shared/hooks/lifecycle/use-close-transition.js.map +1 -0
  25. package/lib/commonjs/shared/hooks/lifecycle/use-open-transition.js +35 -0
  26. package/lib/commonjs/shared/hooks/lifecycle/use-open-transition.js.map +1 -0
  27. package/lib/commonjs/shared/hooks/lifecycle/use-screen-events.js +58 -0
  28. package/lib/commonjs/shared/hooks/lifecycle/use-screen-events.js.map +1 -0
  29. package/lib/commonjs/shared/hooks/navigation/use-history.js +24 -0
  30. package/lib/commonjs/shared/hooks/navigation/use-history.js.map +1 -0
  31. package/lib/commonjs/shared/hooks/navigation/use-screen-state.js +45 -0
  32. package/lib/commonjs/shared/hooks/navigation/use-screen-state.js.map +1 -0
  33. package/lib/commonjs/shared/hooks/use-stable-callback-value.js +0 -2
  34. package/lib/commonjs/shared/hooks/use-stable-callback-value.js.map +1 -1
  35. package/lib/commonjs/shared/index.js +14 -0
  36. package/lib/commonjs/shared/index.js.map +1 -1
  37. package/lib/commonjs/shared/providers/screen/keys.provider.js +0 -6
  38. package/lib/commonjs/shared/providers/screen/keys.provider.js.map +1 -1
  39. package/lib/commonjs/shared/providers/screen/screen-composer.js +9 -7
  40. package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
  41. package/lib/commonjs/shared/providers/screen/styles.provider.js +1 -1
  42. package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
  43. package/lib/commonjs/shared/providers/stack/direct.provider.js +9 -0
  44. package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
  45. package/lib/commonjs/shared/providers/stack/managed.provider.js +9 -0
  46. package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
  47. package/lib/commonjs/shared/stores/animation.store.js +3 -13
  48. package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
  49. package/lib/commonjs/shared/stores/history.store.js +185 -0
  50. package/lib/commonjs/shared/stores/history.store.js.map +1 -0
  51. package/lib/commonjs/shared/types/index.js +3 -3
  52. package/lib/commonjs/shared/types/index.js.map +1 -1
  53. package/lib/commonjs/shared/types/stack.types.js +4 -0
  54. package/lib/commonjs/shared/types/stack.types.js.map +1 -1
  55. package/lib/commonjs/shared/utils/animation/start-screen-transition.js +10 -6
  56. package/lib/commonjs/shared/utils/animation/start-screen-transition.js.map +1 -1
  57. package/lib/commonjs/shared/utils/bounds/index.js +19 -4
  58. package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
  59. package/lib/module/blank-stack/components/stack-view.js +0 -2
  60. package/lib/module/blank-stack/components/stack-view.js.map +1 -1
  61. package/lib/module/blank-stack/components/stack-view.native.js +0 -2
  62. package/lib/module/blank-stack/components/stack-view.native.js.map +1 -1
  63. package/lib/module/component-stack/components/stack-view.js +16 -20
  64. package/lib/module/component-stack/components/stack-view.js.map +1 -1
  65. package/lib/module/native-stack/views/NativeStackView.native.js +3 -3
  66. package/lib/module/native-stack/views/NativeStackView.native.js.map +1 -1
  67. package/lib/module/shared/components/overlay/variations/float-overlay.js +1 -6
  68. package/lib/module/shared/components/overlay/variations/float-overlay.js.map +1 -1
  69. package/lib/module/shared/components/overlay/variations/overlay-host.js +16 -64
  70. package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -1
  71. package/lib/module/shared/components/overlay/variations/screen-overlay.js +5 -8
  72. package/lib/module/shared/components/overlay/variations/screen-overlay.js.map +1 -1
  73. package/lib/module/shared/components/screen-lifecycle.js +24 -0
  74. package/lib/module/shared/components/screen-lifecycle.js.map +1 -0
  75. package/lib/module/shared/constants.js +3 -1
  76. package/lib/module/shared/constants.js.map +1 -1
  77. package/lib/module/shared/hooks/animation/use-screen-animation.js +3 -0
  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/hooks/lifecycle/use-close-transition.js +122 -0
  81. package/lib/module/shared/hooks/lifecycle/use-close-transition.js.map +1 -0
  82. package/lib/module/shared/hooks/lifecycle/use-open-transition.js +32 -0
  83. package/lib/module/shared/hooks/lifecycle/use-open-transition.js.map +1 -0
  84. package/lib/module/shared/hooks/lifecycle/use-screen-events.js +54 -0
  85. package/lib/module/shared/hooks/lifecycle/use-screen-events.js.map +1 -0
  86. package/lib/module/shared/hooks/navigation/use-history.js +20 -0
  87. package/lib/module/shared/hooks/navigation/use-history.js.map +1 -0
  88. package/lib/module/shared/hooks/navigation/use-screen-state.js +41 -0
  89. package/lib/module/shared/hooks/navigation/use-screen-state.js.map +1 -0
  90. package/lib/module/shared/hooks/use-stable-callback-value.js +0 -3
  91. package/lib/module/shared/hooks/use-stable-callback-value.js.map +1 -1
  92. package/lib/module/shared/index.js +2 -0
  93. package/lib/module/shared/index.js.map +1 -1
  94. package/lib/module/shared/providers/screen/keys.provider.js +0 -6
  95. package/lib/module/shared/providers/screen/keys.provider.js.map +1 -1
  96. package/lib/module/shared/providers/screen/screen-composer.js +9 -7
  97. package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
  98. package/lib/module/shared/providers/screen/styles.provider.js +1 -1
  99. package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
  100. package/lib/module/shared/providers/stack/direct.provider.js +10 -1
  101. package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
  102. package/lib/module/shared/providers/stack/managed.provider.js +10 -1
  103. package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
  104. package/lib/module/shared/stores/animation.store.js +4 -14
  105. package/lib/module/shared/stores/animation.store.js.map +1 -1
  106. package/lib/module/shared/stores/history.store.js +181 -0
  107. package/lib/module/shared/stores/history.store.js.map +1 -0
  108. package/lib/module/shared/types/index.js +1 -1
  109. package/lib/module/shared/types/index.js.map +1 -1
  110. package/lib/module/shared/types/stack.types.js +5 -0
  111. package/lib/module/shared/types/stack.types.js.map +1 -1
  112. package/lib/module/shared/utils/animation/start-screen-transition.js +6 -2
  113. package/lib/module/shared/utils/animation/start-screen-transition.js.map +1 -1
  114. package/lib/module/shared/utils/bounds/index.js +19 -4
  115. package/lib/module/shared/utils/bounds/index.js.map +1 -1
  116. package/lib/typescript/blank-stack/components/stack-view.d.ts.map +1 -1
  117. package/lib/typescript/blank-stack/components/stack-view.native.d.ts.map +1 -1
  118. package/lib/typescript/blank-stack/types.d.ts +1 -8
  119. package/lib/typescript/blank-stack/types.d.ts.map +1 -1
  120. package/lib/typescript/component-stack/components/stack-view.d.ts.map +1 -1
  121. package/lib/typescript/component-stack/types.d.ts +1 -8
  122. package/lib/typescript/component-stack/types.d.ts.map +1 -1
  123. package/lib/typescript/native-stack/types.d.ts +2 -3
  124. package/lib/typescript/native-stack/types.d.ts.map +1 -1
  125. package/lib/typescript/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  126. package/lib/typescript/shared/components/overlay/variations/float-overlay.d.ts.map +1 -1
  127. package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +1 -6
  128. package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
  129. package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts +4 -0
  130. package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts.map +1 -1
  131. package/lib/typescript/shared/components/screen-lifecycle.d.ts +12 -0
  132. package/lib/typescript/shared/components/screen-lifecycle.d.ts.map +1 -0
  133. package/lib/typescript/shared/constants.d.ts +2 -1
  134. package/lib/typescript/shared/constants.d.ts.map +1 -1
  135. package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
  136. package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
  137. package/lib/typescript/shared/hooks/lifecycle/use-close-transition.d.ts +13 -0
  138. package/lib/typescript/shared/hooks/lifecycle/use-close-transition.d.ts.map +1 -0
  139. package/lib/typescript/shared/hooks/lifecycle/use-open-transition.d.ts +11 -0
  140. package/lib/typescript/shared/hooks/lifecycle/use-open-transition.d.ts.map +1 -0
  141. package/lib/typescript/shared/hooks/lifecycle/use-screen-events.d.ts +7 -0
  142. package/lib/typescript/shared/hooks/lifecycle/use-screen-events.d.ts.map +1 -0
  143. package/lib/typescript/shared/hooks/navigation/use-history.d.ts +37 -0
  144. package/lib/typescript/shared/hooks/navigation/use-history.d.ts.map +1 -0
  145. package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts +40 -0
  146. package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts.map +1 -0
  147. package/lib/typescript/shared/hooks/use-stable-callback-value.d.ts.map +1 -1
  148. package/lib/typescript/shared/index.d.ts +22 -20
  149. package/lib/typescript/shared/index.d.ts.map +1 -1
  150. package/lib/typescript/shared/providers/screen/keys.provider.d.ts +2 -9
  151. package/lib/typescript/shared/providers/screen/keys.provider.d.ts.map +1 -1
  152. package/lib/typescript/shared/providers/screen/screen-composer.d.ts +1 -3
  153. package/lib/typescript/shared/providers/screen/screen-composer.d.ts.map +1 -1
  154. package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
  155. package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
  156. package/lib/typescript/shared/stores/animation.store.d.ts +3 -4
  157. package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
  158. package/lib/typescript/shared/stores/history.store.d.ts +82 -0
  159. package/lib/typescript/shared/stores/history.store.d.ts.map +1 -0
  160. package/lib/typescript/shared/types/animation.types.d.ts +10 -6
  161. package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
  162. package/lib/typescript/shared/types/bounds.types.d.ts +1 -1
  163. package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
  164. package/lib/typescript/shared/types/index.d.ts +2 -2
  165. package/lib/typescript/shared/types/index.d.ts.map +1 -1
  166. package/lib/typescript/shared/types/overlay.types.d.ts +21 -0
  167. package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -1
  168. package/lib/typescript/shared/types/screen.types.d.ts +5 -4
  169. package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
  170. package/lib/typescript/shared/types/stack.types.d.ts +10 -0
  171. package/lib/typescript/shared/types/stack.types.d.ts.map +1 -1
  172. package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts.map +1 -1
  173. package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
  174. package/package.json +1 -1
  175. package/src/blank-stack/components/stack-view.native.tsx +0 -2
  176. package/src/blank-stack/components/stack-view.tsx +0 -2
  177. package/src/blank-stack/types.ts +0 -10
  178. package/src/component-stack/components/stack-view.tsx +19 -23
  179. package/src/component-stack/types.ts +0 -10
  180. package/src/native-stack/types.ts +2 -3
  181. package/src/native-stack/views/NativeStackView.native.tsx +2 -3
  182. package/src/shared/__tests__/history.store.test.ts +550 -0
  183. package/src/shared/components/overlay/variations/float-overlay.tsx +2 -8
  184. package/src/shared/components/overlay/variations/overlay-host.tsx +18 -84
  185. package/src/shared/components/overlay/variations/screen-overlay.tsx +6 -15
  186. package/src/shared/components/screen-lifecycle.tsx +32 -0
  187. package/src/shared/constants.ts +4 -1
  188. package/src/shared/hooks/animation/use-screen-animation.tsx +7 -3
  189. package/src/shared/hooks/gestures/use-build-gestures.tsx +0 -2
  190. package/src/shared/hooks/lifecycle/use-close-transition.ts +147 -0
  191. package/src/shared/hooks/lifecycle/use-open-transition.ts +30 -0
  192. package/src/shared/hooks/lifecycle/use-screen-events.ts +62 -0
  193. package/src/shared/hooks/navigation/use-history.ts +63 -0
  194. package/src/shared/hooks/navigation/use-screen-state.tsx +99 -0
  195. package/src/shared/hooks/use-stable-callback-value.ts +0 -1
  196. package/src/shared/index.ts +5 -0
  197. package/src/shared/providers/screen/keys.provider.tsx +1 -25
  198. package/src/shared/providers/screen/screen-composer.tsx +7 -13
  199. package/src/shared/providers/screen/styles.provider.tsx +1 -1
  200. package/src/shared/providers/stack/direct.provider.tsx +11 -1
  201. package/src/shared/providers/stack/managed.provider.tsx +11 -1
  202. package/src/shared/stores/animation.store.ts +6 -20
  203. package/src/shared/stores/history.store.ts +201 -0
  204. package/src/shared/types/animation.types.ts +11 -6
  205. package/src/shared/types/bounds.types.ts +1 -0
  206. package/src/shared/types/index.ts +2 -7
  207. package/src/shared/types/overlay.types.ts +23 -0
  208. package/src/shared/types/screen.types.ts +5 -4
  209. package/src/shared/types/stack.types.ts +17 -1
  210. package/src/shared/utils/animation/start-screen-transition.ts +5 -2
  211. package/src/shared/utils/bounds/index.ts +35 -4
  212. package/lib/commonjs/native-stack/controllers/native-stack-lifecycle.js +0 -90
  213. package/lib/commonjs/native-stack/controllers/native-stack-lifecycle.js.map +0 -1
  214. package/lib/commonjs/shared/controller/managed-lifecycle.js +0 -78
  215. package/lib/commonjs/shared/controller/managed-lifecycle.js.map +0 -1
  216. package/lib/commonjs/shared/types/state.types.js +0 -9
  217. package/lib/commonjs/shared/types/state.types.js.map +0 -1
  218. package/lib/commonjs/shared/utils/read-shared-value.js +0 -17
  219. package/lib/commonjs/shared/utils/read-shared-value.js.map +0 -1
  220. package/lib/module/native-stack/controllers/native-stack-lifecycle.js +0 -83
  221. package/lib/module/native-stack/controllers/native-stack-lifecycle.js.map +0 -1
  222. package/lib/module/shared/controller/managed-lifecycle.js +0 -72
  223. package/lib/module/shared/controller/managed-lifecycle.js.map +0 -1
  224. package/lib/module/shared/types/state.types.js +0 -5
  225. package/lib/module/shared/types/state.types.js.map +0 -1
  226. package/lib/module/shared/utils/read-shared-value.js +0 -14
  227. package/lib/module/shared/utils/read-shared-value.js.map +0 -1
  228. package/lib/typescript/native-stack/controllers/native-stack-lifecycle.d.ts +0 -8
  229. package/lib/typescript/native-stack/controllers/native-stack-lifecycle.d.ts.map +0 -1
  230. package/lib/typescript/shared/controller/managed-lifecycle.d.ts +0 -9
  231. package/lib/typescript/shared/controller/managed-lifecycle.d.ts.map +0 -1
  232. package/lib/typescript/shared/types/state.types.d.ts +0 -3
  233. package/lib/typescript/shared/types/state.types.d.ts.map +0 -1
  234. package/lib/typescript/shared/utils/read-shared-value.d.ts +0 -7
  235. package/lib/typescript/shared/utils/read-shared-value.d.ts.map +0 -1
  236. package/src/native-stack/controllers/native-stack-lifecycle.tsx +0 -96
  237. package/src/shared/controller/managed-lifecycle.tsx +0 -73
  238. package/src/shared/types/state.types.ts +0 -2
  239. package/src/shared/utils/read-shared-value.ts +0 -15
@@ -1,96 +0,0 @@
1
- /** biome-ignore-all lint/style/noNonNullAssertion: <Lifecycles are rendered right under the gesture provider> */
2
- import { useEffect, useLayoutEffect } from "react";
3
- import { useDerivedValue } from "react-native-reanimated";
4
- import { useHighRefreshRate } from "../../shared/hooks/animation/use-high-refresh-rate";
5
- import { useSharedValueState } from "../../shared/hooks/reanimated/use-shared-value-state";
6
- import useStableCallback from "../../shared/hooks/use-stable-callback";
7
- import { useGestureContext } from "../../shared/providers/gestures.provider";
8
- import { useKeys } from "../../shared/providers/screen/keys.provider";
9
- import { AnimationStore } from "../../shared/stores/animation.store";
10
- import { TRUE } from "../../shared/types/state.types";
11
- import { startScreenTransition } from "../../shared/utils/animation/start-screen-transition";
12
- import { resetStoresForScreen } from "../../shared/utils/reset-stores-for-screen";
13
- import type { NativeStackDescriptor } from "../types";
14
-
15
- export interface Props {
16
- children: React.ReactNode;
17
- }
18
-
19
- /**
20
- * Lifecycle controller built out for Native Stack implementation.
21
- */
22
- export const NativeStackScreenLifecycleController = ({ children }: Props) => {
23
- const { current } = useKeys<NativeStackDescriptor>();
24
- const { ancestorContext } = useGestureContext()!;
25
-
26
- const isAncestorDismissingViaGesture = useSharedValueState(
27
- useDerivedValue(() => {
28
- "worklet";
29
- return (
30
- ancestorContext?.gestureAnimationValues.isDismissing?.value ?? false
31
- );
32
- }),
33
- );
34
-
35
- const animations = AnimationStore.getAll(current.route.key);
36
-
37
- const { deactivateHighRefreshRate, activateHighRefreshRate } =
38
- useHighRefreshRate(current);
39
-
40
- const handleBeforeRemove = useStableCallback((e: any) => {
41
- const isEnabled = current.options.enableTransitions;
42
-
43
- const isFirstScreen = current.navigation.getState().index === 0;
44
-
45
- // If transitions are disabled, or an ancestor is dismissing via gesture, or this is the first screen of the stack, reset the stores
46
- if (!isEnabled || isAncestorDismissingViaGesture || isFirstScreen) {
47
- animations.closing.set(TRUE);
48
- resetStoresForScreen(current);
49
- return;
50
- }
51
-
52
- e.preventDefault();
53
- activateHighRefreshRate();
54
- const onAnimationFinish = (finished: boolean) => {
55
- deactivateHighRefreshRate();
56
- if (finished) {
57
- current.navigation.dispatch(e.data.action);
58
-
59
- // we'll ensure the dispatch is complete before resetting stores
60
- requestAnimationFrame(() => {
61
- resetStoresForScreen(current);
62
- });
63
- }
64
- };
65
-
66
- startScreenTransition({
67
- target: "close",
68
- spec: current.options.transitionSpec,
69
- onAnimationFinish,
70
- animations,
71
- });
72
- });
73
-
74
- const handleInitialize = useStableCallback(() => {
75
- activateHighRefreshRate();
76
- startScreenTransition({
77
- target: "open",
78
- spec: current.options.transitionSpec,
79
- animations,
80
- onAnimationFinish: deactivateHighRefreshRate,
81
- });
82
- });
83
-
84
- useEffect(() => {
85
- const unsubscribe = current.navigation.addListener(
86
- "beforeRemove",
87
- handleBeforeRemove,
88
- );
89
-
90
- return unsubscribe;
91
- }, [current.navigation, handleBeforeRemove]);
92
-
93
- useLayoutEffect(handleInitialize, []);
94
-
95
- return children;
96
- };
@@ -1,73 +0,0 @@
1
- import { useLayoutEffect } from "react";
2
- import { runOnJS, useAnimatedReaction } from "react-native-reanimated";
3
- import type { BlankStackDescriptor } from "../../blank-stack/types";
4
- import { useHighRefreshRate } from "../hooks/animation/use-high-refresh-rate";
5
- import useStableCallback from "../hooks/use-stable-callback";
6
- import { useKeys } from "../providers/screen/keys.provider";
7
- import { useManagedStackContext } from "../providers/stack/managed.provider";
8
- import { AnimationStore } from "../stores/animation.store";
9
- import { startScreenTransition } from "../utils/animation/start-screen-transition";
10
- import { resetStoresForScreen } from "../utils/reset-stores-for-screen";
11
-
12
- interface Props {
13
- children: React.ReactNode;
14
- }
15
-
16
- /**
17
- * Lifecycle controller built out for Blank Stack implementation.
18
- */
19
- export const ManagedLifecycle = ({ children }: Props) => {
20
- const { current } = useKeys<BlankStackDescriptor>();
21
- const { handleCloseRoute, closingRouteKeysShared } = useManagedStackContext();
22
-
23
- const animations = AnimationStore.getAll(current.route.key);
24
-
25
- const { deactivateHighRefreshRate, activateHighRefreshRate } =
26
- useHighRefreshRate(current);
27
-
28
- const handleInitialize = useStableCallback(() => {
29
- activateHighRefreshRate();
30
- startScreenTransition({
31
- target: "open",
32
- spec: current.options.transitionSpec,
33
- animations,
34
- onAnimationFinish: deactivateHighRefreshRate,
35
- });
36
- });
37
-
38
- const handleCloseEnd = useStableCallback((finished: boolean) => {
39
- if (!finished) {
40
- return;
41
- }
42
- handleCloseRoute({ route: current.route });
43
- requestAnimationFrame(() => {
44
- deactivateHighRefreshRate();
45
- resetStoresForScreen(current);
46
- });
47
- });
48
-
49
- useAnimatedReaction(
50
- () => ({
51
- keys: closingRouteKeysShared.value,
52
- }),
53
- ({ keys }) => {
54
- if (!keys.includes(current.route.key)) {
55
- return;
56
- }
57
-
58
- runOnJS(activateHighRefreshRate)();
59
- startScreenTransition({
60
- target: "close",
61
- spec: current.options.transitionSpec,
62
- animations,
63
- onAnimationFinish: handleCloseEnd,
64
- });
65
- },
66
- );
67
-
68
- useLayoutEffect(() => {
69
- handleInitialize();
70
- }, [handleInitialize]);
71
-
72
- return children;
73
- };
@@ -1,2 +0,0 @@
1
- export const TRUE = 1;
2
- export const FALSE = 0;
@@ -1,15 +0,0 @@
1
- import {
2
- executeOnUIRuntimeSync,
3
- type SharedValue,
4
- } from "react-native-reanimated";
5
-
6
- /**
7
- * Safely read a SharedValue from the UI thread.
8
- * Avoids the "cannot read .value inside component render" warning.
9
- */
10
- export const readSharedValue = executeOnUIRuntimeSync(
11
- <T>(sv: SharedValue<T>): T => {
12
- "worklet";
13
- return sv.value;
14
- },
15
- );