react-native-screen-transitions 3.2.1 → 3.3.0-beta.1
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.
- package/README.md +105 -10
- package/lib/commonjs/blank-stack/components/adjusted-screen.js +2 -2
- package/lib/commonjs/blank-stack/components/adjusted-screen.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -2
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/{root-transition-aware.js → screen-container.js} +28 -12
- package/lib/commonjs/shared/components/screen-container.js.map +1 -0
- package/lib/commonjs/shared/configs/presets.js +3 -3
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/configs/specs.js +6 -1
- package/lib/commonjs/shared/configs/specs.js.map +1 -1
- package/lib/commonjs/shared/constants.js +36 -10
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js +25 -18
- package/lib/commonjs/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js +25 -202
- package/lib/commonjs/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js +342 -0
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -0
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js +47 -4
- package/lib/commonjs/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/commonjs/shared/hooks/lifecycle/use-close-transition.js +3 -3
- package/lib/commonjs/shared/hooks/lifecycle/use-close-transition.js.map +1 -1
- package/lib/commonjs/shared/hooks/lifecycle/use-open-transition.js +25 -3
- package/lib/commonjs/shared/hooks/lifecycle/use-open-transition.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js +33 -2
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js.map +1 -1
- package/lib/commonjs/shared/hooks/use-backdrop-pointer-events.js +32 -0
- package/lib/commonjs/shared/hooks/use-backdrop-pointer-events.js.map +1 -0
- package/lib/commonjs/shared/providers/gestures.provider.js +4 -2
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/screen-composer.js +2 -2
- package/lib/commonjs/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/{start-screen-transition.js → animate-to-progress.js} +16 -8
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js +138 -0
- package/lib/commonjs/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js +56 -0
- package/lib/commonjs/shared/utils/gesture/determine-snap-target.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js +31 -0
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/velocity.js +11 -0
- package/lib/commonjs/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/commonjs/shared/utils/logger.js +22 -0
- package/lib/commonjs/shared/utils/logger.js.map +1 -0
- package/lib/module/blank-stack/components/adjusted-screen.js +1 -1
- package/lib/module/blank-stack/components/adjusted-screen.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +8 -2
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/screen-container.js +64 -0
- package/lib/module/shared/components/screen-container.js.map +1 -0
- package/lib/module/shared/configs/presets.js +3 -3
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/configs/specs.js +5 -0
- package/lib/module/shared/configs/specs.js.map +1 -1
- package/lib/module/shared/constants.js +34 -9
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-screen-animation.js +25 -18
- package/lib/module/shared/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-build-gestures.js +25 -201
- package/lib/module/shared/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js +336 -0
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -0
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js +47 -4
- package/lib/module/shared/hooks/gestures/use-scroll-registry.js.map +1 -1
- package/lib/module/shared/hooks/lifecycle/use-close-transition.js +3 -3
- package/lib/module/shared/hooks/lifecycle/use-close-transition.js.map +1 -1
- package/lib/module/shared/hooks/lifecycle/use-open-transition.js +25 -3
- package/lib/module/shared/hooks/lifecycle/use-open-transition.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-screen-state.js +35 -4
- package/lib/module/shared/hooks/navigation/use-screen-state.js.map +1 -1
- package/lib/module/shared/hooks/use-backdrop-pointer-events.js +28 -0
- package/lib/module/shared/hooks/use-backdrop-pointer-events.js.map +1 -0
- package/lib/module/shared/providers/gestures.provider.js +4 -2
- package/lib/module/shared/providers/gestures.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/screen-composer.js +2 -2
- package/lib/module/shared/providers/screen/screen-composer.js.map +1 -1
- package/lib/module/shared/utils/animation/{start-screen-transition.js → animate-to-progress.js} +14 -6
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -0
- package/lib/module/shared/utils/gesture/check-gesture-activation.js +137 -0
- package/lib/module/shared/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/shared/utils/gesture/determine-snap-target.js +52 -0
- package/lib/module/shared/utils/gesture/determine-snap-target.js.map +1 -0
- package/lib/module/shared/utils/gesture/validate-snap-points.js +26 -0
- package/lib/module/shared/utils/gesture/validate-snap-points.js.map +1 -0
- package/lib/module/shared/utils/gesture/velocity.js +11 -0
- package/lib/module/shared/utils/gesture/velocity.js.map +1 -1
- package/lib/module/shared/utils/logger.js +17 -0
- package/lib/module/shared/utils/logger.js.map +1 -0
- package/lib/typescript/blank-stack/components/adjusted-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container.d.ts +6 -0
- package/lib/typescript/shared/components/screen-container.d.ts.map +1 -0
- package/lib/typescript/shared/configs/specs.d.ts +1 -0
- package/lib/typescript/shared/configs/specs.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +9 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts +1 -1
- package/lib/typescript/shared/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts +19 -0
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts +5 -1
- package/lib/typescript/shared/hooks/gestures/use-scroll-registry.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/lifecycle/use-open-transition.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts +7 -0
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts +15 -0
- package/lib/typescript/shared/hooks/use-backdrop-pointer-events.d.ts.map +1 -0
- package/lib/typescript/shared/providers/gestures.provider.d.ts +1 -0
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +37 -2
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +26 -0
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +19 -0
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts +23 -0
- package/lib/typescript/shared/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts +26 -0
- package/lib/typescript/shared/utils/gesture/determine-snap-target.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts +13 -0
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/velocity.d.ts +1 -0
- package/lib/typescript/shared/utils/gesture/velocity.d.ts.map +1 -1
- package/lib/typescript/shared/utils/logger.d.ts +6 -0
- package/lib/typescript/shared/utils/logger.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/blank-stack/components/adjusted-screen.tsx +1 -1
- package/src/shared/__tests__/derivations.test.ts +1 -0
- package/src/shared/__tests__/determine-snap-target.test.ts +268 -0
- package/src/shared/__tests__/gesture-activation.test.ts +220 -0
- package/src/shared/__tests__/validate-snap-points.test.ts +125 -0
- package/src/shared/components/create-transition-aware-component.tsx +11 -1
- package/src/shared/components/screen-container.tsx +65 -0
- package/src/shared/configs/presets.ts +3 -3
- package/src/shared/configs/specs.ts +6 -0
- package/src/shared/constants.ts +36 -9
- package/src/shared/hooks/animation/use-screen-animation.tsx +32 -21
- package/src/shared/hooks/gestures/use-build-gestures.tsx +23 -275
- package/src/shared/hooks/gestures/use-screen-gesture-handlers.ts +434 -0
- package/src/shared/hooks/gestures/use-scroll-registry.tsx +52 -1
- package/src/shared/hooks/lifecycle/use-close-transition.ts +3 -3
- package/src/shared/hooks/lifecycle/use-open-transition.ts +27 -3
- package/src/shared/hooks/navigation/use-screen-state.tsx +59 -2
- package/src/shared/hooks/use-backdrop-pointer-events.ts +32 -0
- package/src/shared/providers/gestures.provider.tsx +3 -2
- package/src/shared/providers/screen/screen-composer.tsx +2 -2
- package/src/shared/types/animation.types.ts +39 -2
- package/src/shared/types/screen.types.ts +29 -0
- package/src/shared/utils/animation/{start-screen-transition.ts → animate-to-progress.ts} +23 -8
- package/src/shared/utils/gesture/check-gesture-activation.ts +129 -0
- package/src/shared/utils/gesture/determine-snap-target.ts +75 -0
- package/src/shared/utils/gesture/validate-snap-points.ts +37 -0
- package/src/shared/utils/gesture/velocity.ts +10 -0
- package/src/shared/utils/logger.ts +15 -0
- package/lib/commonjs/shared/components/root-transition-aware.js.map +0 -1
- package/lib/commonjs/shared/hooks/use-stack-pointer-events.js +0 -23
- package/lib/commonjs/shared/hooks/use-stack-pointer-events.js.map +0 -1
- package/lib/commonjs/shared/utils/animation/start-screen-transition.js.map +0 -1
- package/lib/module/shared/components/root-transition-aware.js +0 -48
- package/lib/module/shared/components/root-transition-aware.js.map +0 -1
- package/lib/module/shared/hooks/use-stack-pointer-events.js +0 -20
- package/lib/module/shared/hooks/use-stack-pointer-events.js.map +0 -1
- package/lib/module/shared/utils/animation/start-screen-transition.js.map +0 -1
- package/lib/typescript/shared/components/root-transition-aware.d.ts +0 -6
- package/lib/typescript/shared/components/root-transition-aware.d.ts.map +0 -1
- package/lib/typescript/shared/hooks/use-stack-pointer-events.d.ts +0 -10
- package/lib/typescript/shared/hooks/use-stack-pointer-events.d.ts.map +0 -1
- package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts +0 -13
- package/lib/typescript/shared/utils/animation/start-screen-transition.d.ts.map +0 -1
- package/src/shared/components/root-transition-aware.tsx +0 -49
- package/src/shared/hooks/use-stack-pointer-events.ts +0 -15
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useKeys } from "../providers/screen/keys.provider";
|
|
2
|
+
import { useStackCoreContext } from "../providers/stack/core.provider";
|
|
3
|
+
import { StackType } from "../types/stack.types";
|
|
4
|
+
|
|
5
|
+
type BackdropBehavior = "block" | "passthrough" | "dismiss";
|
|
6
|
+
|
|
7
|
+
interface BackdropPointerEventsResult {
|
|
8
|
+
pointerEvents: "box-none" | undefined;
|
|
9
|
+
backdropBehavior: BackdropBehavior;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns pointer events and backdrop behavior based on screen options.
|
|
14
|
+
*
|
|
15
|
+
* - Explicit `backdropBehavior` option takes precedence
|
|
16
|
+
* - Component stacks default to 'passthrough' (box-none)
|
|
17
|
+
* - Other stacks default to 'block' (undefined = normal touch handling)
|
|
18
|
+
*/
|
|
19
|
+
export function useBackdropPointerEvents(): BackdropPointerEventsResult {
|
|
20
|
+
const { current } = useKeys();
|
|
21
|
+
const { flags } = useStackCoreContext();
|
|
22
|
+
|
|
23
|
+
const isComponentStack = flags.STACK_TYPE === StackType.COMPONENT;
|
|
24
|
+
const backdropBehavior: BackdropBehavior =
|
|
25
|
+
current.options.backdropBehavior ??
|
|
26
|
+
(isComponentStack ? "passthrough" : "block");
|
|
27
|
+
|
|
28
|
+
const pointerEvents =
|
|
29
|
+
backdropBehavior === "passthrough" ? "box-none" : undefined;
|
|
30
|
+
|
|
31
|
+
return { pointerEvents, backdropBehavior };
|
|
32
|
+
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import type { SharedValue } from "react-native-reanimated";
|
|
7
7
|
import { useSharedValue } from "react-native-reanimated";
|
|
8
8
|
import { useBuildGestures } from "../hooks/gestures/use-build-gestures";
|
|
9
|
-
import {
|
|
9
|
+
import { useBackdropPointerEvents } from "../hooks/use-backdrop-pointer-events";
|
|
10
10
|
import type { GestureStoreMap } from "../stores/gesture.store";
|
|
11
11
|
import createProvider from "../utils/create-provider";
|
|
12
12
|
import { useKeys } from "./screen/keys.provider";
|
|
@@ -18,6 +18,7 @@ export type ScrollConfig = {
|
|
|
18
18
|
contentWidth: number;
|
|
19
19
|
layoutHeight: number;
|
|
20
20
|
layoutWidth: number;
|
|
21
|
+
isTouched: boolean;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export interface GestureContextType {
|
|
@@ -42,9 +43,9 @@ export const {
|
|
|
42
43
|
GestureContextType
|
|
43
44
|
>(({ children }) => {
|
|
44
45
|
const { current } = useKeys();
|
|
45
|
-
const pointerEvents = useStackPointerEvents();
|
|
46
46
|
const ancestorContext = useGestureContext();
|
|
47
47
|
const scrollConfig = useSharedValue<ScrollConfig | null>(null);
|
|
48
|
+
const { pointerEvents } = useBackdropPointerEvents();
|
|
48
49
|
|
|
49
50
|
const hasGestures = current.options.gestureEnabled === true;
|
|
50
51
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ScreenContainer } from "../../components/screen-container";
|
|
3
3
|
import { ScreenLifecycle } from "../../components/screen-lifecycle";
|
|
4
4
|
import { ScreenGestureProvider } from "../gestures.provider";
|
|
5
5
|
import { type BaseDescriptor, KeysProvider } from "./keys.provider";
|
|
@@ -23,7 +23,7 @@ export function ScreenComposer<TDescriptor extends BaseDescriptor>({
|
|
|
23
23
|
<KeysProvider previous={previous} current={current} next={next}>
|
|
24
24
|
<ScreenGestureProvider>
|
|
25
25
|
<ScreenStylesProvider>
|
|
26
|
-
<
|
|
26
|
+
<ScreenContainer>{children}</ScreenContainer>
|
|
27
27
|
</ScreenStylesProvider>
|
|
28
28
|
</ScreenGestureProvider>
|
|
29
29
|
</KeysProvider>
|
|
@@ -142,6 +142,16 @@ export interface ScreenInterpolationProps {
|
|
|
142
142
|
*/
|
|
143
143
|
stackProgress: number;
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Animated index of the current snap point.
|
|
147
|
+
* Interpolates between indices during gestures/animations.
|
|
148
|
+
* - Returns -1 if no snap points are defined
|
|
149
|
+
* - Returns 0 when at or below first snap point
|
|
150
|
+
* - Returns fractional values between snap points (e.g., 1.5 = halfway between snap 1 and 2)
|
|
151
|
+
* - Returns length-1 when at or above last snap point
|
|
152
|
+
*/
|
|
153
|
+
snapIndex: number;
|
|
154
|
+
|
|
145
155
|
/**
|
|
146
156
|
* Function that provides access to bounds builders for creating shared element transitions.
|
|
147
157
|
*/
|
|
@@ -182,7 +192,18 @@ export type TransitionInterpolatedStyle = {
|
|
|
182
192
|
contentStyle?: StyleProps;
|
|
183
193
|
|
|
184
194
|
/**
|
|
185
|
-
* Animated style for
|
|
195
|
+
* Animated style for the semi-transparent backdrop layer behind screen content.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* backdropStyle: {
|
|
199
|
+
* backgroundColor: "black",
|
|
200
|
+
* opacity: interpolate(progress, [0, 1], [0, 0.5]),
|
|
201
|
+
* }
|
|
202
|
+
*/
|
|
203
|
+
backdropStyle?: StyleProps;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @deprecated Use `backdropStyle` instead. Will be removed in next major version.
|
|
186
207
|
*/
|
|
187
208
|
overlayStyle?: StyleProps;
|
|
188
209
|
|
|
@@ -198,9 +219,25 @@ export type TransitionInterpolatedStyle = {
|
|
|
198
219
|
export type AnimationConfig = WithSpringConfig | WithTimingConfig;
|
|
199
220
|
|
|
200
221
|
/**
|
|
201
|
-
* Defines separate animation configurations for
|
|
222
|
+
* Defines separate animation configurations for screen transitions and snap point changes.
|
|
202
223
|
*/
|
|
203
224
|
export interface TransitionSpec {
|
|
225
|
+
/**
|
|
226
|
+
* Animation config for opening/entering a screen.
|
|
227
|
+
*/
|
|
204
228
|
open?: AnimationConfig;
|
|
229
|
+
/**
|
|
230
|
+
* Animation config for closing/exiting a screen.
|
|
231
|
+
*/
|
|
205
232
|
close?: AnimationConfig;
|
|
233
|
+
/**
|
|
234
|
+
* Animation config for expanding to a higher snap point.
|
|
235
|
+
* Uses lower intensity than `open` to match smaller movement distances.
|
|
236
|
+
*/
|
|
237
|
+
expand?: AnimationConfig;
|
|
238
|
+
/**
|
|
239
|
+
* Animation config for collapsing to a lower snap point.
|
|
240
|
+
* Uses lower intensity than `close` to match smaller movement distances.
|
|
241
|
+
*/
|
|
242
|
+
collapse?: AnimationConfig;
|
|
206
243
|
}
|
|
@@ -136,4 +136,33 @@ export type ScreenTransitionConfig = {
|
|
|
136
136
|
* @default false
|
|
137
137
|
*/
|
|
138
138
|
experimental_enableHighRefreshRate?: boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Describes heights where a screen can rest, as fractions of screen height.
|
|
142
|
+
* Pass an array of ascending values from 0 to 1.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* snapPoints={[0.5, 1.0]} // 50% and 100% of screen height
|
|
146
|
+
*
|
|
147
|
+
* @default [1.0]
|
|
148
|
+
*/
|
|
149
|
+
snapPoints?: number[];
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The initial snap point index when the screen opens.
|
|
153
|
+
*
|
|
154
|
+
* @default 0
|
|
155
|
+
*/
|
|
156
|
+
initialSnapIndex?: number;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Controls how touches interact with the backdrop area (outside the screen content).
|
|
160
|
+
*
|
|
161
|
+
* - `'block'`: Backdrop catches all touches (default for most screens)
|
|
162
|
+
* - `'passthrough'`: Touches pass through to content behind (default for component stacks)
|
|
163
|
+
* - `'dismiss'`: Tapping backdrop dismisses the screen
|
|
164
|
+
*
|
|
165
|
+
* @default 'block' (or 'passthrough' for component stacks)
|
|
166
|
+
*/
|
|
167
|
+
backdropBehavior?: "block" | "passthrough" | "dismiss";
|
|
139
168
|
};
|
|
@@ -4,8 +4,14 @@ import type { AnimationStoreMap } from "../../stores/animation.store";
|
|
|
4
4
|
import type { TransitionSpec } from "../../types/animation.types";
|
|
5
5
|
import { animate } from "./animate";
|
|
6
6
|
|
|
7
|
-
interface
|
|
8
|
-
|
|
7
|
+
interface AnimateToProgressProps {
|
|
8
|
+
/**
|
|
9
|
+
* Target for the animation:
|
|
10
|
+
* - "open" = animate to progress 1
|
|
11
|
+
* - "close" = animate to progress 0
|
|
12
|
+
* - number = animate to specific progress value (e.g., 0.5 for snap point)
|
|
13
|
+
*/
|
|
14
|
+
target: "open" | "close" | number;
|
|
9
15
|
spec?: TransitionSpec;
|
|
10
16
|
onAnimationFinish?: (finished: boolean) => void;
|
|
11
17
|
animations: AnimationStoreMap;
|
|
@@ -13,16 +19,22 @@ interface StartScreenTransitionProps {
|
|
|
13
19
|
initialVelocity?: number;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
export const
|
|
22
|
+
export const animateToProgress = ({
|
|
17
23
|
target,
|
|
18
24
|
spec,
|
|
19
25
|
onAnimationFinish,
|
|
20
26
|
animations,
|
|
21
27
|
initialVelocity,
|
|
22
|
-
}:
|
|
28
|
+
}: AnimateToProgressProps) => {
|
|
23
29
|
"worklet";
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
|
|
31
|
+
// Determine target value and direction
|
|
32
|
+
const isClosing =
|
|
33
|
+
target === "close" || (typeof target === "number" && target === 0);
|
|
34
|
+
const value = typeof target === "number" ? target : target === "open" ? 1 : 0;
|
|
35
|
+
|
|
36
|
+
// Select spec based on direction (closing uses close spec, otherwise open)
|
|
37
|
+
const config = isClosing ? spec?.close : spec?.open;
|
|
26
38
|
|
|
27
39
|
const isSpringConfig =
|
|
28
40
|
!!config && !("duration" in config) && !("easing" in config);
|
|
@@ -34,7 +46,7 @@ export const startScreenTransition = ({
|
|
|
34
46
|
|
|
35
47
|
const { progress, animating, closing, entering } = animations;
|
|
36
48
|
|
|
37
|
-
if (
|
|
49
|
+
if (isClosing) {
|
|
38
50
|
closing.set(TRUE);
|
|
39
51
|
entering.set(FALSE);
|
|
40
52
|
} else {
|
|
@@ -61,7 +73,10 @@ export const startScreenTransition = ({
|
|
|
61
73
|
runOnJS(onAnimationFinish)(finished);
|
|
62
74
|
}
|
|
63
75
|
|
|
64
|
-
animating
|
|
76
|
+
// Delay setting animating=FALSE by one frame to ensure final frame is painted
|
|
77
|
+
requestAnimationFrame(() => {
|
|
78
|
+
animating.set(FALSE);
|
|
79
|
+
});
|
|
65
80
|
}),
|
|
66
81
|
);
|
|
67
82
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
|
|
2
2
|
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { ScrollConfig } from "../../providers/gestures.provider";
|
|
3
4
|
import {
|
|
4
5
|
type ActivationArea,
|
|
5
6
|
type GestureActivationArea,
|
|
@@ -13,6 +14,7 @@ type Directions = {
|
|
|
13
14
|
verticalInverted: boolean;
|
|
14
15
|
horizontal: boolean;
|
|
15
16
|
horizontalInverted: boolean;
|
|
17
|
+
snapAxisInverted?: boolean;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
interface CheckGestureActivationProps {
|
|
@@ -308,3 +310,130 @@ export const applyOffsetRules = ({
|
|
|
308
310
|
isSwipingLeft,
|
|
309
311
|
};
|
|
310
312
|
};
|
|
313
|
+
|
|
314
|
+
interface ScrollAwareActivationParams {
|
|
315
|
+
swipeInfo: {
|
|
316
|
+
isSwipingDown: boolean;
|
|
317
|
+
isSwipingUp: boolean;
|
|
318
|
+
isSwipingRight: boolean;
|
|
319
|
+
isSwipingLeft: boolean;
|
|
320
|
+
};
|
|
321
|
+
directions: Directions;
|
|
322
|
+
scrollConfig: ScrollConfig | null;
|
|
323
|
+
hasSnapPoints?: boolean;
|
|
324
|
+
canExpandMore?: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
type GestureDirection =
|
|
328
|
+
| "vertical"
|
|
329
|
+
| "vertical-inverted"
|
|
330
|
+
| "horizontal"
|
|
331
|
+
| "horizontal-inverted";
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Checks if a gesture should activate based on scroll position.
|
|
335
|
+
* Returns the direction to activate for, or null if activation should not occur.
|
|
336
|
+
*/
|
|
337
|
+
export function checkScrollAwareActivation({
|
|
338
|
+
swipeInfo,
|
|
339
|
+
directions,
|
|
340
|
+
scrollConfig,
|
|
341
|
+
hasSnapPoints,
|
|
342
|
+
canExpandMore,
|
|
343
|
+
}: ScrollAwareActivationParams): {
|
|
344
|
+
shouldActivate: boolean;
|
|
345
|
+
direction: GestureDirection | null;
|
|
346
|
+
} {
|
|
347
|
+
"worklet";
|
|
348
|
+
|
|
349
|
+
const { isSwipingDown, isSwipingUp, isSwipingRight, isSwipingLeft } =
|
|
350
|
+
swipeInfo;
|
|
351
|
+
|
|
352
|
+
// Extract scroll values from config
|
|
353
|
+
const scrollX = scrollConfig?.x ?? 0;
|
|
354
|
+
const scrollY = scrollConfig?.y ?? 0;
|
|
355
|
+
const maxScrollX = scrollConfig
|
|
356
|
+
? scrollConfig.contentWidth - scrollConfig.layoutWidth
|
|
357
|
+
: 0;
|
|
358
|
+
const maxScrollY = scrollConfig
|
|
359
|
+
? scrollConfig.contentHeight - scrollConfig.layoutHeight
|
|
360
|
+
: 0;
|
|
361
|
+
const snapAxisInverted = directions.snapAxisInverted;
|
|
362
|
+
|
|
363
|
+
// With snap points, gestures should only activate based on the PRIMARY scroll edge
|
|
364
|
+
// (the edge where the sheet originates from), not the opposite edge.
|
|
365
|
+
// This prevents the auto-enabled opposite direction from hijacking scrolls.
|
|
366
|
+
if (hasSnapPoints) {
|
|
367
|
+
const isVerticalAxis = directions.vertical || directions.verticalInverted;
|
|
368
|
+
const isHorizontalAxis =
|
|
369
|
+
directions.horizontal || directions.horizontalInverted;
|
|
370
|
+
|
|
371
|
+
if (isVerticalAxis) {
|
|
372
|
+
if (snapAxisInverted) {
|
|
373
|
+
// Sheet from TOP (vertical-inverted): only activate at scroll BOTTOM
|
|
374
|
+
if (scrollY >= maxScrollY) {
|
|
375
|
+
if (isSwipingUp) {
|
|
376
|
+
return { shouldActivate: true, direction: "vertical-inverted" };
|
|
377
|
+
}
|
|
378
|
+
if (isSwipingDown && canExpandMore) {
|
|
379
|
+
return { shouldActivate: true, direction: "vertical" };
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
// Sheet from BOTTOM (vertical): only activate at scroll TOP
|
|
384
|
+
if (scrollY <= 0) {
|
|
385
|
+
if (isSwipingDown) {
|
|
386
|
+
return { shouldActivate: true, direction: "vertical" };
|
|
387
|
+
}
|
|
388
|
+
if (isSwipingUp && canExpandMore) {
|
|
389
|
+
return { shouldActivate: true, direction: "vertical-inverted" };
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (isHorizontalAxis) {
|
|
396
|
+
if (snapAxisInverted) {
|
|
397
|
+
// Sheet from LEFT (horizontal-inverted): only activate at scroll RIGHT
|
|
398
|
+
if (scrollX >= maxScrollX) {
|
|
399
|
+
if (isSwipingLeft) {
|
|
400
|
+
return { shouldActivate: true, direction: "horizontal-inverted" };
|
|
401
|
+
}
|
|
402
|
+
if (isSwipingRight && canExpandMore) {
|
|
403
|
+
return { shouldActivate: true, direction: "horizontal" };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
// Sheet from RIGHT (horizontal): only activate at scroll LEFT
|
|
408
|
+
if (scrollX <= 0) {
|
|
409
|
+
if (isSwipingRight) {
|
|
410
|
+
return { shouldActivate: true, direction: "horizontal" };
|
|
411
|
+
}
|
|
412
|
+
if (isSwipingLeft && canExpandMore) {
|
|
413
|
+
return { shouldActivate: true, direction: "horizontal-inverted" };
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return { shouldActivate: false, direction: null };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (directions.vertical && isSwipingDown && scrollY <= 0) {
|
|
423
|
+
return { shouldActivate: true, direction: "vertical" };
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (directions.horizontal && isSwipingRight && scrollX <= 0) {
|
|
427
|
+
return { shouldActivate: true, direction: "horizontal" };
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (directions.verticalInverted && isSwipingUp && scrollY >= maxScrollY) {
|
|
431
|
+
return { shouldActivate: true, direction: "vertical-inverted" };
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (directions.horizontalInverted && isSwipingLeft && scrollX >= maxScrollX) {
|
|
435
|
+
return { shouldActivate: true, direction: "horizontal-inverted" };
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return { shouldActivate: false, direction: null };
|
|
439
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
interface DetermineSnapTargetProps {
|
|
2
|
+
currentProgress: number;
|
|
3
|
+
snapPoints: number[];
|
|
4
|
+
/** Velocity along the snap axis (positive = toward dismiss) */
|
|
5
|
+
velocity: number;
|
|
6
|
+
/** Screen dimension along the snap axis (width or height) */
|
|
7
|
+
dimension: number;
|
|
8
|
+
/** How much velocity affects the snap decision (0-1). Default 0.15 */
|
|
9
|
+
velocityFactor?: number;
|
|
10
|
+
/** Whether dismiss (progress=0) is allowed. Default true */
|
|
11
|
+
canDismiss?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface DetermineSnapTargetResult {
|
|
15
|
+
targetProgress: number;
|
|
16
|
+
shouldDismiss: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Determines which snap point to animate to based on current progress and velocity.
|
|
21
|
+
*
|
|
22
|
+
* Logic: Snap to whichever point is closest, factoring in velocity.
|
|
23
|
+
* The "zones" between snap points are split at midpoints.
|
|
24
|
+
* Velocity can push you into the next zone.
|
|
25
|
+
*/
|
|
26
|
+
export function determineSnapTarget({
|
|
27
|
+
currentProgress,
|
|
28
|
+
snapPoints,
|
|
29
|
+
velocity,
|
|
30
|
+
dimension,
|
|
31
|
+
velocityFactor = 0.15,
|
|
32
|
+
canDismiss = true,
|
|
33
|
+
}: DetermineSnapTargetProps): DetermineSnapTargetResult {
|
|
34
|
+
"worklet";
|
|
35
|
+
|
|
36
|
+
// Convert velocity to progress units (positive = toward dismiss = decreasing progress)
|
|
37
|
+
const velocityInProgress = (velocity / dimension) * velocityFactor;
|
|
38
|
+
|
|
39
|
+
// Project where we'd end up with velocity
|
|
40
|
+
const projectedProgress = currentProgress - velocityInProgress;
|
|
41
|
+
|
|
42
|
+
// Build all possible targets: dismiss (0) only if allowed, plus all snap points
|
|
43
|
+
const allTargets = canDismiss
|
|
44
|
+
? [0, ...snapPoints].sort((a, b) => a - b)
|
|
45
|
+
: [...snapPoints].sort((a, b) => a - b);
|
|
46
|
+
|
|
47
|
+
// Find the target whose zone contains the projected progress
|
|
48
|
+
// Zones are split at midpoints between adjacent targets
|
|
49
|
+
let targetProgress = allTargets[0];
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < allTargets.length; i++) {
|
|
52
|
+
const current = allTargets[i];
|
|
53
|
+
const next = allTargets[i + 1];
|
|
54
|
+
|
|
55
|
+
if (next === undefined) {
|
|
56
|
+
// Last target - if we're above the midpoint to here, snap to it
|
|
57
|
+
targetProgress = current;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const midpoint = (current + next) / 2;
|
|
62
|
+
|
|
63
|
+
if (projectedProgress < midpoint) {
|
|
64
|
+
targetProgress = current;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
targetProgress = next;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
targetProgress,
|
|
73
|
+
shouldDismiss: targetProgress === 0,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface ValidateSnapPointsResult {
|
|
2
|
+
hasSnapPoints: boolean;
|
|
3
|
+
snapPoints: number[];
|
|
4
|
+
minSnapPoint: number;
|
|
5
|
+
maxSnapPoint: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface ValidateSnapPointsOptions {
|
|
9
|
+
snapPoints?: number[];
|
|
10
|
+
canDismiss?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const validateSnapPoints = ({
|
|
14
|
+
snapPoints,
|
|
15
|
+
canDismiss,
|
|
16
|
+
}: ValidateSnapPointsOptions): ValidateSnapPointsResult => {
|
|
17
|
+
if (!snapPoints) {
|
|
18
|
+
return {
|
|
19
|
+
hasSnapPoints: false,
|
|
20
|
+
snapPoints: [],
|
|
21
|
+
minSnapPoint: -1,
|
|
22
|
+
maxSnapPoint: -1,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const sortedSnaps = snapPoints.slice().sort((a, b) => a - b);
|
|
27
|
+
// Clamp to snap point bounds (dismiss at 0 only if allowed)
|
|
28
|
+
const minProgress = canDismiss ? 0 : sortedSnaps[0];
|
|
29
|
+
const maxProgress = sortedSnaps[sortedSnaps.length - 1];
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
hasSnapPoints: true,
|
|
33
|
+
snapPoints: sortedSnaps,
|
|
34
|
+
minSnapPoint: minProgress,
|
|
35
|
+
maxSnapPoint: maxProgress,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -34,6 +34,15 @@ const normalize = (velocityPixelsPerSecond: number, screenSize: number) => {
|
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Normalizes translation to -1...1 range (for gesture tracking).
|
|
39
|
+
* Used to convert pixel translation to normalized gesture values.
|
|
40
|
+
*/
|
|
41
|
+
const normalizeTranslation = (translation: number, dimension: number) => {
|
|
42
|
+
"worklet";
|
|
43
|
+
return clamp(translation / Math.max(1, dimension), -1, 1);
|
|
44
|
+
};
|
|
45
|
+
|
|
37
46
|
/**
|
|
38
47
|
* Calculates a normalized velocity that moves the current value toward zero.
|
|
39
48
|
* Used for spring-back animations when dismissing gestures.
|
|
@@ -137,6 +146,7 @@ const shouldPassDismissalThreshold = (
|
|
|
137
146
|
|
|
138
147
|
export const velocity = {
|
|
139
148
|
normalize,
|
|
149
|
+
normalizeTranslation,
|
|
140
150
|
calculateRestoreVelocity,
|
|
141
151
|
calculateProgressVelocity,
|
|
142
152
|
shouldPassDismissalThreshold,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const LIBRARY_NAME = "react-native-screen-transitions";
|
|
2
|
+
|
|
3
|
+
export const logger = {
|
|
4
|
+
error(message: string) {
|
|
5
|
+
"worklet";
|
|
6
|
+
console.error(`[${LIBRARY_NAME}] ${message}`);
|
|
7
|
+
},
|
|
8
|
+
warn(message: string) {
|
|
9
|
+
"worklet";
|
|
10
|
+
console.warn(`[${LIBRARY_NAME}] ${message}`);
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const error = (message: string) =>
|
|
15
|
+
new Error(`[${LIBRARY_NAME}] ${message}`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_constants","_useStackPointerEvents","_styles","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RootTransitionAware","exports","memo","children","stylesMap","useScreenStyles","pointerEvents","useStackPointerEvents","animatedContentStyle","useAnimatedStyle","value","contentStyle","NO_STYLES","animatedOverlayStyle","overlayStyle","jsxs","View","style","styles","container","jsx","StyleSheet","absoluteFillObject","content","create","flex"],"sourceRoot":"../../../../src","sources":["shared/components/root-transition-aware.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAAsE,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAG,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,C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AAOL,SAAS,CAACM,KAAK,CAACI,YAAY,IAAIF,oBAAS;EACjD,CAAC,CAAC;EAEF,oBACC,IAAAhC,WAAA,CAAAmC,IAAA,EAACzC,YAAA,CAAA0C,IAAI;IAACC,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,CAAE;IAACb,aAAa,EAAEA,aAAc;IAAAH,QAAA,gBAC7D,IAAAvB,WAAA,CAAAwC,GAAA,EAAC7C,sBAAA,CAAAgB,OAAQ,CAACyB,IAAI;MACbC,KAAK,EAAE,CAACI,uBAAU,CAACC,kBAAkB,EAAET,oBAAoB,CAAE;MAC7DP,aAAa,EAAC;IAAM,CACpB,CAAC,eACF,IAAA1B,WAAA,CAAAwC,GAAA,EAAC7C,sBAAA,CAAAgB,OAAQ,CAACyB,IAAI;MACbC,KAAK,EAAE,CAACC,MAAM,CAACK,OAAO,EAAEf,oBAAoB,CAAE;MAC9CF,aAAa,EAAEA,aAAc;MAAAH,QAAA,EAE5BA;IAAQ,CACK,CAAC;EAAA,CACX,CAAC;AAET,CAAC,CAAC;AAEF,MAAMe,MAAM,GAAGG,uBAAU,CAACG,MAAM,CAAC;EAChCL,SAAS,EAAE;IACVM,IAAI,EAAE;EACP,CAAC;EACDF,OAAO,EAAE;IACRE,IAAI,EAAE;EACP;AACD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useStackPointerEvents = useStackPointerEvents;
|
|
7
|
-
var _core = require("../providers/stack/core.provider");
|
|
8
|
-
var _stack = require("../types/stack.types");
|
|
9
|
-
/**
|
|
10
|
-
* Hook that returns the appropriate pointer events value based on current stack type.
|
|
11
|
-
*
|
|
12
|
-
* - Component stack: "box-none" (allows touch pass-through to content behind)
|
|
13
|
-
* - Other stacks: undefined (default behavior, view receives touches)
|
|
14
|
-
*
|
|
15
|
-
* Must be used within a StackCoreProvider.
|
|
16
|
-
*/
|
|
17
|
-
function useStackPointerEvents() {
|
|
18
|
-
const {
|
|
19
|
-
flags
|
|
20
|
-
} = (0, _core.useStackCoreContext)();
|
|
21
|
-
return flags.STACK_TYPE === _stack.StackType.COMPONENT ? "box-none" : undefined;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=use-stack-pointer-events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_stack","useStackPointerEvents","flags","useStackCoreContext","STACK_TYPE","StackType","COMPONENT","undefined"],"sourceRoot":"../../../../src","sources":["shared/hooks/use-stack-pointer-events.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CAAA,EAA2B;EAC/D,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,yBAAmB,EAAC,CAAC;EACvC,OAAOD,KAAK,CAACE,UAAU,KAAKC,gBAAS,CAACC,SAAS,GAAG,UAAU,GAAGC,SAAS;AACzE","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeReanimated","require","_constants","_animate","startScreenTransition","target","spec","onAnimationFinish","animations","initialVelocity","value","config","open","close","isSpringConfig","effectiveConfig","velocity","progress","animating","closing","entering","set","TRUE","FALSE","runOnJS","animate","finished","exports"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/start-screen-transition.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AAWO,MAAMG,qBAAqB,GAAGA,CAAC;EACrCC,MAAM;EACNC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC;AAC2B,CAAC,KAAK;EACjC,SAAS;;EACT,MAAMC,KA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ACE,gBAAK,CAAC;EACrB,CAAC,CACF,CAAC;AACF,CAAC;AAACI,OAAA,CAAAvB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo } from "react";
|
|
4
|
-
import { StyleSheet, View } from "react-native";
|
|
5
|
-
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
6
|
-
import { NO_STYLES } from "../constants";
|
|
7
|
-
import { useStackPointerEvents } from "../hooks/use-stack-pointer-events";
|
|
8
|
-
import { useScreenStyles } from "../providers/screen/styles.provider";
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
export const RootTransitionAware = /*#__PURE__*/memo(({
|
|
11
|
-
children
|
|
12
|
-
}) => {
|
|
13
|
-
const {
|
|
14
|
-
stylesMap
|
|
15
|
-
} = useScreenStyles();
|
|
16
|
-
const pointerEvents = useStackPointerEvents();
|
|
17
|
-
const animatedContentStyle = useAnimatedStyle(() => {
|
|
18
|
-
"worklet";
|
|
19
|
-
|
|
20
|
-
return stylesMap.value.contentStyle || NO_STYLES;
|
|
21
|
-
});
|
|
22
|
-
const animatedOverlayStyle = useAnimatedStyle(() => {
|
|
23
|
-
"worklet";
|
|
24
|
-
|
|
25
|
-
return stylesMap.value.overlayStyle || NO_STYLES;
|
|
26
|
-
});
|
|
27
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
28
|
-
style: [styles.container],
|
|
29
|
-
pointerEvents: pointerEvents,
|
|
30
|
-
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
31
|
-
style: [StyleSheet.absoluteFillObject, animatedOverlayStyle],
|
|
32
|
-
pointerEvents: "none"
|
|
33
|
-
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
34
|
-
style: [styles.content, animatedContentStyle],
|
|
35
|
-
pointerEvents: pointerEvents,
|
|
36
|
-
children: children
|
|
37
|
-
})]
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
const styles = StyleSheet.create({
|
|
41
|
-
container: {
|
|
42
|
-
flex: 1
|
|
43
|
-
},
|
|
44
|
-
content: {
|
|
45
|
-
flex: 1
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=root-transition-aware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["memo","StyleSheet","View","Animated","useAnimatedStyle","NO_STYLES","useStackPointerEvents","useScreenStyles","jsx","_jsx","jsxs","_jsxs","RootTransitionAware","children","stylesMap","pointerEvents","animatedContentStyle","value","contentStyle","animatedOverlayStyle","overlayStyle","style","styles","container","absoluteFillObject","content","create","flex"],"sourceRoot":"../../../../src","sources":["shared/components/root-transition-aware.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;AACpE,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,eAAe,QAAQ,qCAAqC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMtE,OAAO,MAAMC,mBAAmB,gBAAGZ,IAAI,CAAC,CAAC;EAAEa;AAAgB,CAAC,KAAK;EAChE,MAAM;IAAEC;EAAU,CAAC,GAAGP,eAAe,CAAC,CAAC;EACvC,MAAMQ,aAAa,GAAGT,qBAAqB,CAAC,CAAC;EAE7C,MAAMU,oBAAoB,GAAGZ,gBAAgB,CAAC,MAAM;IACnD,SAAS;;IACT,OAAOU,SAAS,CAACG,KAAK,CAACC,YAAY,IAAIb,SAAS;EACjD,CAAC,CAAC;EAEF,MAAMc,oBAAoB,GAAGf,gBAAgB,CAAC,MAAM;IACnD,SAAS;;IACT,OAAOU,SAAS,CAACG,KAAK,CAACG,YAAY,IAAIf,SAAS;EACjD,CAAC,CAAC;EAEF,oBACCM,KAAA,CAACT,IAAI;IAACmB,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,CAAE;IAACR,aAAa,EAAEA,aAAc;IAAAF,QAAA,gBAC7DJ,IAAA,CAACN,QAAQ,CAACD,IAAI;MACbmB,KAAK,EAAE,CAACpB,UAAU,CAACuB,kBAAkB,EAAEL,oBAAoB,CAAE;MAC7DJ,aAAa,EAAC;IAAM,CACpB,CAAC,eACFN,IAAA,CAACN,QAAQ,CAACD,IAAI;MACbmB,KAAK,EAAE,CAACC,MAAM,CAACG,OAAO,EAAET,oBAAoB,CAAE;MAC9CD,aAAa,EAAEA,aAAc;MAAAF,QAAA,EAE5BA;IAAQ,CACK,CAAC;EAAA,CACX,CAAC;AAET,CAAC,CAAC;AAEF,MAAMS,MAAM,GAAGrB,UAAU,CAACyB,MAAM,CAAC;EAChCH,SAAS,EAAE;IACVI,IAAI,EAAE;EACP,CAAC;EACDF,OAAO,EAAE;IACRE,IAAI,EAAE;EACP;AACD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useStackCoreContext } from "../providers/stack/core.provider";
|
|
4
|
-
import { StackType } from "../types/stack.types";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Hook that returns the appropriate pointer events value based on current stack type.
|
|
8
|
-
*
|
|
9
|
-
* - Component stack: "box-none" (allows touch pass-through to content behind)
|
|
10
|
-
* - Other stacks: undefined (default behavior, view receives touches)
|
|
11
|
-
*
|
|
12
|
-
* Must be used within a StackCoreProvider.
|
|
13
|
-
*/
|
|
14
|
-
export function useStackPointerEvents() {
|
|
15
|
-
const {
|
|
16
|
-
flags
|
|
17
|
-
} = useStackCoreContext();
|
|
18
|
-
return flags.STACK_TYPE === StackType.COMPONENT ? "box-none" : undefined;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=use-stack-pointer-events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useStackCoreContext","StackType","useStackPointerEvents","flags","STACK_TYPE","COMPONENT","undefined"],"sourceRoot":"../../../../src","sources":["shared/hooks/use-stack-pointer-events.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAA,EAA2B;EAC/D,MAAM;IAAEC;EAAM,CAAC,GAAGH,mBAAmB,CAAC,CAAC;EACvC,OAAOG,KAAK,CAACC,UAAU,KAAKH,SAAS,CAACI,SAAS,GAAG,UAAU,GAAGC,SAAS;AACzE","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["runOnJS","FALSE","TRUE","animate","startScreenTransition","target","spec","onAnimationFinish","animations","initialVelocity","value","config","open","close","isSpringConfig","effectiveConfig","velocity","progress","animating","closing","entering","set","finished"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/start-screen-transition.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,yBAAyB;AACjD,SAASC,KAAK,EAAEC,IAAI,QAAQ,iBAAiB;AAG7C,SAASC,OAAO,QAAQ,WAAW;AAWnC,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EACrCC,MAAM;EACNC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC;AAC2B,CAAC,KAAK;EACjC,SAAS;;EACT,MAAMC,KAAK,GAAGL,MAAM,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC;EACvC,MAAMM,MAAM,GAAGN,MAAM,KAAK,MAAM,GAAGC,IAAI,EAAEM,IAAI,GAAGN,IAAI,EAAEO,KAAK;EAE3D,MAAMC,cAAc,GACnB,CAAC,CAACH,MAAM,IAAI,EAAE,UAAU,IAAIA,MAAM,CAAC,IAAI,EAAE,QAAQ,IAAIA,MAAM,CAAC;EAE7D,MAAMI,eA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