react-native-screen-transitions 4.0.0-alpha.9 → 4.0.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 (225) hide show
  1. package/README.md +5 -10
  2. package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +53 -1
  3. package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
  4. package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +43 -8
  5. package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  6. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
  7. package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  8. package/lib/commonjs/components/boundary/utils/source-signals.js +6 -4
  9. package/lib/commonjs/components/boundary/utils/source-signals.js.map +1 -1
  10. package/lib/commonjs/components/overlay/helpers/get-active-overlay.js +3 -24
  11. package/lib/commonjs/components/overlay/helpers/get-active-overlay.js.map +1 -1
  12. package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
  13. package/lib/commonjs/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
  14. package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js +1 -2
  15. package/lib/commonjs/components/overlay/hooks/use-overlay-slot.js.map +1 -1
  16. package/lib/commonjs/components/overlay/variations/float-overlay.js +0 -2
  17. package/lib/commonjs/components/overlay/variations/float-overlay.js.map +1 -1
  18. package/lib/commonjs/components/overlay/variations/overlay-host.js +18 -15
  19. package/lib/commonjs/components/overlay/variations/overlay-host.js.map +1 -1
  20. package/lib/commonjs/components/screen-container/layers/content.js +10 -5
  21. package/lib/commonjs/components/screen-container/layers/content.js.map +1 -1
  22. package/lib/commonjs/components/screen-container/layers/surface.js +50 -0
  23. package/lib/commonjs/components/screen-container/layers/surface.js.map +1 -0
  24. package/lib/commonjs/components/stack-view.js +7 -29
  25. package/lib/commonjs/components/stack-view.js.map +1 -1
  26. package/lib/commonjs/configs/index.js +1 -4
  27. package/lib/commonjs/configs/index.js.map +1 -1
  28. package/lib/commonjs/configs/presets.js +1 -384
  29. package/lib/commonjs/configs/presets.js.map +1 -1
  30. package/lib/commonjs/navigators/create-blank-stack-navigator.js +7 -67
  31. package/lib/commonjs/navigators/create-blank-stack-navigator.js.map +1 -1
  32. package/lib/commonjs/navigators/expo-router/index.js +1 -18
  33. package/lib/commonjs/navigators/expo-router/index.js.map +1 -1
  34. package/lib/commonjs/navigators/react-navigation/index.js +1 -3
  35. package/lib/commonjs/navigators/react-navigation/index.js.map +1 -1
  36. package/lib/commonjs/providers/screen/animation/animation.provider.js +6 -1
  37. package/lib/commonjs/providers/screen/animation/animation.provider.js.map +1 -1
  38. package/lib/commonjs/providers/screen/animation/use-screen-animation.js +1 -8
  39. package/lib/commonjs/providers/screen/animation/use-screen-animation.js.map +1 -1
  40. package/lib/commonjs/providers/screen/styles/constants.js +4 -0
  41. package/lib/commonjs/providers/screen/styles/constants.js.map +1 -1
  42. package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js +1 -9
  43. package/lib/commonjs/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
  44. package/lib/commonjs/providers/screen/styles/slot.provider.js +3 -1
  45. package/lib/commonjs/providers/screen/styles/slot.provider.js.map +1 -1
  46. package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +10 -4
  47. package/lib/commonjs/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
  48. package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +4 -3
  49. package/lib/commonjs/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
  50. package/lib/commonjs/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
  51. package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js +9 -2
  52. package/lib/commonjs/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
  53. package/lib/commonjs/utils/create-provider.js +14 -3
  54. package/lib/commonjs/utils/create-provider.js.map +1 -1
  55. package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +50 -0
  56. package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +1 -1
  57. package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +44 -9
  58. package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
  59. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +2 -3
  60. package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
  61. package/lib/module/components/boundary/utils/source-signals.js +6 -4
  62. package/lib/module/components/boundary/utils/source-signals.js.map +1 -1
  63. package/lib/module/components/overlay/helpers/get-active-overlay.js +3 -24
  64. package/lib/module/components/overlay/helpers/get-active-overlay.js.map +1 -1
  65. package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js +4 -3
  66. package/lib/module/components/overlay/helpers/retain-ready-overlay-resources.js.map +1 -1
  67. package/lib/module/components/overlay/hooks/use-overlay-slot.js +1 -2
  68. package/lib/module/components/overlay/hooks/use-overlay-slot.js.map +1 -1
  69. package/lib/module/components/overlay/variations/float-overlay.js +0 -2
  70. package/lib/module/components/overlay/variations/float-overlay.js.map +1 -1
  71. package/lib/module/components/overlay/variations/overlay-host.js +19 -16
  72. package/lib/module/components/overlay/variations/overlay-host.js.map +1 -1
  73. package/lib/module/components/screen-container/layers/content.js +10 -5
  74. package/lib/module/components/screen-container/layers/content.js.map +1 -1
  75. package/lib/module/components/screen-container/layers/surface.js +45 -0
  76. package/lib/module/components/screen-container/layers/surface.js.map +1 -0
  77. package/lib/module/components/stack-view.js +7 -29
  78. package/lib/module/components/stack-view.js.map +1 -1
  79. package/lib/module/configs/index.js +2 -5
  80. package/lib/module/configs/index.js.map +1 -1
  81. package/lib/module/configs/presets.js +0 -380
  82. package/lib/module/configs/presets.js.map +1 -1
  83. package/lib/module/navigators/create-blank-stack-navigator.js +7 -66
  84. package/lib/module/navigators/create-blank-stack-navigator.js.map +1 -1
  85. package/lib/module/navigators/expo-router/index.js +1 -18
  86. package/lib/module/navigators/expo-router/index.js.map +1 -1
  87. package/lib/module/navigators/react-navigation/index.js +1 -3
  88. package/lib/module/navigators/react-navigation/index.js.map +1 -1
  89. package/lib/module/providers/screen/animation/animation.provider.js +4 -0
  90. package/lib/module/providers/screen/animation/animation.provider.js.map +1 -1
  91. package/lib/module/providers/screen/animation/use-screen-animation.js +2 -9
  92. package/lib/module/providers/screen/animation/use-screen-animation.js.map +1 -1
  93. package/lib/module/providers/screen/styles/constants.js +4 -0
  94. package/lib/module/providers/screen/styles/constants.js.map +1 -1
  95. package/lib/module/providers/screen/styles/hooks/slot-resolvers.js +2 -10
  96. package/lib/module/providers/screen/styles/hooks/slot-resolvers.js.map +1 -1
  97. package/lib/module/providers/screen/styles/slot.provider.js +1 -0
  98. package/lib/module/providers/screen/styles/slot.provider.js.map +1 -1
  99. package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js +11 -5
  100. package/lib/module/providers/stack/blank-stack-state/helpers/build-blank-stack-state.js.map +1 -1
  101. package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js +5 -4
  102. package/lib/module/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.js.map +1 -1
  103. package/lib/module/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.js.map +1 -1
  104. package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js +7 -1
  105. package/lib/module/providers/stack/blank-stack-state/helpers/state-equality.js.map +1 -1
  106. package/lib/module/types/animation.types.js +10 -0
  107. package/lib/module/types/animation.types.js.map +1 -1
  108. package/lib/module/utils/create-provider.js +14 -3
  109. package/lib/module/utils/create-provider.js.map +1 -1
  110. package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts +20 -1
  111. package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts.map +1 -1
  112. package/lib/typescript/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
  113. package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
  114. package/lib/typescript/components/boundary/utils/source-signals.d.ts.map +1 -1
  115. package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts +2 -8
  116. package/lib/typescript/components/overlay/helpers/get-active-overlay.d.ts.map +1 -1
  117. package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts +2 -1
  118. package/lib/typescript/components/overlay/helpers/retain-ready-overlay-resources.d.ts.map +1 -1
  119. package/lib/typescript/components/overlay/hooks/use-overlay-slot.d.ts.map +1 -1
  120. package/lib/typescript/components/overlay/variations/float-overlay.d.ts.map +1 -1
  121. package/lib/typescript/components/overlay/variations/overlay-host.d.ts +2 -3
  122. package/lib/typescript/components/overlay/variations/overlay-host.d.ts.map +1 -1
  123. package/lib/typescript/components/screen-container/layers/content.d.ts.map +1 -1
  124. package/lib/typescript/components/screen-container/layers/surface.d.ts +7 -0
  125. package/lib/typescript/components/screen-container/layers/surface.d.ts.map +1 -0
  126. package/lib/typescript/components/stack-view.d.ts +1 -1
  127. package/lib/typescript/components/stack-view.d.ts.map +1 -1
  128. package/lib/typescript/configs/index.d.ts +0 -9
  129. package/lib/typescript/configs/index.d.ts.map +1 -1
  130. package/lib/typescript/configs/presets.d.ts +0 -9
  131. package/lib/typescript/configs/presets.d.ts.map +1 -1
  132. package/lib/typescript/index.d.ts +1 -10
  133. package/lib/typescript/index.d.ts.map +1 -1
  134. package/lib/typescript/navigators/create-blank-stack-navigator.d.ts +2 -4
  135. package/lib/typescript/navigators/create-blank-stack-navigator.d.ts.map +1 -1
  136. package/lib/typescript/navigators/expo-router/index.d.ts +3 -3
  137. package/lib/typescript/navigators/expo-router/index.d.ts.map +1 -1
  138. package/lib/typescript/navigators/react-navigation/index.d.ts +1 -1
  139. package/lib/typescript/navigators/react-navigation/index.d.ts.map +1 -1
  140. package/lib/typescript/providers/screen/animation/animation.provider.d.ts +10 -1
  141. package/lib/typescript/providers/screen/animation/animation.provider.d.ts.map +1 -1
  142. package/lib/typescript/providers/screen/animation/use-screen-animation.d.ts.map +1 -1
  143. package/lib/typescript/providers/screen/styles/constants.d.ts.map +1 -1
  144. package/lib/typescript/providers/screen/styles/hooks/slot-resolvers.d.ts.map +1 -1
  145. package/lib/typescript/providers/screen/styles/slot.provider.d.ts +11 -2
  146. package/lib/typescript/providers/screen/styles/slot.provider.d.ts.map +1 -1
  147. package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts +3 -3
  148. package/lib/typescript/providers/stack/blank-stack-state/helpers/build-blank-stack-state.d.ts.map +1 -1
  149. package/lib/typescript/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.d.ts.map +1 -1
  150. package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts +3 -2
  151. package/lib/typescript/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.d.ts.map +1 -1
  152. package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts +4 -4
  153. package/lib/typescript/providers/stack/blank-stack-state/helpers/state-equality.d.ts.map +1 -1
  154. package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts +6 -5
  155. package/lib/typescript/providers/stack/blank-stack-state/helpers/types.d.ts.map +1 -1
  156. package/lib/typescript/providers/stack/blank-stack.provider.d.ts +3 -1
  157. package/lib/typescript/providers/stack/blank-stack.provider.d.ts.map +1 -1
  158. package/lib/typescript/types/animation.types.d.ts +15 -7
  159. package/lib/typescript/types/animation.types.d.ts.map +1 -1
  160. package/lib/typescript/types/blank-stack.types.d.ts +2 -23
  161. package/lib/typescript/types/blank-stack.types.d.ts.map +1 -1
  162. package/lib/typescript/types/index.d.ts +2 -2
  163. package/lib/typescript/types/index.d.ts.map +1 -1
  164. package/lib/typescript/types/providers/blank-stack-provider.types.d.ts +8 -6
  165. package/lib/typescript/types/providers/blank-stack-provider.types.d.ts.map +1 -1
  166. package/lib/typescript/types/screen.types.d.ts +31 -0
  167. package/lib/typescript/types/screen.types.d.ts.map +1 -1
  168. package/lib/typescript/utils/create-provider.d.ts +4 -1
  169. package/lib/typescript/utils/create-provider.d.ts.map +1 -1
  170. package/package.json +3 -8
  171. package/src/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.ts +89 -0
  172. package/src/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +97 -14
  173. package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +2 -6
  174. package/src/components/boundary/utils/source-signals.ts +6 -4
  175. package/src/components/overlay/helpers/get-active-overlay.ts +4 -36
  176. package/src/components/overlay/helpers/retain-ready-overlay-resources.ts +10 -1
  177. package/src/components/overlay/hooks/use-overlay-slot.ts +1 -5
  178. package/src/components/overlay/variations/float-overlay.tsx +9 -12
  179. package/src/components/overlay/variations/overlay-host.tsx +24 -22
  180. package/src/components/screen-container/layers/content.tsx +12 -7
  181. package/src/components/screen-container/layers/surface.tsx +65 -0
  182. package/src/components/stack-view.tsx +8 -39
  183. package/src/configs/index.ts +0 -6
  184. package/src/configs/presets.ts +0 -447
  185. package/src/index.ts +3 -1
  186. package/src/navigators/create-blank-stack-navigator.tsx +16 -124
  187. package/src/navigators/expo-router/index.tsx +0 -23
  188. package/src/navigators/react-navigation/index.tsx +0 -3
  189. package/src/providers/screen/animation/animation.provider.tsx +60 -54
  190. package/src/providers/screen/animation/use-screen-animation.tsx +2 -14
  191. package/src/providers/screen/styles/constants.ts +2 -0
  192. package/src/providers/screen/styles/hooks/slot-resolvers.tsx +2 -17
  193. package/src/providers/screen/styles/slot.provider.tsx +2 -0
  194. package/src/providers/stack/blank-stack-state/helpers/build-blank-stack-state.ts +30 -12
  195. package/src/providers/stack/blank-stack-state/helpers/derive-blank-stack-state.ts +11 -3
  196. package/src/providers/stack/blank-stack-state/helpers/reconcile-blank-stack-routes.ts +2 -2
  197. package/src/providers/stack/blank-stack-state/helpers/state-equality.ts +27 -16
  198. package/src/providers/stack/blank-stack-state/helpers/types.ts +9 -4
  199. package/src/types/animation.types.ts +15 -9
  200. package/src/types/blank-stack.types.ts +1 -29
  201. package/src/types/index.ts +3 -1
  202. package/src/types/providers/blank-stack-provider.types.ts +14 -11
  203. package/src/types/screen.types.ts +36 -0
  204. package/src/utils/create-provider.tsx +22 -4
  205. package/lib/commonjs/components/boundary/portal/utils/teleport-control.js +0 -16
  206. package/lib/commonjs/components/boundary/portal/utils/teleport-control.js.map +0 -1
  207. package/lib/commonjs/providers/navigation/navigation-host.provider.js +0 -56
  208. package/lib/commonjs/providers/navigation/navigation-host.provider.js.map +0 -1
  209. package/lib/commonjs/providers/navigation/react-navigation-host.js +0 -23
  210. package/lib/commonjs/providers/navigation/react-navigation-host.js.map +0 -1
  211. package/lib/module/components/boundary/portal/utils/teleport-control.js +0 -11
  212. package/lib/module/components/boundary/portal/utils/teleport-control.js.map +0 -1
  213. package/lib/module/providers/navigation/navigation-host.provider.js +0 -50
  214. package/lib/module/providers/navigation/navigation-host.provider.js.map +0 -1
  215. package/lib/module/providers/navigation/react-navigation-host.js +0 -19
  216. package/lib/module/providers/navigation/react-navigation-host.js.map +0 -1
  217. package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts +0 -3
  218. package/lib/typescript/components/boundary/portal/utils/teleport-control.d.ts.map +0 -1
  219. package/lib/typescript/providers/navigation/navigation-host.provider.d.ts +0 -21
  220. package/lib/typescript/providers/navigation/navigation-host.provider.d.ts.map +0 -1
  221. package/lib/typescript/providers/navigation/react-navigation-host.d.ts +0 -3
  222. package/lib/typescript/providers/navigation/react-navigation-host.d.ts.map +0 -1
  223. package/src/components/boundary/portal/utils/teleport-control.ts +0 -13
  224. package/src/providers/navigation/navigation-host.provider.tsx +0 -75
  225. package/src/providers/navigation/react-navigation-host.tsx +0 -24
@@ -1,5 +1,4 @@
1
- import { memo, type ReactNode } from "react";
2
- import { NavigationScreenProvider } from "../providers/navigation/navigation-host.provider";
1
+ import { memo } from "react";
3
2
  import { ScreenComposer } from "../providers/screen/screen-composer";
4
3
  import {
5
4
  BlankStackProvider,
@@ -18,28 +17,6 @@ interface RouteKeyProps {
18
17
  routeKey: string;
19
18
  }
20
19
 
21
- const BlankNavigationProvider = memo(function BlankNavigationProvider({
22
- children,
23
- routeKey,
24
- }: RouteKeyProps & { children: ReactNode }) {
25
- const navigation = useBlankStackStore(
26
- (store) => store.scenesByKey[routeKey]?.descriptor.navigation,
27
- );
28
- const route = useBlankStackStore(
29
- (store) => store.scenesByKey[routeKey]?.route,
30
- );
31
-
32
- if (!navigation || !route) {
33
- throw new Error(`Blank stack scene "${routeKey}" was not found.`);
34
- }
35
-
36
- return (
37
- <NavigationScreenProvider navigation={navigation} route={route}>
38
- {children}
39
- </NavigationScreenProvider>
40
- );
41
- });
42
-
43
20
  const BlankSceneContent = memo(function BlankSceneContent({
44
21
  routeKey,
45
22
  }: RouteKeyProps) {
@@ -47,27 +24,21 @@ const BlankSceneContent = memo(function BlankSceneContent({
47
24
  (store) => store?.scenesByKey[routeKey]?.descriptor.render,
48
25
  );
49
26
 
50
- return render?.() ?? null;
27
+ return render?.();
51
28
  });
52
29
 
53
30
  const BlankSceneRow = memo(function BlankSceneRow({ routeKey }: RouteKeyProps) {
54
31
  return (
55
- <BlankNavigationProvider routeKey={routeKey}>
56
- <ActivityScreen routeKey={routeKey}>
57
- <ScreenComposer routeKey={routeKey}>
58
- <BlankSceneContent routeKey={routeKey} />
59
- </ScreenComposer>
60
- </ActivityScreen>
61
- </BlankNavigationProvider>
32
+ <ActivityScreen routeKey={routeKey}>
33
+ <ScreenComposer routeKey={routeKey}>
34
+ <BlankSceneContent routeKey={routeKey} />
35
+ </ScreenComposer>
36
+ </ActivityScreen>
62
37
  );
63
38
  });
64
39
 
65
- const EMPTY_ROUTE_KEYS: string[] = [];
66
-
67
40
  const StackViewContent = memo(function StackViewContent() {
68
- const routeKeys = useBlankStackStore(
69
- (store) => store?.routeKeys ?? EMPTY_ROUTE_KEYS,
70
- );
41
+ const routeKeys = useBlankStackStore((store) => store?.routeKeys);
71
42
 
72
43
  return (
73
44
  <PortalProvider>
@@ -89,7 +60,6 @@ export const StackView = memo(function StackView({
89
60
  state,
90
61
  navigation,
91
62
  descriptors,
92
- describe,
93
63
  }: StackViewProps) {
94
64
  return (
95
65
  <StackCoreProvider
@@ -101,7 +71,6 @@ export const StackView = memo(function StackView({
101
71
  state={state}
102
72
  navigation={navigation}
103
73
  descriptors={descriptors}
104
- describe={describe}
105
74
  >
106
75
  <StackViewContent />
107
76
  </BlankStackProvider>
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  DraggableCard,
3
3
  ElasticCard,
4
- SharedAppleMusic,
5
- SharedIGImage,
6
- SharedXImage,
7
4
  SlideFromBottom,
8
5
  SlideFromTop,
9
6
  ZoomIn,
@@ -23,7 +20,4 @@ export const Presets = {
23
20
  SlideFromBottom,
24
21
  DraggableCard,
25
22
  ElasticCard,
26
- SharedIGImage,
27
- SharedAppleMusic,
28
- SharedXImage,
29
23
  };
@@ -1,19 +1,11 @@
1
- import { Platform } from "react-native";
2
1
  import {
3
2
  Extrapolation,
4
3
  interpolate,
5
4
  interpolateColor,
6
5
  } from "react-native-reanimated";
7
- import {
8
- NAVIGATION_MASK_CONTAINER_STYLE_ID,
9
- NAVIGATION_MASK_ELEMENT_STYLE_ID,
10
- } from "../constants";
11
6
  import type { ScreenTransitionConfig } from "../types/screen.types";
12
- import { normalizeInterpolatedStyle } from "../utils/normalize-interpolated-style";
13
7
  import { DefaultSpec } from "./specs";
14
8
 
15
- const platform = Platform.OS;
16
-
17
9
  export const SlideFromTop = (
18
10
  config: Partial<ScreenTransitionConfig> = {},
19
11
  ): ScreenTransitionConfig => {
@@ -235,442 +227,3 @@ export const ElasticCard = (
235
227
  ...config,
236
228
  };
237
229
  };
238
-
239
- export const SharedIGImage = ({
240
- id,
241
- ...config
242
- }: Partial<ScreenTransitionConfig> & {
243
- id: string;
244
- }): ScreenTransitionConfig => {
245
- return {
246
- gestureEnabled: true,
247
- gestureDirection: ["vertical", "horizontal"],
248
- enableTransitions: true,
249
- screenStyleInterpolator: ({
250
- current,
251
- layouts: {
252
- screen: { height, width },
253
- },
254
- bounds,
255
- progress,
256
- focused,
257
- active,
258
- }) => {
259
- "worklet";
260
-
261
- const normX = active.gesture.handoff.normX;
262
- const normY = active.gesture.handoff.normY;
263
-
264
- const dragX = interpolate(
265
- normX,
266
- [-1, 0, 1],
267
- [-width * 0.7, 0, width * 0.7],
268
- "clamp",
269
- );
270
- const dragY = interpolate(
271
- normY,
272
- [-1, 0, 1],
273
- [-height * 0.4, 0, height * 0.4],
274
- "clamp",
275
- );
276
- const dragXScale = interpolate(normX, [0, 1], [1, 0.8]);
277
- const dragYScale = interpolate(normY, [0, 1], [1, 0.8]);
278
-
279
- const navigationStyles =
280
- bounds({
281
- id,
282
- }).navigation.zoom() ?? {};
283
-
284
- // Read the bound-specific slots before normalizing the full result.
285
- const sourceStyle = navigationStyles[id] as
286
- | Record<string, unknown>
287
- | undefined;
288
- const containerStyle = navigationStyles[
289
- NAVIGATION_MASK_CONTAINER_STYLE_ID
290
- ] as Record<string, unknown> | undefined;
291
- const maskStyle = navigationStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] as
292
- | Record<string, unknown>
293
- | undefined;
294
-
295
- const normalizedNav = normalizeInterpolatedStyle(
296
- navigationStyles as Record<string, any>,
297
- );
298
-
299
- if (focused) {
300
- return {
301
- ...normalizedNav,
302
- backdrop: {
303
- style: {
304
- backgroundColor: "black",
305
- opacity: interpolate(progress, [0, 1], [0, 0.5]),
306
- },
307
- },
308
- content: {
309
- style: {
310
- transform: [
311
- { translateX: dragX },
312
- { translateY: dragY },
313
- { scale: dragXScale },
314
- { scale: dragYScale },
315
- ],
316
- },
317
- },
318
- [NAVIGATION_MASK_CONTAINER_STYLE_ID]: containerStyle
319
- ? {
320
- style: {
321
- ...containerStyle,
322
- transform: [
323
- ...(((containerStyle.transform as any[]) ?? []) as any[]),
324
- { translateX: dragX * 0.2 },
325
- { translateY: dragY * 0.2 },
326
- ],
327
- },
328
- }
329
- : undefined,
330
- [NAVIGATION_MASK_ELEMENT_STYLE_ID]: maskStyle
331
- ? {
332
- style: {
333
- ...maskStyle,
334
- borderRadius: interpolate(progress, [0, 1], [0, 24]),
335
- },
336
- }
337
- : undefined,
338
- };
339
- }
340
-
341
- return {
342
- ...normalizedNav,
343
- content: {
344
- style: {
345
- ...(normalizedNav.content?.style ?? {}),
346
- pointerEvents: current.gesture.dismissing ? "none" : "auto",
347
- },
348
- },
349
- [id]: {
350
- style: {
351
- ...(sourceStyle ?? {}),
352
- transform: [
353
- { translateX: dragX || 0 },
354
- { translateY: dragY || 0 },
355
- ...(((sourceStyle?.transform as any[]) ?? []) as any[]),
356
- { scale: dragXScale },
357
- { scale: dragYScale },
358
- ],
359
- },
360
- },
361
- };
362
- },
363
- transitionSpec: {
364
- open: {
365
- stiffness: 1500,
366
- damping: 1000,
367
- mass: 3,
368
- overshootClamping: true,
369
- //@ts-expect-error
370
- restSpeedThreshold: 0.02,
371
- },
372
- close: {
373
- stiffness: 1500,
374
- damping: 1000,
375
- mass: 3,
376
- overshootClamping: true,
377
- //@ts-expect-error
378
- restSpeedThreshold: 0.02,
379
- },
380
- },
381
- ...config,
382
- };
383
- };
384
-
385
- export const SharedAppleMusic = ({
386
- id,
387
- ...config
388
- }: Partial<ScreenTransitionConfig> & {
389
- id: string;
390
- }): ScreenTransitionConfig => {
391
- return {
392
- enableTransitions: true,
393
- gestureEnabled: true,
394
- gestureDirection: ["vertical", "horizontal"],
395
- screenStyleInterpolator: ({
396
- bounds,
397
- focused,
398
- progress,
399
- layouts: { screen },
400
- current,
401
- active,
402
- }) => {
403
- "worklet";
404
-
405
- const normX = active.gesture.handoff.normX;
406
- const normY = active.gesture.handoff.normY;
407
- const initialGesture = active.gesture.handoff.active;
408
-
409
- /**
410
- * ===============================
411
- * Animations for both bounds
412
- * ===============================
413
- */
414
- const xResistance = initialGesture === "horizontal" ? 0.7 : 0.4;
415
- const yResistance = initialGesture === "vertical" ? 0.7 : 0.4;
416
-
417
- const xScaleOuput = initialGesture === "horizontal" ? [1, 0.5] : [1, 1];
418
- const yScaleOuput = initialGesture === "vertical" ? [1, 0.5] : [1, 1];
419
-
420
- const dragX = interpolate(
421
- normX,
422
- [-1, 0, 1],
423
- [-screen.width * xResistance, 0, screen.width * xResistance],
424
- "clamp",
425
- );
426
- const dragY = interpolate(
427
- normY,
428
- [-1, 0, 1],
429
- [-screen.height * yResistance, 0, screen.height * yResistance],
430
- "clamp",
431
- );
432
- const dragXScale = interpolate(normX, [0, 1], xScaleOuput);
433
- const dragYScale = interpolate(normY, [0, 1], yScaleOuput);
434
-
435
- const boundValues = bounds({ id }).values({
436
- method: focused ? "content" : "transform",
437
- anchor: "top",
438
- scaleMode: "uniform",
439
- });
440
-
441
- const opacity = interpolate(
442
- progress,
443
- [0, 0.25, 1.25, 2],
444
- [0, 1, 1, 0],
445
- "clamp",
446
- );
447
-
448
- /**
449
- * ===============================
450
- * Focused specific animations
451
- * ===============================
452
- */
453
- if (focused) {
454
- const maskedValues = bounds({ id }).values({
455
- space: "absolute",
456
- method: "size",
457
- target: "fullscreen",
458
- });
459
-
460
- // Apple Music style drop shadow that increases with drag magnitude
461
- const dragMagnitude = Math.max(Math.abs(normX), Math.abs(normY));
462
- const shadowOpacity = interpolate(
463
- dragMagnitude,
464
- [0, 1],
465
- [0, 0.25],
466
- "clamp",
467
- );
468
- const shadowRadius = interpolate(
469
- dragMagnitude,
470
- [0, 1],
471
- [0, 24],
472
- "clamp",
473
- );
474
- const shadowOffsetY = interpolate(
475
- dragMagnitude,
476
- [0, 1],
477
- [0, 20],
478
- "clamp",
479
- );
480
- const elevation = interpolate(dragMagnitude, [0, 1], [0, 24], "clamp");
481
-
482
- const IOSShadowStyle = {
483
- shadowColor: "#000",
484
- shadowOpacity,
485
- shadowRadius,
486
- shadowOffset: { width: 0, height: shadowOffsetY },
487
- };
488
-
489
- const AndroidShadowStyle = {
490
- elevation,
491
- shadowColor: "#000",
492
- };
493
-
494
- return {
495
- content: {
496
- style: {
497
- pointerEvents: current.animating ? "none" : "auto",
498
- transform: [
499
- { translateX: dragX || 0 },
500
- { translateY: dragY || 0 },
501
- { scale: dragXScale },
502
- { scale: dragYScale },
503
- ],
504
- opacity,
505
- ...(platform === "ios" ? IOSShadowStyle : AndroidShadowStyle),
506
- },
507
- },
508
- _ROOT_CONTAINER: {
509
- style: {
510
- transform: [
511
- { translateX: boundValues.translateX || 0 },
512
- { translateY: boundValues.translateY || 0 },
513
- //@ts-expect-error
514
- { scale: boundValues.scale || 1 },
515
- ],
516
- },
517
- },
518
- _ROOT_MASKED: {
519
- style: {
520
- width: maskedValues.width,
521
- height: maskedValues.height,
522
- transform: [
523
- { translateX: maskedValues.translateX || 0 },
524
- { translateY: maskedValues.translateY || 0 },
525
- ],
526
- borderRadius: interpolate(progress, [0, 1], [0, 24]),
527
- },
528
- },
529
- };
530
- }
531
-
532
- /**
533
- * ===============================
534
- * Unfocused specific animations
535
- * ===============================
536
- */
537
-
538
- const scaledBoundTranslateX = (boundValues.translateX || 0) * dragXScale;
539
- const scaledBoundTranslateY = (boundValues.translateY || 0) * dragYScale;
540
- const scaledBoundScaleX = (boundValues.scaleX || 1) * dragXScale;
541
- const scaledBoundScaleY = (boundValues.scaleY || 1) * dragYScale;
542
-
543
- const contentScale = interpolate(progress, [1, 2], [1, 0.9], "clamp");
544
-
545
- return {
546
- [id]: {
547
- style: {
548
- transform: [
549
- { translateX: dragX || 0 },
550
- { translateY: dragY || 0 },
551
- { translateX: scaledBoundTranslateX },
552
- { translateY: scaledBoundTranslateY },
553
- { scale: dragXScale },
554
- { scale: dragYScale },
555
- { scaleX: scaledBoundScaleX },
556
- { scaleY: scaledBoundScaleY },
557
- ],
558
- opacity,
559
- zIndex: current.animating ? 999 : -1,
560
- position: "relative",
561
- },
562
- },
563
- content: {
564
- style: {
565
- transform: [{ scale: contentScale }],
566
- },
567
- },
568
- };
569
- },
570
- transitionSpec: {
571
- open: {
572
- stiffness: 1000,
573
- damping: 500,
574
- mass: 3,
575
- overshootClamping: true,
576
- //@ts-expect-error - Should not lead to any issues
577
- restSpeedThreshold: 0.02,
578
- },
579
- close: {
580
- stiffness: 600,
581
- damping: 60,
582
- mass: 4,
583
- overshootClamping: false,
584
- //@ts-expect-error - Should not lead to any issues
585
- restSpeedThreshold: 0.02,
586
- restDisplacementThreshold: 0.002,
587
- },
588
- },
589
- ...config,
590
- };
591
- };
592
-
593
- export const SharedXImage = ({
594
- id,
595
- ...config
596
- }: Partial<ScreenTransitionConfig> & {
597
- id: string;
598
- }): ScreenTransitionConfig => {
599
- return {
600
- //@ts-expect-error - Should not lead to any issues
601
- enableTransitions: true,
602
- gestureEnabled: true,
603
- gestureDirection: ["vertical", "vertical-inverted"],
604
- screenStyleInterpolator: ({
605
- focused,
606
- bounds,
607
- current,
608
- layouts: { screen },
609
- progress,
610
- }) => {
611
- "worklet";
612
-
613
- if (!focused) return {};
614
-
615
- const navigationStyles =
616
- bounds({
617
- id,
618
- }).navigation.zoom() ?? {};
619
- const maskStyle = navigationStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] as
620
- | Record<string, unknown>
621
- | undefined;
622
-
623
- const normalizedNav = normalizeInterpolatedStyle(
624
- navigationStyles as Record<string, any>,
625
- );
626
-
627
- const dragY = interpolate(
628
- current.gesture.normY,
629
- [-1, 0, 1],
630
- [-screen.height, 0, screen.height],
631
- );
632
-
633
- const contentY = interpolate(
634
- progress,
635
- [0, 1],
636
- [dragY >= 0 ? screen.height : -screen.height, 0],
637
- );
638
-
639
- const overlayClr = interpolateColor(
640
- current.progress - Math.abs(current.gesture.normY),
641
- [0, 1],
642
- ["rgba(0,0,0,0)", "rgba(0,0,0,1)"],
643
- );
644
-
645
- const borderRadius = interpolate(current.progress, [0, 1], [12, 0]);
646
-
647
- return {
648
- ...normalizedNav,
649
- [NAVIGATION_MASK_ELEMENT_STYLE_ID]: maskStyle
650
- ? {
651
- style: {
652
- ...maskStyle,
653
- borderRadius,
654
- },
655
- }
656
- : undefined,
657
- content: {
658
- style: {
659
- transform: [{ translateY: contentY }, { translateY: dragY }],
660
- pointerEvents: current.animating ? "none" : "auto",
661
- },
662
- },
663
- backdrop: {
664
- style: {
665
- backgroundColor: overlayClr,
666
- },
667
- },
668
- };
669
- },
670
- transitionSpec: {
671
- open: DefaultSpec,
672
- close: DefaultSpec,
673
- },
674
- ...config,
675
- };
676
- };
package/src/index.ts CHANGED
@@ -50,7 +50,7 @@ export {
50
50
  export type {
51
51
  AnimatedViewStyle,
52
52
  AnimationConfig,
53
- BoundaryTeleportControl,
53
+ BoundaryHandoffTarget,
54
54
  BoundsMotion,
55
55
  BoundsMotionFrame,
56
56
  BoundsMotionTransform,
@@ -73,6 +73,8 @@ export type {
73
73
  ScreenInterpolationProps,
74
74
  ScreenLayerComponentProps,
75
75
  ScreenStyleInterpolator,
76
+ ScreenSurfaceComponent,
77
+ ScreenSurfaceComponentProps,
76
78
  ScreenTransitionAccessor,
77
79
  ScreenTransitionConfig,
78
80
  ScreenTransitionDepthTarget,