react-native-screen-transitions 3.6.0-alpha.2 → 3.6.0-alpha.4
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/lib/commonjs/shared/constants.js +5 -6
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js +2 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +33 -3
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +8 -4
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js +25 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +4 -4
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js +13 -4
- package/lib/commonjs/shared/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/options/helpers.js +10 -3
- package/lib/commonjs/shared/providers/screen/options/helpers.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -3
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js +2 -12
- package/lib/commonjs/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/managed.provider.js +1 -3
- package/lib/commonjs/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +5 -3
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +3 -2
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js +36 -15
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +24 -4
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +2 -2
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/module/shared/constants.js +4 -5
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js +2 -1
- package/lib/module/shared/providers/screen/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +33 -3
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js +2 -2
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +8 -4
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/selected-interpolator-options.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js +20 -0
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +4 -4
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/shared/policy.js +14 -5
- package/lib/module/shared/providers/screen/gestures/shared/policy.js.map +1 -1
- package/lib/module/shared/providers/screen/options/helpers.js +11 -4
- package/lib/module/shared/providers/screen/options/helpers.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +1 -3
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-stack-derived.js +2 -12
- package/lib/module/shared/providers/stack/helpers/use-stack-derived.js.map +1 -1
- package/lib/module/shared/providers/stack/managed.provider.js +1 -3
- package/lib/module/shared/providers/stack/managed.provider.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +5 -3
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/types/animation.types.js +2 -1
- package/lib/module/shared/types/animation.types.js.map +1 -1
- package/lib/module/shared/types/bounds.types.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +3 -2
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js +38 -17
- package/lib/module/shared/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js +24 -5
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js +2 -2
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts +4 -207
- package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +2 -2
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/scene-view.d.ts +1 -1
- package/lib/typescript/shared/components/scene-view.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts +2 -2
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +3 -2
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +0 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +14 -14
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts +2 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/selected-interpolator-options.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts +3 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts +4 -4
- package/lib/typescript/shared/providers/screen/gestures/shared/policy.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/options/helpers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/options/types.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/options/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/components/maybe-floating-container.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/styles/components/maybe-floating-container.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts +5 -5
- package/lib/typescript/shared/providers/stack/helpers/use-stack-derived.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/stack/managed.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +4 -3
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +7 -3
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +69 -1
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +2 -2
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +13 -26
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts +12 -2
- package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/types.d.ts +2 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/shared/constants.ts +6 -4
- package/src/shared/hooks/navigation/use-stack.tsx +0 -1
- package/src/shared/providers/screen/animation/helpers/build-screen-transition-options.ts +2 -2
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +58 -4
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/snap-points.ts +2 -1
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts +2 -1
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +20 -6
- package/src/shared/providers/screen/animation/helpers/selected-interpolator-options.ts +0 -2
- package/src/shared/providers/screen/animation/helpers/stack-progress.ts +29 -0
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +5 -12
- package/src/shared/providers/screen/gestures/shared/policy.ts +20 -7
- package/src/shared/providers/screen/options/helpers.ts +22 -9
- package/src/shared/providers/screen/options/types.ts +2 -1
- package/src/shared/providers/stack/direct.provider.tsx +3 -13
- package/src/shared/providers/stack/helpers/use-stack-derived.ts +6 -15
- package/src/shared/providers/stack/managed.provider.tsx +2 -6
- package/src/shared/stores/animation.store.ts +6 -3
- package/src/shared/types/animation.types.ts +11 -3
- package/src/shared/types/bounds.types.ts +72 -1
- package/src/shared/types/index.ts +2 -0
- package/src/shared/types/screen.types.ts +13 -26
- package/src/shared/utils/bounds/index.ts +3 -1
- package/src/shared/utils/bounds/navigation/reveal/build.ts +56 -24
- package/src/shared/utils/bounds/navigation/reveal/math.ts +34 -4
- package/src/shared/utils/bounds/navigation/reveal/types.ts +2 -0
- package/src/shared/utils/bounds/navigation/zoom/build.ts +2 -2
|
@@ -19,6 +19,7 @@ import { toPlainRoute, toPlainValue } from "./worklet";
|
|
|
19
19
|
|
|
20
20
|
type BuiltState = {
|
|
21
21
|
progress: SharedValue<number>;
|
|
22
|
+
effectiveProgress: SharedValue<number>;
|
|
22
23
|
willAnimate: SharedValue<number>;
|
|
23
24
|
closing: SharedValue<number>;
|
|
24
25
|
progressAnimating: SharedValue<number>;
|
|
@@ -27,7 +28,7 @@ type BuiltState = {
|
|
|
27
28
|
route: BaseStackRoute;
|
|
28
29
|
meta?: Record<string, unknown>;
|
|
29
30
|
options: ScreenTransitionOptions;
|
|
30
|
-
|
|
31
|
+
optionsSlot: ScreenTransitionOptions;
|
|
31
32
|
targetProgress: SharedValue<number>;
|
|
32
33
|
logicalSettleFrameCount: SharedValue<number>;
|
|
33
34
|
resolvedAutoSnapPoint: SharedValue<number>;
|
|
@@ -44,7 +45,6 @@ export const useBuildTransitionState = (
|
|
|
44
45
|
const key = descriptor?.route?.key;
|
|
45
46
|
const meta = descriptor?.options?.meta;
|
|
46
47
|
const route = descriptor?.route;
|
|
47
|
-
const navigationMaskEnabled = !!descriptor?.options?.navigationMaskEnabled;
|
|
48
48
|
const snapPoints = descriptor?.options?.snapPoints;
|
|
49
49
|
|
|
50
50
|
return useMemo(() => {
|
|
@@ -63,6 +63,7 @@ export const useBuildTransitionState = (
|
|
|
63
63
|
|
|
64
64
|
return {
|
|
65
65
|
progress: AnimationStore.getValue(key, "progress"),
|
|
66
|
+
effectiveProgress: AnimationStore.getValue(key, "effectiveProgress"),
|
|
66
67
|
willAnimate: AnimationStore.getValue(key, "willAnimate"),
|
|
67
68
|
closing: AnimationStore.getValue(key, "closing"),
|
|
68
69
|
entering: AnimationStore.getValue(key, "entering"),
|
|
@@ -81,20 +82,12 @@ export const useBuildTransitionState = (
|
|
|
81
82
|
route: plainRoute,
|
|
82
83
|
meta: plainMeta,
|
|
83
84
|
options: transitionOptions,
|
|
84
|
-
|
|
85
|
+
optionsSlot: {},
|
|
85
86
|
unwrapped: createScreenTransitionState(
|
|
86
87
|
plainRoute,
|
|
87
88
|
plainMeta,
|
|
88
|
-
navigationMaskEnabled,
|
|
89
89
|
transitionOptions,
|
|
90
90
|
),
|
|
91
91
|
};
|
|
92
|
-
}, [
|
|
93
|
-
key,
|
|
94
|
-
meta,
|
|
95
|
-
route,
|
|
96
|
-
snapPoints,
|
|
97
|
-
navigationMaskEnabled,
|
|
98
|
-
descriptor?.options,
|
|
99
|
-
]);
|
|
92
|
+
}, [key, meta, route, snapPoints, descriptor?.options]);
|
|
100
93
|
};
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_GESTURE_SENSITIVITY,
|
|
7
7
|
DEFAULT_GESTURE_SNAP_LOCKED,
|
|
8
8
|
DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT,
|
|
9
|
+
DEFAULT_GESTURE_TRACKING,
|
|
9
10
|
DEFAULT_GESTURE_VELOCITY_IMPACT,
|
|
10
11
|
DEFAULT_SHEET_SCROLL_GESTURE_BEHAVIOR,
|
|
11
12
|
} from "../../../../constants";
|
|
@@ -15,6 +16,7 @@ import type {
|
|
|
15
16
|
GestureProgressMode,
|
|
16
17
|
} from "../../../../types/gesture.types";
|
|
17
18
|
import type {
|
|
19
|
+
GestureTracking,
|
|
18
20
|
ScreenTransitionConfig,
|
|
19
21
|
SheetScrollGestureBehavior,
|
|
20
22
|
SnapPoint,
|
|
@@ -39,13 +41,13 @@ import {
|
|
|
39
41
|
import { validateSnapPoints } from "./snap-points";
|
|
40
42
|
|
|
41
43
|
export type GesturePolicyOptions = {
|
|
42
|
-
experimental_allowDisabledGestureTracking?: boolean;
|
|
43
44
|
expandViaScrollView?: boolean;
|
|
44
45
|
gestureActivationArea?: GestureActivationArea;
|
|
45
46
|
gestureDirection?: GestureDirection | GestureDirection[];
|
|
46
47
|
gestureDrivesProgress?: boolean;
|
|
47
48
|
gestureEnabled?: boolean;
|
|
48
49
|
gestureProgressMode?: GestureProgressMode;
|
|
50
|
+
gestureTracking?: GestureTracking;
|
|
49
51
|
gestureReleaseVelocityScale?: number;
|
|
50
52
|
gestureResponseDistance?: number;
|
|
51
53
|
gestureSensitivity?: number;
|
|
@@ -144,18 +146,26 @@ export const resolveGestureCanTrack = ({
|
|
|
144
146
|
isFirstKey,
|
|
145
147
|
canDismiss,
|
|
146
148
|
hasSnapPoints,
|
|
147
|
-
|
|
149
|
+
gestureTracking = DEFAULT_GESTURE_TRACKING,
|
|
148
150
|
}: {
|
|
149
151
|
isFirstKey: boolean;
|
|
150
152
|
canDismiss: boolean;
|
|
151
153
|
hasSnapPoints: boolean;
|
|
152
|
-
|
|
154
|
+
gestureTracking?: GestureTracking;
|
|
153
155
|
}) => {
|
|
154
156
|
"worklet";
|
|
155
157
|
if (isFirstKey) {
|
|
156
158
|
return false;
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
if (gestureTracking === "never") {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (gestureTracking === "always") {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
if (canDismiss) {
|
|
160
170
|
return true;
|
|
161
171
|
}
|
|
@@ -164,7 +174,7 @@ export const resolveGestureCanTrack = ({
|
|
|
164
174
|
return true;
|
|
165
175
|
}
|
|
166
176
|
|
|
167
|
-
return
|
|
177
|
+
return false;
|
|
168
178
|
};
|
|
169
179
|
|
|
170
180
|
export const resolvePanPolicy = (
|
|
@@ -234,8 +244,7 @@ const resolveGestureParticipation = ({
|
|
|
234
244
|
isFirstKey,
|
|
235
245
|
canDismiss,
|
|
236
246
|
hasSnapPoints: effectiveSnapPoints.hasSnapPoints,
|
|
237
|
-
|
|
238
|
-
options.experimental_allowDisabledGestureTracking,
|
|
247
|
+
gestureTracking: options.gestureTracking,
|
|
239
248
|
});
|
|
240
249
|
const claimedDirections = computeClaimedDirections(
|
|
241
250
|
canTrackGesture,
|
|
@@ -309,7 +318,11 @@ function resolveRuntimeCanTrackGesture(
|
|
|
309
318
|
return false;
|
|
310
319
|
}
|
|
311
320
|
|
|
312
|
-
if (options.
|
|
321
|
+
if (options.gestureTracking === "never") {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (options.gestureTracking === "always") {
|
|
313
326
|
return true;
|
|
314
327
|
}
|
|
315
328
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_GESTURE_SENSITIVITY,
|
|
7
7
|
DEFAULT_GESTURE_SNAP_LOCKED,
|
|
8
8
|
DEFAULT_GESTURE_SNAP_VELOCITY_IMPACT,
|
|
9
|
+
DEFAULT_GESTURE_TRACKING,
|
|
9
10
|
DEFAULT_GESTURE_VELOCITY_IMPACT,
|
|
10
11
|
DEFAULT_SHEET_SCROLL_GESTURE_BEHAVIOR,
|
|
11
12
|
} from "../../../constants";
|
|
@@ -126,6 +127,16 @@ const resolveSheetScrollGestureBehaviorOption = (
|
|
|
126
127
|
: fallback;
|
|
127
128
|
};
|
|
128
129
|
|
|
130
|
+
const resolveGestureTrackingOption = (
|
|
131
|
+
value: unknown,
|
|
132
|
+
fallback: RequiredScreenOption<"gestureTracking">,
|
|
133
|
+
): RequiredScreenOption<"gestureTracking"> => {
|
|
134
|
+
"worklet";
|
|
135
|
+
return value === "auto" || value === "never" || value === "always"
|
|
136
|
+
? value
|
|
137
|
+
: fallback;
|
|
138
|
+
};
|
|
139
|
+
|
|
129
140
|
const resolveBackdropBehaviorOption = (
|
|
130
141
|
value: unknown,
|
|
131
142
|
fallback: BackdropBehavior | undefined,
|
|
@@ -206,9 +217,9 @@ const areScreenOptionsEqual = (
|
|
|
206
217
|
) => {
|
|
207
218
|
"worklet";
|
|
208
219
|
return (
|
|
220
|
+
left.navigationMaskEnabled === right.navigationMaskEnabled &&
|
|
209
221
|
left.gestureEnabled === right.gestureEnabled &&
|
|
210
|
-
left.
|
|
211
|
-
right.experimental_allowDisabledGestureTracking &&
|
|
222
|
+
left.gestureTracking === right.gestureTracking &&
|
|
212
223
|
areGestureDirectionsEqual(left.gestureDirection, right.gestureDirection) &&
|
|
213
224
|
left.gestureSensitivity === right.gestureSensitivity &&
|
|
214
225
|
left.gestureVelocityImpact === right.gestureVelocityImpact &&
|
|
@@ -238,10 +249,14 @@ export const resolveBaseScreenOptions = (
|
|
|
238
249
|
);
|
|
239
250
|
|
|
240
251
|
return {
|
|
252
|
+
navigationMaskEnabled: resolveBooleanOption(
|
|
253
|
+
options.navigationMaskEnabled,
|
|
254
|
+
undefined,
|
|
255
|
+
),
|
|
241
256
|
gestureEnabled: resolveBooleanOption(options.gestureEnabled, undefined),
|
|
242
|
-
|
|
243
|
-
options.
|
|
244
|
-
|
|
257
|
+
gestureTracking: resolveGestureTrackingOption(
|
|
258
|
+
options.gestureTracking,
|
|
259
|
+
DEFAULT_GESTURE_TRACKING,
|
|
245
260
|
),
|
|
246
261
|
gestureDirection: resolveGestureDirectionOption(
|
|
247
262
|
options.gestureDirection,
|
|
@@ -322,14 +337,12 @@ export const syncScreenOptionsOverrides = (
|
|
|
322
337
|
);
|
|
323
338
|
|
|
324
339
|
const next: ScreenOptionsState = {
|
|
340
|
+
navigationMaskEnabled: base.navigationMaskEnabled,
|
|
325
341
|
gestureEnabled: resolveBooleanOption(
|
|
326
342
|
options?.gestureEnabled,
|
|
327
343
|
base.gestureEnabled,
|
|
328
344
|
),
|
|
329
|
-
|
|
330
|
-
options?.experimental_allowDisabledGestureTracking,
|
|
331
|
-
base.experimental_allowDisabledGestureTracking,
|
|
332
|
-
),
|
|
345
|
+
gestureTracking: base.gestureTracking,
|
|
333
346
|
gestureDirection: resolveGestureDirectionOption(
|
|
334
347
|
options?.gestureDirection,
|
|
335
348
|
base.gestureDirection,
|
|
@@ -9,8 +9,9 @@ export type OptionalScreenOption<K extends keyof ScreenTransitionOptions> =
|
|
|
9
9
|
ScreenTransitionOptions[K];
|
|
10
10
|
|
|
11
11
|
export type ScreenOptionsSnapshot = {
|
|
12
|
+
navigationMaskEnabled: OptionalScreenOption<"navigationMaskEnabled">;
|
|
12
13
|
gestureEnabled: OptionalScreenOption<"gestureEnabled">;
|
|
13
|
-
|
|
14
|
+
gestureTracking: RequiredScreenOption<"gestureTracking">;
|
|
14
15
|
gestureDirection: RequiredScreenOption<"gestureDirection">;
|
|
15
16
|
gestureSensitivity: RequiredScreenOption<"gestureSensitivity">;
|
|
16
17
|
gestureVelocityImpact: RequiredScreenOption<"gestureVelocityImpact">;
|
|
@@ -79,8 +79,7 @@ function useDirectStackValue(
|
|
|
79
79
|
};
|
|
80
80
|
}, [state.routes, state.preloadedRoutes, preloadedDescriptors, descriptors]);
|
|
81
81
|
|
|
82
|
-
const {
|
|
83
|
-
useStackDerived(animationMaps);
|
|
82
|
+
const { optimisticFocusedIndex } = useStackDerived(animationMaps);
|
|
84
83
|
|
|
85
84
|
const focusedIndex = state.index;
|
|
86
85
|
|
|
@@ -91,18 +90,9 @@ function useDirectStackValue(
|
|
|
91
90
|
routeKeys,
|
|
92
91
|
routes: allRoutes,
|
|
93
92
|
scenes,
|
|
94
|
-
stackProgress,
|
|
95
93
|
optimisticFocusedIndex,
|
|
96
94
|
}),
|
|
97
|
-
[
|
|
98
|
-
flags,
|
|
99
|
-
navigatorKey,
|
|
100
|
-
routeKeys,
|
|
101
|
-
allRoutes,
|
|
102
|
-
scenes,
|
|
103
|
-
stackProgress,
|
|
104
|
-
optimisticFocusedIndex,
|
|
105
|
-
],
|
|
95
|
+
[flags, navigatorKey, routeKeys, allRoutes, scenes, optimisticFocusedIndex],
|
|
106
96
|
);
|
|
107
97
|
|
|
108
98
|
// DirectStack context value
|
|
@@ -142,5 +132,5 @@ function withDirectStack<TProps extends DirectStackProps>(
|
|
|
142
132
|
};
|
|
143
133
|
}
|
|
144
134
|
|
|
145
|
-
export { withDirectStack };
|
|
146
135
|
export type { DirectStackContextValue, DirectStackProps, DirectStackScene };
|
|
136
|
+
export { withDirectStack };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DerivedValue, useDerivedValue } from "react-native-reanimated";
|
|
2
2
|
import type { AnimationStoreMap } from "../../../stores/animation.store";
|
|
3
3
|
|
|
4
|
+
type StackDerivedAnimationMap = Pick<AnimationStoreMap, "closing">;
|
|
5
|
+
|
|
4
6
|
export interface StackDerived {
|
|
5
|
-
/** Sum of all individual screen progress values. */
|
|
6
|
-
stackProgress: DerivedValue<number>;
|
|
7
7
|
/**
|
|
8
8
|
* Focused index that accounts for closing screens.
|
|
9
9
|
* Counts consecutive closing screens from the top so that
|
|
@@ -13,21 +13,12 @@ export interface StackDerived {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Derives
|
|
17
|
-
*
|
|
16
|
+
* Derives an optimistic focused index from animation store maps.
|
|
17
|
+
* Shared between managed and direct providers.
|
|
18
18
|
*/
|
|
19
19
|
export function useStackDerived(
|
|
20
|
-
animationMaps:
|
|
20
|
+
animationMaps: StackDerivedAnimationMap[],
|
|
21
21
|
): StackDerived {
|
|
22
|
-
const stackProgress = useDerivedValue(() => {
|
|
23
|
-
"worklet";
|
|
24
|
-
let total = 0;
|
|
25
|
-
for (let i = 0; i < animationMaps.length; i++) {
|
|
26
|
-
total += animationMaps[i].progress.get();
|
|
27
|
-
}
|
|
28
|
-
return total;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
22
|
const optimisticFocusedIndex = useDerivedValue(() => {
|
|
32
23
|
"worklet";
|
|
33
24
|
const lastIndex = animationMaps.length - 1;
|
|
@@ -39,5 +30,5 @@ export function useStackDerived(
|
|
|
39
30
|
return lastIndex - closingFromTop;
|
|
40
31
|
});
|
|
41
32
|
|
|
42
|
-
return {
|
|
33
|
+
return { optimisticFocusedIndex };
|
|
43
34
|
}
|
|
@@ -47,9 +47,7 @@ function useManagedStackValue<
|
|
|
47
47
|
const navigatorKey = props.state.key;
|
|
48
48
|
|
|
49
49
|
const processed = useProcessedRoutes(state.routes, state.descriptors);
|
|
50
|
-
const {
|
|
51
|
-
processed.animationMaps,
|
|
52
|
-
);
|
|
50
|
+
const { optimisticFocusedIndex } = useStackDerived(processed.animationMaps);
|
|
53
51
|
const closingRouteMap = useClosingRouteMap(
|
|
54
52
|
processed.routeKeys,
|
|
55
53
|
processed.animationMaps,
|
|
@@ -65,7 +63,6 @@ function useManagedStackValue<
|
|
|
65
63
|
routeKeys: processed.routeKeys,
|
|
66
64
|
routes: state.routes as Route<string>[],
|
|
67
65
|
scenes: processed.scenes as BaseStackScene[],
|
|
68
|
-
stackProgress,
|
|
69
66
|
optimisticFocusedIndex,
|
|
70
67
|
}),
|
|
71
68
|
[
|
|
@@ -74,7 +71,6 @@ function useManagedStackValue<
|
|
|
74
71
|
processed.routeKeys,
|
|
75
72
|
state.routes,
|
|
76
73
|
processed.scenes,
|
|
77
|
-
stackProgress,
|
|
78
74
|
optimisticFocusedIndex,
|
|
79
75
|
],
|
|
80
76
|
);
|
|
@@ -138,9 +134,9 @@ function withManagedStack<
|
|
|
138
134
|
};
|
|
139
135
|
}
|
|
140
136
|
|
|
141
|
-
export { useManagedStackContext, withManagedStack };
|
|
142
137
|
export type {
|
|
143
138
|
ManagedStackContextValue,
|
|
144
139
|
ManagedStackProps,
|
|
145
140
|
ManagedStackRenderProps,
|
|
146
141
|
};
|
|
142
|
+
export { useManagedStackContext, withManagedStack };
|
|
@@ -7,6 +7,7 @@ import { createStore } from "../utils/create-store";
|
|
|
7
7
|
|
|
8
8
|
export type AnimationStoreMap = {
|
|
9
9
|
progress: SharedValue<number>;
|
|
10
|
+
effectiveProgress: SharedValue<number>;
|
|
10
11
|
willAnimate: SharedValue<number>;
|
|
11
12
|
progressAnimating: SharedValue<number>;
|
|
12
13
|
closing: SharedValue<number>;
|
|
@@ -16,6 +17,7 @@ export type AnimationStoreMap = {
|
|
|
16
17
|
function createAnimationBag(): AnimationStoreMap {
|
|
17
18
|
return {
|
|
18
19
|
progress: makeMutable(0),
|
|
20
|
+
effectiveProgress: makeMutable(0),
|
|
19
21
|
willAnimate: makeMutable(0),
|
|
20
22
|
closing: makeMutable(0),
|
|
21
23
|
progressAnimating: makeMutable(0),
|
|
@@ -24,14 +26,15 @@ function createAnimationBag(): AnimationStoreMap {
|
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
|
-
* Route-keyed screen transition state for the public animation lifecycle.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
29
|
+
* Route-keyed screen transition state for the public animation lifecycle.
|
|
30
|
+
* `progress` tracks committed transition progress; `effectiveProgress` tracks
|
|
31
|
+
* the hydrated progress after live gesture policy is applied.
|
|
30
32
|
*/
|
|
31
33
|
export const AnimationStore = createStore<AnimationStoreMap>({
|
|
32
34
|
createBag: createAnimationBag,
|
|
33
35
|
disposeBag: (bag) => {
|
|
34
36
|
cancelAnimation(bag.progress);
|
|
37
|
+
cancelAnimation(bag.effectiveProgress);
|
|
35
38
|
cancelAnimation(bag.willAnimate);
|
|
36
39
|
cancelAnimation(bag.progressAnimating);
|
|
37
40
|
cancelAnimation(bag.closing);
|
|
@@ -23,8 +23,9 @@ import type { BaseStackRoute } from "./stack.types";
|
|
|
23
23
|
*/
|
|
24
24
|
export type ScreenTransitionOptions = Pick<
|
|
25
25
|
ScreenTransitionConfig,
|
|
26
|
+
| "navigationMaskEnabled"
|
|
26
27
|
| "gestureEnabled"
|
|
27
|
-
| "
|
|
28
|
+
| "gestureTracking"
|
|
28
29
|
| "gestureDirection"
|
|
29
30
|
| "gestureSensitivity"
|
|
30
31
|
| "gestureVelocityImpact"
|
|
@@ -227,6 +228,9 @@ export interface ScreenInterpolationProps {
|
|
|
227
228
|
/**
|
|
228
229
|
* Whether the active transition is visually close enough to its target to be
|
|
229
230
|
* treated as complete, even if the animation is still physically settling.
|
|
231
|
+
*
|
|
232
|
+
* @deprecated Use `active.logicallySettled` instead. Screen settlement state
|
|
233
|
+
* belongs on the screen state object.
|
|
230
234
|
*/
|
|
231
235
|
logicallySettled: number;
|
|
232
236
|
|
|
@@ -283,13 +287,17 @@ export type TransitionSlotStyle = AnimatedViewStyle | TransitionSlotDefinition;
|
|
|
283
287
|
* Runtime options returned by `screenStyleInterpolator`.
|
|
284
288
|
*
|
|
285
289
|
* These values are not style slots. They are derived per frame and consumed by
|
|
286
|
-
* the transition runtime.
|
|
290
|
+
* the transition runtime. Structural options that change the React tree, such
|
|
291
|
+
* as `navigationMaskEnabled`, must be configured statically on the screen.
|
|
287
292
|
*
|
|
288
293
|
* If `gestureSensitivity` is derived from the current gesture, prefer
|
|
289
294
|
* `active.gesture.raw` so the sensitivity calculation does not feed back into
|
|
290
295
|
* itself.
|
|
291
296
|
*/
|
|
292
|
-
export type TransitionInterpolatorOptions =
|
|
297
|
+
export type TransitionInterpolatorOptions = Omit<
|
|
298
|
+
ScreenTransitionOptions,
|
|
299
|
+
"navigationMaskEnabled" | "gestureTracking"
|
|
300
|
+
>;
|
|
293
301
|
|
|
294
302
|
/**
|
|
295
303
|
* Internal normalized slot format.
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
TransitionInterpolatedStyle,
|
|
15
15
|
TransitionSlotStyle,
|
|
16
16
|
} from "./animation.types";
|
|
17
|
+
import type { GestureProgressMode } from "./gesture.types";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Target style computation.
|
|
@@ -161,11 +162,81 @@ export type BoundsNavigationZoomStyle = TransitionInterpolatedStyle & {
|
|
|
161
162
|
[NAVIGATION_MASK_ELEMENT_STYLE_ID]?: TransitionSlotStyle;
|
|
162
163
|
};
|
|
163
164
|
|
|
165
|
+
export type BoundsNavigationRevealOptions = {
|
|
166
|
+
/**
|
|
167
|
+
* Destination mask border radius.
|
|
168
|
+
*
|
|
169
|
+
* Reveal interpolates from the measured source border radius to this value.
|
|
170
|
+
*
|
|
171
|
+
* @default Platform-specific reveal radius
|
|
172
|
+
*/
|
|
173
|
+
borderRadius?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Whether the reveal mask should use React Native's continuous border curve.
|
|
176
|
+
*
|
|
177
|
+
* @default true
|
|
178
|
+
*/
|
|
179
|
+
borderContinuous?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Maximum dynamic gesture sensitivity applied by reveal.
|
|
182
|
+
*
|
|
183
|
+
* Reveal lowers gesture sensitivity as the drag gets deeper so the masked
|
|
184
|
+
* container can keep its source-to-destination handoff stable. This value
|
|
185
|
+
* controls the starting/highest sensitivity in that curve.
|
|
186
|
+
*
|
|
187
|
+
* @default 0.8
|
|
188
|
+
*/
|
|
189
|
+
maxSensitivity?: number;
|
|
190
|
+
/**
|
|
191
|
+
* Velocity-driven depth applied to the dismiss scale handoff.
|
|
192
|
+
*
|
|
193
|
+
* Higher values make fast releases orbit farther around the final source
|
|
194
|
+
* scale. Set to `0` to remove the velocity depth effect.
|
|
195
|
+
*
|
|
196
|
+
* @default 0.5
|
|
197
|
+
*/
|
|
198
|
+
velocityDepth?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Whether gesture displacement should drive transition progress or remain as
|
|
201
|
+
* freeform gesture values. Reveal defaults to `"freeform"` so drag can move
|
|
202
|
+
* the masked container without owning the whole screen progress.
|
|
203
|
+
*
|
|
204
|
+
* @default "freeform"
|
|
205
|
+
*/
|
|
206
|
+
gestureProgressMode?: GestureProgressMode;
|
|
207
|
+
/**
|
|
208
|
+
* Temporarily blocks pointer-event pass-through on the inactive content until
|
|
209
|
+
* the source element transition handoff reaches progress `0.25`.
|
|
210
|
+
*
|
|
211
|
+
* This is intentional and most users cannot react fast enough to swipe during
|
|
212
|
+
* that brief handoff. If it becomes an issue, set this to `false` to disable
|
|
213
|
+
* the guard and keep the default behavior that allows pointer events to pass
|
|
214
|
+
* through.
|
|
215
|
+
*
|
|
216
|
+
* @default true
|
|
217
|
+
*/
|
|
218
|
+
disablePointerEventsTillElementTransition?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* How reveal should resize the navigation mask element.
|
|
221
|
+
*
|
|
222
|
+
* `"auto"` uses the platform default. Android defaults to transform-based
|
|
223
|
+
* resizing to avoid masked-size animation cost, while other platforms animate
|
|
224
|
+
* width and height. Transform-based resizing can make large border radii look
|
|
225
|
+
* less natural on Android; use `"size"` to force width/height animation when
|
|
226
|
+
* radius quality is more important than that optimization.
|
|
227
|
+
*
|
|
228
|
+
* @default "auto"
|
|
229
|
+
*/
|
|
230
|
+
maskSizingMode?: "auto" | "transform" | "size";
|
|
231
|
+
};
|
|
232
|
+
|
|
164
233
|
export type BoundsNavigationRevealStyle = BoundsNavigationZoomStyle;
|
|
165
234
|
|
|
166
235
|
export type BoundsNavigationAccessor = {
|
|
167
236
|
zoom: (options?: BoundsNavigationZoomOptions) => BoundsNavigationZoomStyle;
|
|
168
|
-
reveal: (
|
|
237
|
+
reveal: (
|
|
238
|
+
options?: BoundsNavigationRevealOptions,
|
|
239
|
+
) => BoundsNavigationRevealStyle;
|
|
169
240
|
};
|
|
170
241
|
|
|
171
242
|
type BoundsBoundNavigationAccessor = {
|
|
@@ -15,6 +15,7 @@ export type {
|
|
|
15
15
|
BoundsAccessor,
|
|
16
16
|
BoundsMethod,
|
|
17
17
|
BoundsNavigationAccessor,
|
|
18
|
+
BoundsNavigationRevealOptions,
|
|
18
19
|
BoundsNavigationRevealStyle,
|
|
19
20
|
BoundsNavigationZoomOpacityRange,
|
|
20
21
|
BoundsNavigationZoomOpacityRanges,
|
|
@@ -32,6 +33,7 @@ export type {
|
|
|
32
33
|
} from "./gesture.types";
|
|
33
34
|
export type { OverlayProps } from "./overlay.types";
|
|
34
35
|
export type {
|
|
36
|
+
GestureTracking,
|
|
35
37
|
Layout,
|
|
36
38
|
ScreenKey,
|
|
37
39
|
ScreenTransitionConfig,
|
|
@@ -27,19 +27,13 @@ export type ScreenLayouts = {
|
|
|
27
27
|
* auto snap-point sizing. It is undefined until a real measurement exists.
|
|
28
28
|
*/
|
|
29
29
|
content?: Layout;
|
|
30
|
-
/**
|
|
31
|
-
* Whether navigation bounds masking is enabled for this screen.
|
|
32
|
-
*
|
|
33
|
-
* When enabled, navigation zoom helpers target the masked container path
|
|
34
|
-
* instead of the plain content slot.
|
|
35
|
-
*/
|
|
36
|
-
navigationMaskEnabled: boolean;
|
|
37
30
|
};
|
|
38
31
|
|
|
39
32
|
export type ScreenKey = string;
|
|
40
33
|
export type SheetScrollGestureBehavior =
|
|
41
34
|
| "expand-and-collapse"
|
|
42
35
|
| "collapse-only";
|
|
36
|
+
export type GestureTracking = "auto" | "never" | "always";
|
|
43
37
|
|
|
44
38
|
/**
|
|
45
39
|
* A single snap point value. Either a fraction of screen height (0–1) or
|
|
@@ -137,21 +131,17 @@ export type ScreenTransitionConfig = {
|
|
|
137
131
|
gestureEnabled?: boolean;
|
|
138
132
|
|
|
139
133
|
/**
|
|
140
|
-
*
|
|
141
|
-
* live gesture values while preventing gesture dismissal.
|
|
142
|
-
*
|
|
143
|
-
* This is a v3 compatibility bridge for the next gesture behavior. Direction
|
|
144
|
-
* ownership/claims participate while this is enabled so nested screens can
|
|
145
|
-
* intentionally shadow parent gestures for resistance-style animations.
|
|
134
|
+
* Controls whether the screen tracks live gesture values.
|
|
146
135
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
136
|
+
* - `"auto"` tracks gestures when dismissal is enabled, or when snap points
|
|
137
|
+
* can move without dismissal.
|
|
138
|
+
* - `"never"` disables gesture tracking for the screen.
|
|
139
|
+
* - `"always"` keeps tracking live gesture values even when
|
|
140
|
+
* `gestureEnabled` is `false`, without allowing dismiss.
|
|
150
141
|
*
|
|
151
|
-
* @
|
|
152
|
-
* @default false
|
|
142
|
+
* @default "auto"
|
|
153
143
|
*/
|
|
154
|
-
|
|
144
|
+
gestureTracking?: GestureTracking;
|
|
155
145
|
|
|
156
146
|
/**
|
|
157
147
|
* The direction(s) of the screen gesture used to dismiss the screen.
|
|
@@ -206,15 +196,12 @@ export type ScreenTransitionConfig = {
|
|
|
206
196
|
gestureReleaseVelocityScale?: number;
|
|
207
197
|
|
|
208
198
|
/**
|
|
209
|
-
*
|
|
199
|
+
* Deprecated compatibility option.
|
|
210
200
|
*
|
|
211
|
-
* This
|
|
212
|
-
*
|
|
213
|
-
* animation intensity after `gestureReleaseVelocityScale` is applied.
|
|
201
|
+
* This option is no longer read by the runtime transition options. Use
|
|
202
|
+
* `gestureReleaseVelocityScale` to tune post-release spring energy.
|
|
214
203
|
*
|
|
215
|
-
* @deprecated v3 compatibility only.
|
|
216
|
-
* gesture runtime.
|
|
217
|
-
* @default 3.2
|
|
204
|
+
* @deprecated v3 compatibility only.
|
|
218
205
|
*/
|
|
219
206
|
gestureReleaseVelocityMax?: number;
|
|
220
207
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BoundsAccessor,
|
|
3
3
|
BoundsInterpolationProps,
|
|
4
|
+
BoundsNavigationRevealOptions,
|
|
4
5
|
BoundsNavigationZoomOptions,
|
|
5
6
|
} from "../../types/bounds.types";
|
|
6
7
|
import { createBoundsAccessorCore } from "./helpers/create-bounds-accessor-core";
|
|
@@ -26,11 +27,12 @@ export const createBoundsAccessor = (
|
|
|
26
27
|
zoomOptions,
|
|
27
28
|
});
|
|
28
29
|
},
|
|
29
|
-
reveal: () => {
|
|
30
|
+
reveal: (revealOptions?: BoundsNavigationRevealOptions) => {
|
|
30
31
|
"worklet";
|
|
31
32
|
return buildRevealStyles({
|
|
32
33
|
props,
|
|
33
34
|
tag,
|
|
35
|
+
revealOptions,
|
|
34
36
|
});
|
|
35
37
|
},
|
|
36
38
|
},
|