react-native-screen-transitions 3.4.0-alpha.1 → 3.4.0-alpha.2
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 +11 -1109
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js +69 -2
- package/lib/commonjs/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js +9 -0
- package/lib/commonjs/component-stack/navigators/create-component-stack-navigator.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +195 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -14
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +19 -18
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +54 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +40 -8
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +72 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +16 -7
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +7 -4
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +14 -15
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +27 -9
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/index.js +22 -8
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +3 -2
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen-container.js +12 -6
- package/lib/commonjs/shared/components/native-screen-container.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen.js +35 -8
- package/lib/commonjs/shared/components/native-screen.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +60 -0
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container/layers/content.js +5 -37
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +21 -12
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +6 -7
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-activation.js +11 -6
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-activation.js.map +1 -1
- package/lib/commonjs/shared/providers/layout-anchor.provider.js +4 -6
- package/lib/commonjs/shared/providers/layout-anchor.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +14 -7
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/core.provider.js +14 -21
- package/lib/commonjs/shared/providers/stack/core.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +3 -1
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +14 -5
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js +0 -5
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +10 -0
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js +6 -0
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +33 -26
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/resolve-screen-transition-options.js +25 -0
- package/lib/commonjs/shared/utils/resolve-screen-transition-options.js.map +1 -0
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js +69 -3
- package/lib/module/blank-stack/navigators/create-blank-stack-navigator.js.map +1 -1
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js +9 -0
- package/lib/module/component-stack/navigators/create-component-stack-navigator.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +182 -0
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -14
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +19 -18
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +49 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +41 -8
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +67 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +16 -7
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +7 -4
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +14 -15
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +27 -9
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/index.js +22 -8
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +3 -2
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/native-screen-container.js +12 -6
- package/lib/module/shared/components/native-screen-container.js.map +1 -1
- package/lib/module/shared/components/native-screen.js +35 -8
- package/lib/module/shared/components/native-screen.js.map +1 -1
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +56 -0
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -0
- package/lib/module/shared/components/screen-container/layers/content.js +9 -41
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +22 -13
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +6 -7
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-activation.js +11 -6
- package/lib/module/shared/providers/gestures/helpers/gesture-activation.js.map +1 -1
- package/lib/module/shared/providers/layout-anchor.provider.js +4 -6
- package/lib/module/shared/providers/layout-anchor.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +14 -7
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/stack/core.provider.js +14 -21
- package/lib/module/shared/providers/stack/core.provider.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +3 -1
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +14 -5
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js +0 -5
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +10 -0
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/types/frame-props.js +4 -0
- package/lib/module/shared/utils/bounds/types/frame-props.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/build.js +33 -26
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/resolve-screen-transition-options.js +19 -0
- package/lib/module/shared/utils/resolve-screen-transition-options.js.map +1 -0
- package/lib/typescript/blank-stack/index.d.ts +1 -1
- package/lib/typescript/blank-stack/index.d.ts.map +1 -1
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts +29 -4
- package/lib/typescript/blank-stack/navigators/create-blank-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/blank-stack/types.d.ts +33 -4
- package/lib/typescript/blank-stack/types.d.ts.map +1 -1
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts +8 -0
- package/lib/typescript/component-stack/navigators/create-component-stack-navigator.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +81 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +2 -3
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +11 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +11 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +3 -3
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +5 -3
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts +2 -4
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts +1 -0
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts +3 -0
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -0
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts +3 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +0 -1
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/helpers/gesture-activation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/layout-anchor.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/core.provider.d.ts +2 -0
- package/lib/typescript/shared/providers/stack/core.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +5 -3
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +7 -0
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +46 -22
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts +2 -2
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts +5 -0
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +4 -4
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +3 -3
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/resolve-screen-transition-options.d.ts +5 -0
- package/lib/typescript/shared/utils/resolve-screen-transition-options.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/blank-stack/index.ts +1 -0
- package/src/blank-stack/navigators/create-blank-stack-navigator.tsx +138 -19
- package/src/blank-stack/types.ts +33 -5
- package/src/component-stack/navigators/create-component-stack-navigator.tsx +8 -0
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +258 -0
- package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +7 -17
- package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +38 -28
- package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +58 -0
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +41 -10
- package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +82 -0
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +24 -12
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +11 -9
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +29 -26
- package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +26 -17
- package/src/shared/components/create-boundary-component/index.tsx +25 -6
- package/src/shared/components/create-boundary-component/types.ts +8 -4
- package/src/shared/components/create-transition-aware-component.tsx +5 -2
- package/src/shared/components/native-screen-container.tsx +11 -3
- package/src/shared/components/native-screen.tsx +65 -20
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +82 -0
- package/src/shared/components/screen-container/layers/content.tsx +11 -73
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +24 -16
- package/src/shared/providers/gestures/handlers/use-handlers.ts +8 -5
- package/src/shared/providers/gestures/helpers/gesture-activation.ts +11 -6
- package/src/shared/providers/layout-anchor.provider.tsx +2 -5
- package/src/shared/providers/register-bounds.provider.tsx +1 -1
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +24 -8
- package/src/shared/providers/stack/core.provider.tsx +27 -14
- package/src/shared/stores/animation.store.ts +11 -7
- package/src/shared/stores/bounds/internals/presence.ts +3 -1
- package/src/shared/types/animation.types.ts +7 -0
- package/src/shared/types/screen.types.ts +50 -22
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +14 -1
- package/src/shared/utils/bounds/helpers/resolve-bound-tag.ts +0 -6
- package/src/shared/utils/bounds/index.ts +16 -5
- package/src/shared/utils/bounds/types/frame-props.ts +5 -0
- package/src/shared/utils/bounds/zoom/accessor.ts +3 -3
- package/src/shared/utils/bounds/zoom/build.ts +32 -22
- package/src/shared/utils/bounds/zoom/types.ts +3 -3
- package/src/shared/utils/resolve-screen-transition-options.ts +37 -0
- package/lib/commonjs/shared/providers/viewport.provider.js +0 -33
- package/lib/commonjs/shared/providers/viewport.provider.js.map +0 -1
- package/lib/module/shared/providers/viewport.provider.js +0 -27
- package/lib/module/shared/providers/viewport.provider.js.map +0 -1
- package/lib/typescript/shared/providers/viewport.provider.d.ts +0 -13
- package/lib/typescript/shared/providers/viewport.provider.d.ts.map +0 -1
- package/src/shared/providers/viewport.provider.tsx +0 -39
|
@@ -52,42 +52,74 @@ export const NativeScreen = ({
|
|
|
52
52
|
const { activeScreensLimit, backdropBehaviors } = useManagedStackContext();
|
|
53
53
|
|
|
54
54
|
const routesLength = routes.length;
|
|
55
|
+
const topIndex = routesLength - 1;
|
|
56
|
+
const topRouteKey = routes[topIndex]?.key ?? routeKey;
|
|
55
57
|
const screenRef = useAnimatedRef<View>();
|
|
56
58
|
|
|
57
|
-
const sceneProgress = AnimationStore.getRouteAnimation(routeKey, "progress");
|
|
58
59
|
const sceneClosing = AnimationStore.getRouteAnimation(routeKey, "closing");
|
|
60
|
+
const topSceneProgress = AnimationStore.getRouteAnimation(
|
|
61
|
+
topRouteKey,
|
|
62
|
+
"progress",
|
|
63
|
+
);
|
|
64
|
+
const topSceneClosing = AnimationStore.getRouteAnimation(
|
|
65
|
+
topRouteKey,
|
|
66
|
+
"closing",
|
|
67
|
+
);
|
|
59
68
|
const screenActivity = useSharedValue<ScreenActivity>(
|
|
60
69
|
ScreenActivity.TRANSITIONING_OR_BELOW_TOP,
|
|
61
70
|
);
|
|
62
71
|
|
|
63
72
|
useDerivedValue(() => {
|
|
64
|
-
if (!
|
|
73
|
+
if (!topSceneProgress) {
|
|
65
74
|
screenActivity.set(ScreenActivity.TRANSITIONING_OR_BELOW_TOP);
|
|
66
75
|
return;
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
if (index < routesLength - activeScreensLimit - 1 || isPreloaded) {
|
|
70
79
|
screenActivity.set(ScreenActivity.INACTIVE);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const focusedIndex = optimisticFocusedIndex.value;
|
|
84
|
+
const topIsClosing =
|
|
85
|
+
topSceneClosing.get() > 0 && focusedIndex >= 0 && focusedIndex < topIndex;
|
|
86
|
+
|
|
87
|
+
if (topIsClosing) {
|
|
88
|
+
const postCloseActiveStart = Math.max(
|
|
89
|
+
0,
|
|
90
|
+
focusedIndex - activeScreensLimit + 1,
|
|
91
|
+
);
|
|
92
|
+
const next =
|
|
93
|
+
index === topIndex
|
|
74
94
|
? ScreenActivity.ON_TOP
|
|
75
|
-
: index
|
|
95
|
+
: index > focusedIndex || index >= postCloseActiveStart
|
|
76
96
|
? ScreenActivity.TRANSITIONING_OR_BELOW_TOP
|
|
77
97
|
: ScreenActivity.INACTIVE;
|
|
78
98
|
|
|
79
|
-
const v = interpolate(
|
|
80
|
-
sceneProgress.get(),
|
|
81
|
-
[0, 1 - EPSILON, 1],
|
|
82
|
-
[1, 1, outputValue],
|
|
83
|
-
Extrapolation.CLAMP,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const next = Math.trunc(v) ?? ScreenActivity.TRANSITIONING_OR_BELOW_TOP;
|
|
87
|
-
|
|
88
99
|
if (next !== screenActivity.get()) {
|
|
89
100
|
screenActivity.set(next);
|
|
90
101
|
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const outputValue =
|
|
106
|
+
index === topIndex
|
|
107
|
+
? ScreenActivity.ON_TOP
|
|
108
|
+
: index >= routesLength - activeScreensLimit
|
|
109
|
+
? ScreenActivity.TRANSITIONING_OR_BELOW_TOP
|
|
110
|
+
: ScreenActivity.INACTIVE;
|
|
111
|
+
|
|
112
|
+
const v = interpolate(
|
|
113
|
+
topSceneProgress.get(),
|
|
114
|
+
[0, 1 - EPSILON, 1],
|
|
115
|
+
[1, 1, outputValue],
|
|
116
|
+
Extrapolation.CLAMP,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const next = Math.trunc(v) ?? ScreenActivity.TRANSITIONING_OR_BELOW_TOP;
|
|
120
|
+
|
|
121
|
+
if (next !== screenActivity.get()) {
|
|
122
|
+
screenActivity.set(next);
|
|
91
123
|
}
|
|
92
124
|
});
|
|
93
125
|
|
|
@@ -126,12 +158,25 @@ export const NativeScreen = ({
|
|
|
126
158
|
};
|
|
127
159
|
});
|
|
128
160
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
if (DISABLE_NATIVE_SCREENS) {
|
|
162
|
+
return (
|
|
163
|
+
<Animated.View
|
|
164
|
+
ref={screenRef}
|
|
165
|
+
// Keep a native boundary per screen when falling back to plain views.
|
|
166
|
+
// Android release builds can otherwise flatten sibling screens together.
|
|
167
|
+
collapsable={false}
|
|
168
|
+
style={StyleSheet.absoluteFill}
|
|
169
|
+
animatedProps={animatedProps}
|
|
170
|
+
>
|
|
171
|
+
<LayoutAnchorProvider anchorRef={screenRef}>
|
|
172
|
+
{children}
|
|
173
|
+
</LayoutAnchorProvider>
|
|
174
|
+
</Animated.View>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
132
177
|
|
|
133
178
|
return (
|
|
134
|
-
<
|
|
179
|
+
<AnimatedNativeScreen
|
|
135
180
|
enabled
|
|
136
181
|
ref={screenRef}
|
|
137
182
|
style={StyleSheet.absoluteFill}
|
|
@@ -141,6 +186,6 @@ export const NativeScreen = ({
|
|
|
141
186
|
<LayoutAnchorProvider anchorRef={screenRef}>
|
|
142
187
|
{children}
|
|
143
188
|
</LayoutAnchorProvider>
|
|
144
|
-
</
|
|
189
|
+
</AnimatedNativeScreen>
|
|
145
190
|
);
|
|
146
191
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { type LayoutChangeEvent, useWindowDimensions } from "react-native";
|
|
3
|
+
import { runOnUI } from "react-native-reanimated";
|
|
4
|
+
import {
|
|
5
|
+
useDescriptorDerivations,
|
|
6
|
+
useDescriptors,
|
|
7
|
+
} from "../../../providers/screen/descriptors";
|
|
8
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
9
|
+
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
10
|
+
|
|
11
|
+
export function useContentLayout() {
|
|
12
|
+
const { current } = useDescriptors();
|
|
13
|
+
const { isFirstKey } = useDescriptorDerivations();
|
|
14
|
+
const { height: screenHeight } = useWindowDimensions();
|
|
15
|
+
const routeKey = current.route.key;
|
|
16
|
+
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
17
|
+
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
18
|
+
routeKey,
|
|
19
|
+
"autoSnapPoint",
|
|
20
|
+
);
|
|
21
|
+
const contentLayoutValue = AnimationStore.getAnimation(
|
|
22
|
+
routeKey,
|
|
23
|
+
"contentLayout",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return useCallback(
|
|
27
|
+
(event: LayoutChangeEvent) => {
|
|
28
|
+
const { width, height } = event.nativeEvent.layout;
|
|
29
|
+
if (width <= 0 || height <= 0) return;
|
|
30
|
+
|
|
31
|
+
const fraction = Math.min(height / screenHeight, 1);
|
|
32
|
+
const transitionSpec = current.options.transitionSpec;
|
|
33
|
+
|
|
34
|
+
runOnUI(
|
|
35
|
+
(
|
|
36
|
+
nextWidth: number,
|
|
37
|
+
nextHeight: number,
|
|
38
|
+
nextFraction: number,
|
|
39
|
+
isInitialScreen: boolean,
|
|
40
|
+
spec: typeof transitionSpec,
|
|
41
|
+
) => {
|
|
42
|
+
"worklet";
|
|
43
|
+
contentLayoutValue.value = {
|
|
44
|
+
width: nextWidth,
|
|
45
|
+
height: nextHeight,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const isFirstMeasurement = autoSnapPointValue.value <= 0;
|
|
49
|
+
autoSnapPointValue.value = nextFraction;
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
!isFirstMeasurement ||
|
|
53
|
+
animations.progress.value !== 0 ||
|
|
54
|
+
animations.animating.value !== 0
|
|
55
|
+
) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (isInitialScreen) {
|
|
60
|
+
animations.targetProgress.value = nextFraction;
|
|
61
|
+
animations.progress.value = nextFraction;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
animateToProgress({
|
|
66
|
+
target: nextFraction,
|
|
67
|
+
spec,
|
|
68
|
+
animations,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
)(width, height, fraction, isFirstKey, transitionSpec);
|
|
72
|
+
},
|
|
73
|
+
[
|
|
74
|
+
animations,
|
|
75
|
+
autoSnapPointValue,
|
|
76
|
+
contentLayoutValue,
|
|
77
|
+
current.options.transitionSpec,
|
|
78
|
+
isFirstKey,
|
|
79
|
+
screenHeight,
|
|
80
|
+
],
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/noNonNullAssertion: <Screen gesture is under the gesture context, so this will always exist.> */
|
|
2
|
-
import { memo
|
|
3
|
-
import {
|
|
4
|
-
type LayoutChangeEvent,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
useWindowDimensions,
|
|
7
|
-
View,
|
|
8
|
-
} from "react-native";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
9
4
|
import { GestureDetector } from "react-native-gesture-handler";
|
|
10
5
|
import Animated, {
|
|
11
|
-
runOnUI,
|
|
12
6
|
useAnimatedProps,
|
|
13
7
|
useAnimatedStyle,
|
|
14
8
|
} from "react-native-reanimated";
|
|
15
9
|
import { NO_PROPS, NO_STYLES } from "../../../constants";
|
|
16
10
|
import { useGestureContext } from "../../../providers/gestures";
|
|
17
|
-
import {
|
|
18
|
-
useDescriptorDerivations,
|
|
19
|
-
useDescriptors,
|
|
20
|
-
} from "../../../providers/screen/descriptors";
|
|
11
|
+
import { useDescriptors } from "../../../providers/screen/descriptors";
|
|
21
12
|
import { useScreenStyles } from "../../../providers/screen/styles.provider";
|
|
22
|
-
import {
|
|
23
|
-
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
13
|
+
import { resolveNavigationMaskEnabled } from "../../../utils/resolve-screen-transition-options";
|
|
24
14
|
import { useBackdropPointerEvents } from "../hooks/use-backdrop-pointer-events";
|
|
15
|
+
import { useContentLayout } from "../hooks/use-content-layout";
|
|
25
16
|
import { MaybeMaskedNavigationContainer } from "./maybe-masked-navigation-container";
|
|
26
17
|
import { SurfaceContainer } from "./surface-container";
|
|
27
18
|
|
|
@@ -32,20 +23,13 @@ type Props = {
|
|
|
32
23
|
export const ContentLayer = memo(({ children }: Props) => {
|
|
33
24
|
const { stylesMap } = useScreenStyles();
|
|
34
25
|
const { current } = useDescriptors();
|
|
35
|
-
const { isFirstKey } = useDescriptorDerivations();
|
|
36
26
|
const { pointerEvents, isBackdropActive } = useBackdropPointerEvents();
|
|
37
27
|
const gestureContext = useGestureContext();
|
|
38
|
-
const
|
|
39
|
-
const isNavigationMaskEnabled = !!current.options.maskEnabled;
|
|
28
|
+
const isNavigationMaskEnabled = resolveNavigationMaskEnabled(current.options);
|
|
40
29
|
const contentPointerEvents = isBackdropActive ? "box-none" : pointerEvents;
|
|
41
|
-
const routeKey = current.route.key;
|
|
42
|
-
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
43
|
-
const autoSnapPointValue = AnimationStore.getAnimation(
|
|
44
|
-
routeKey,
|
|
45
|
-
"autoSnapPoint",
|
|
46
|
-
);
|
|
47
30
|
const hasAutoSnapPoint =
|
|
48
31
|
current.options.snapPoints?.includes("auto") ?? false;
|
|
32
|
+
const handleContentLayout = useContentLayout();
|
|
49
33
|
|
|
50
34
|
const animatedContentStyle = useAnimatedStyle(() => {
|
|
51
35
|
"worklet";
|
|
@@ -57,55 +41,6 @@ export const ContentLayer = memo(({ children }: Props) => {
|
|
|
57
41
|
return stylesMap.value.content?.props ?? NO_PROPS;
|
|
58
42
|
});
|
|
59
43
|
|
|
60
|
-
const handleContentLayout = useCallback(
|
|
61
|
-
(event: LayoutChangeEvent) => {
|
|
62
|
-
const contentHeight = event.nativeEvent.layout.height;
|
|
63
|
-
if (contentHeight <= 0) return;
|
|
64
|
-
|
|
65
|
-
const fraction = Math.min(contentHeight / screenHeight, 1);
|
|
66
|
-
const transitionSpec = current.options.transitionSpec;
|
|
67
|
-
|
|
68
|
-
runOnUI(
|
|
69
|
-
(
|
|
70
|
-
nextFraction: number,
|
|
71
|
-
isInitialScreen: boolean,
|
|
72
|
-
spec: typeof transitionSpec,
|
|
73
|
-
) => {
|
|
74
|
-
"worklet";
|
|
75
|
-
const isFirstMeasurement = autoSnapPointValue.value <= 0;
|
|
76
|
-
autoSnapPointValue.value = nextFraction;
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
!isFirstMeasurement ||
|
|
80
|
-
animations.progress.value !== 0 ||
|
|
81
|
-
animations.animating.value !== 0
|
|
82
|
-
) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (isInitialScreen) {
|
|
87
|
-
animations.targetProgress.value = nextFraction;
|
|
88
|
-
animations.progress.value = nextFraction;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
animateToProgress({
|
|
93
|
-
target: nextFraction,
|
|
94
|
-
spec,
|
|
95
|
-
animations,
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
)(fraction, isFirstKey, transitionSpec);
|
|
99
|
-
},
|
|
100
|
-
[
|
|
101
|
-
animations,
|
|
102
|
-
autoSnapPointValue,
|
|
103
|
-
current.options.transitionSpec,
|
|
104
|
-
isFirstKey,
|
|
105
|
-
screenHeight,
|
|
106
|
-
],
|
|
107
|
-
);
|
|
108
|
-
|
|
109
44
|
return (
|
|
110
45
|
<GestureDetector gesture={gestureContext!.panGesture}>
|
|
111
46
|
<Animated.View
|
|
@@ -113,7 +48,10 @@ export const ContentLayer = memo(({ children }: Props) => {
|
|
|
113
48
|
animatedProps={animatedContentProps}
|
|
114
49
|
pointerEvents={contentPointerEvents}
|
|
115
50
|
>
|
|
116
|
-
<MaybeMaskedNavigationContainer
|
|
51
|
+
<MaybeMaskedNavigationContainer
|
|
52
|
+
pointerEvents={contentPointerEvents}
|
|
53
|
+
enabled={isNavigationMaskEnabled}
|
|
54
|
+
>
|
|
117
55
|
<SurfaceContainer pointerEvents={contentPointerEvents}>
|
|
118
56
|
{hasAutoSnapPoint ? (
|
|
119
57
|
<View collapsable={false} onLayout={handleContentLayout}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo, useEffect } from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
2
|
+
import { Platform, StyleSheet, View, type ViewProps } from "react-native";
|
|
3
3
|
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
4
|
import {
|
|
5
5
|
NAVIGATION_CONTAINER_STYLE_ID,
|
|
@@ -12,6 +12,7 @@ import { logger } from "../../../utils/logger";
|
|
|
12
12
|
type Props = {
|
|
13
13
|
enabled: boolean;
|
|
14
14
|
children: React.ReactNode;
|
|
15
|
+
pointerEvents: ViewProps["pointerEvents"];
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
let LazyMaskedView = View;
|
|
@@ -23,9 +24,10 @@ try {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
let hasWarnedMissingMaskedView = false;
|
|
27
|
+
const IS_ANDROID = Platform.OS === "android";
|
|
26
28
|
|
|
27
29
|
export const MaybeMaskedNavigationContainer = memo(
|
|
28
|
-
({ enabled, children }: Props) => {
|
|
30
|
+
({ enabled, children, pointerEvents }: Props) => {
|
|
29
31
|
const { stylesMap } = useScreenStyles();
|
|
30
32
|
const animatedNavigationContainerStyle = useAnimatedStyle(() => {
|
|
31
33
|
"worklet";
|
|
@@ -44,20 +46,28 @@ export const MaybeMaskedNavigationContainer = memo(
|
|
|
44
46
|
|
|
45
47
|
hasWarnedMissingMaskedView = true;
|
|
46
48
|
logger.warn(
|
|
47
|
-
"
|
|
49
|
+
"navigationMaskEnabled requires @react-native-masked-view/masked-view. Install it to enable navigation bounds masking.",
|
|
48
50
|
);
|
|
49
51
|
}, [enabled]);
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
const navigationContainer = (
|
|
54
|
+
<Animated.View
|
|
55
|
+
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
56
|
+
pointerEvents={pointerEvents}
|
|
57
|
+
collapsable={false}
|
|
58
|
+
renderToHardwareTextureAndroid={IS_ANDROID && !enabled}
|
|
59
|
+
needsOffscreenAlphaCompositing={IS_ANDROID && !enabled}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</Animated.View>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Navigation zoom uses the root container transform even when the mask
|
|
66
|
+
// wrapper is disabled. Only the mask element itself is optional.
|
|
67
|
+
if (!enabled) return navigationContainer;
|
|
52
68
|
|
|
53
69
|
if (LazyMaskedView === View) {
|
|
54
|
-
return
|
|
55
|
-
<Animated.View
|
|
56
|
-
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
57
|
-
>
|
|
58
|
-
{children}
|
|
59
|
-
</Animated.View>
|
|
60
|
-
);
|
|
70
|
+
return navigationContainer;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
return (
|
|
@@ -67,14 +77,12 @@ export const MaybeMaskedNavigationContainer = memo(
|
|
|
67
77
|
maskElement={
|
|
68
78
|
<Animated.View
|
|
69
79
|
style={[styles.navigationMaskElement, animatedNavigationMaskStyle]}
|
|
80
|
+
pointerEvents="none"
|
|
70
81
|
/>
|
|
71
82
|
}
|
|
83
|
+
pointerEvents={pointerEvents}
|
|
72
84
|
>
|
|
73
|
-
|
|
74
|
-
style={[styles.navigationContainer, animatedNavigationContainerStyle]}
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</Animated.View>
|
|
85
|
+
{navigationContainer}
|
|
78
86
|
</LazyMaskedView>
|
|
79
87
|
);
|
|
80
88
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
2
3
|
import type {
|
|
3
4
|
GestureStateChangeEvent,
|
|
4
5
|
GestureTouchEvent,
|
|
@@ -32,8 +33,8 @@ import type {
|
|
|
32
33
|
} from "../../../types/ownership.types";
|
|
33
34
|
import { animateToProgress } from "../../../utils/animation/animate-to-progress";
|
|
34
35
|
import type { EffectiveSnapPointsResult } from "../../../utils/gesture/validate-snap-points";
|
|
36
|
+
import { resolveSheetScrollGestureBehavior } from "../../../utils/resolve-screen-transition-options";
|
|
35
37
|
import { useDescriptors } from "../../screen/descriptors";
|
|
36
|
-
import { useViewportContext } from "../../viewport.provider";
|
|
37
38
|
import {
|
|
38
39
|
applyOffsetRules,
|
|
39
40
|
checkScrollBoundary,
|
|
@@ -99,7 +100,7 @@ interface UseScreenGestureHandlersProps {
|
|
|
99
100
|
* - No → continue
|
|
100
101
|
* 5. OFFSET THRESHOLD: Wait for sufficient touch movement
|
|
101
102
|
* 6. SCROLLVIEW CHECK: If touch is on ScrollView, is it at boundary?
|
|
102
|
-
* 7. EXPAND CHECK (snap sheets): If expanding
|
|
103
|
+
* 7. EXPAND CHECK (snap sheets): If expanding from nested scroll content, does sheetScrollGestureBehavior allow it?
|
|
103
104
|
* 8. ACTIVATE!
|
|
104
105
|
* ```
|
|
105
106
|
*
|
|
@@ -144,12 +145,14 @@ export const useHandlers = ({
|
|
|
144
145
|
gestureReleaseVelocityMax = DEFAULT_GESTURE_RELEASE_VELOCITY_MAX,
|
|
145
146
|
gestureActivationArea = DEFAULT_GESTURE_ACTIVATION_AREA,
|
|
146
147
|
gestureSnapLocked = DEFAULT_GESTURE_SNAP_LOCKED,
|
|
147
|
-
expandViaScrollView = true,
|
|
148
148
|
gestureResponseDistance,
|
|
149
149
|
transitionSpec,
|
|
150
150
|
} = current.options;
|
|
151
|
+
const sheetScrollGestureBehavior = resolveSheetScrollGestureBehavior(
|
|
152
|
+
current.options,
|
|
153
|
+
);
|
|
151
154
|
|
|
152
|
-
const
|
|
155
|
+
const dimensions = useWindowDimensions();
|
|
153
156
|
const routeKey = current.route.key;
|
|
154
157
|
const animations = AnimationStore.getRouteAnimations(routeKey);
|
|
155
158
|
const gestureAnimationValues = GestureStore.getRouteGestures(routeKey);
|
|
@@ -296,7 +299,7 @@ export const useHandlers = ({
|
|
|
296
299
|
directions.snapAxisInverted ?? false,
|
|
297
300
|
)
|
|
298
301
|
) {
|
|
299
|
-
if (
|
|
302
|
+
if (sheetScrollGestureBehavior === "collapse-only") {
|
|
300
303
|
manager.fail();
|
|
301
304
|
return;
|
|
302
305
|
}
|
|
@@ -67,6 +67,7 @@ const GESTURE_FAIL_TOLERANCE_Y = 20;
|
|
|
67
67
|
const DEFAULT_EDGE_DISTANCE_HORIZONTAL = 50;
|
|
68
68
|
const DEFAULT_EDGE_DISTANCE_VERTICAL = 135;
|
|
69
69
|
const DEFAULT_ACTIVATION_AREA = "screen" as const;
|
|
70
|
+
const SCROLL_EPILSON = 1;
|
|
70
71
|
|
|
71
72
|
export function normalizeSides(area?: GestureActivationArea): NormalizedSides {
|
|
72
73
|
"worklet";
|
|
@@ -352,6 +353,10 @@ export function checkScrollBoundary(
|
|
|
352
353
|
// Calculate max scroll values
|
|
353
354
|
const maxScrollX = Math.max(0, contentWidth - layoutWidth);
|
|
354
355
|
const maxScrollY = Math.max(0, contentHeight - layoutHeight);
|
|
356
|
+
const atTop = scrollY <= SCROLL_EPILSON;
|
|
357
|
+
const atBottom = scrollY >= maxScrollY - SCROLL_EPILSON;
|
|
358
|
+
const atLeft = scrollX <= SCROLL_EPILSON;
|
|
359
|
+
const atRight = scrollX >= maxScrollX - SCROLL_EPILSON;
|
|
355
360
|
|
|
356
361
|
// For snap point sheets (snapAxisInverted is defined), boundary depends on sheet origin
|
|
357
362
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
@@ -362,12 +367,12 @@ export function checkScrollBoundary(
|
|
|
362
367
|
if (isVerticalDirection) {
|
|
363
368
|
// Bottom sheet (not inverted): boundary at scroll top
|
|
364
369
|
// Top sheet (inverted): boundary at scroll bottom
|
|
365
|
-
return snapAxisInverted ?
|
|
370
|
+
return snapAxisInverted ? atBottom : atTop;
|
|
366
371
|
}
|
|
367
372
|
// Horizontal direction
|
|
368
373
|
// Right drawer (not inverted): boundary at scroll left
|
|
369
374
|
// Left drawer (inverted): boundary at scroll right
|
|
370
|
-
return snapAxisInverted ?
|
|
375
|
+
return snapAxisInverted ? atRight : atLeft;
|
|
371
376
|
}
|
|
372
377
|
|
|
373
378
|
// Non-sheet screens: each direction has its own boundary
|
|
@@ -375,22 +380,22 @@ export function checkScrollBoundary(
|
|
|
375
380
|
case "vertical":
|
|
376
381
|
// Swipe down - check if at top of vertical scroll
|
|
377
382
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
378
|
-
return
|
|
383
|
+
return atTop;
|
|
379
384
|
|
|
380
385
|
case "vertical-inverted":
|
|
381
386
|
// Swipe up - check if at bottom of vertical scroll
|
|
382
387
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
383
|
-
return
|
|
388
|
+
return atBottom;
|
|
384
389
|
|
|
385
390
|
case "horizontal":
|
|
386
391
|
// Swipe right - check if at left of horizontal scroll
|
|
387
392
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
388
|
-
return
|
|
393
|
+
return atLeft;
|
|
389
394
|
|
|
390
395
|
case "horizontal-inverted":
|
|
391
396
|
// Swipe left - check if at right of horizontal scroll
|
|
392
397
|
// Even if content isn't scrollable, respect bounce/overscroll state
|
|
393
|
-
return
|
|
398
|
+
return atRight;
|
|
394
399
|
|
|
395
400
|
default:
|
|
396
401
|
return true;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { type ReactNode, useCallback, useMemo } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { useWindowDimensions, type View } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
type AnimatedRef,
|
|
5
5
|
type MeasuredDimensions,
|
|
6
6
|
measure,
|
|
7
7
|
} from "react-native-reanimated";
|
|
8
8
|
import createProvider from "../utils/create-provider";
|
|
9
|
-
import { useViewportContext } from "./viewport.provider";
|
|
10
9
|
|
|
11
10
|
interface LayoutAnchorProviderProps {
|
|
12
11
|
anchorRef: AnimatedRef<View>;
|
|
@@ -48,9 +47,7 @@ const { LayoutAnchorProvider, useLayoutAnchorContext } = createProvider(
|
|
|
48
47
|
{ guarded: false },
|
|
49
48
|
)<LayoutAnchorProviderProps, LayoutAnchorContextValue>(
|
|
50
49
|
({ anchorRef, children }) => {
|
|
51
|
-
const {
|
|
52
|
-
dimensions: { width: screenWidth, height: screenHeight },
|
|
53
|
-
} = useViewportContext();
|
|
50
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
54
51
|
|
|
55
52
|
const correctMeasurement = useCallback(
|
|
56
53
|
(measured: MeasuredDimensions): MeasuredDimensions => {
|
|
@@ -207,7 +207,7 @@ const useParentSyncReaction = (params: {
|
|
|
207
207
|
const CloseRemeasureReactionEffect = (params: {
|
|
208
208
|
sharedBoundTag: string;
|
|
209
209
|
remeasureOnFocus: boolean;
|
|
210
|
-
nextClosing:
|
|
210
|
+
nextClosing: SharedValue<number>;
|
|
211
211
|
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
212
212
|
}) => {
|
|
213
213
|
const {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
2
3
|
import {
|
|
3
4
|
type DerivedValue,
|
|
4
5
|
type SharedValue,
|
|
5
6
|
useDerivedValue,
|
|
6
7
|
useSharedValue,
|
|
7
8
|
} from "react-native-reanimated";
|
|
9
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
10
|
import type { NativeStackScreenTransitionConfig } from "../../../../../native-stack/types";
|
|
9
11
|
import {
|
|
10
12
|
createScreenTransitionState,
|
|
@@ -25,7 +27,8 @@ import type { BoundsAccessor } from "../../../../types/bounds.types";
|
|
|
25
27
|
import type { ScreenTransitionConfig } from "../../../../types/screen.types";
|
|
26
28
|
import type { BaseStackRoute } from "../../../../types/stack.types";
|
|
27
29
|
import { createBoundsAccessor } from "../../../../utils/bounds";
|
|
28
|
-
import {
|
|
30
|
+
import type { BoundsFrameProps } from "../../../../utils/bounds/types/frame-props";
|
|
31
|
+
import { resolveNavigationMaskEnabled } from "../../../../utils/resolve-screen-transition-options";
|
|
29
32
|
import { type BaseDescriptor, useDescriptors } from "../../descriptors";
|
|
30
33
|
import { derivations } from "./derivations";
|
|
31
34
|
import { toPlainRoute, toPlainValue } from "./worklet";
|
|
@@ -153,7 +156,8 @@ const hasTransitionsEnabled = (
|
|
|
153
156
|
|
|
154
157
|
export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
155
158
|
const { flags, stackProgress: rootStackProgress, routeKeys } = useStack();
|
|
156
|
-
const
|
|
159
|
+
const dimensions = useWindowDimensions();
|
|
160
|
+
const insets = useSafeAreaInsets();
|
|
157
161
|
const transitionsAlwaysOn = flags.TRANSITIONS_ALWAYS_ON;
|
|
158
162
|
|
|
159
163
|
const {
|
|
@@ -192,15 +196,20 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
192
196
|
currentRouteKey ?? "_",
|
|
193
197
|
"autoSnapPoint",
|
|
194
198
|
);
|
|
199
|
+
const contentLayoutValue = AnimationStore.getAnimation(
|
|
200
|
+
currentRouteKey ?? "_",
|
|
201
|
+
"contentLayout",
|
|
202
|
+
);
|
|
195
203
|
|
|
196
204
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
197
205
|
const nextHasTransitions =
|
|
198
206
|
!!nextRouteKey &&
|
|
199
207
|
hasTransitionsEnabled(nextDescriptor?.options, transitionsAlwaysOn);
|
|
208
|
+
const currentNavigationMaskEnabled = resolveNavigationMaskEnabled(
|
|
209
|
+
currentDescriptor?.options ?? {},
|
|
210
|
+
);
|
|
200
211
|
|
|
201
|
-
const framePropsMutable = useSharedValue<
|
|
202
|
-
Omit<ScreenInterpolationProps, "bounds">
|
|
203
|
-
>({
|
|
212
|
+
const framePropsMutable = useSharedValue<BoundsFrameProps>({
|
|
204
213
|
layouts: { screen: dimensions },
|
|
205
214
|
insets,
|
|
206
215
|
previous: undefined,
|
|
@@ -209,6 +218,7 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
209
218
|
progress: 0,
|
|
210
219
|
stackProgress: 0,
|
|
211
220
|
snapIndex: -1,
|
|
221
|
+
navigationMaskEnabled: false,
|
|
212
222
|
focused: true,
|
|
213
223
|
active: DEFAULT_SCREEN_TRANSITION_STATE,
|
|
214
224
|
inactive: undefined,
|
|
@@ -261,8 +271,11 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
261
271
|
|
|
262
272
|
const snapIndex = computeSnapIndex(current.progress, resolvedSnapPoints);
|
|
263
273
|
|
|
264
|
-
const nextProps = {
|
|
265
|
-
layouts: {
|
|
274
|
+
const nextProps: Omit<ScreenInterpolationProps, "bounds"> = {
|
|
275
|
+
layouts: {
|
|
276
|
+
screen: dimensions,
|
|
277
|
+
content: contentLayoutValue.value ?? undefined,
|
|
278
|
+
},
|
|
266
279
|
insets,
|
|
267
280
|
previous,
|
|
268
281
|
current,
|
|
@@ -273,7 +286,10 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
273
286
|
...helpers,
|
|
274
287
|
};
|
|
275
288
|
|
|
276
|
-
framePropsMutable.value =
|
|
289
|
+
framePropsMutable.value = {
|
|
290
|
+
...nextProps,
|
|
291
|
+
navigationMaskEnabled: currentNavigationMaskEnabled,
|
|
292
|
+
};
|
|
277
293
|
return nextProps;
|
|
278
294
|
});
|
|
279
295
|
|