Files
paseo/patches/@gorhom+bottom-sheet+5.2.14.patch
T
Mohamed Boudra 2e4dab0556 fix(app): preserve Android Usage drag order and sheet gestures (#9748)
On Android, a slow drag on a Usage card handle moved the sheet instead of the
card. A drop in the same slot left the sheet ignoring body swipes. A drop in a
new slot painted the original order for one or two frames.

The sheet gesture now registers a content drag as both a failure requirement
and a simultaneous relation, and the Gorhom patch spreads relation arrays into
RNGH, so the waiting sheet recognizer no longer cancels the card drag.

The old-order frames came from the list clearing its drag state before the
reordered data arrived. The sheet portal forwards changed children from an
effect, so the list committed old data with fresh transform hosts and a cleared
active key, and the new data about 200 ms later. The draggable-flatlist patch
now renews moved hosts and clears the active key in the render that receives
the reordered data. A same-slot drop resets explicitly because its data does
not change. Every native list that uses the patch gets the drop change.

Repro tooling for both device checks is in packages/app/e2e/mobile/usage-drag.
2026-11-15 20:34:07 +07:00

345 lines
20 KiB
Diff

diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js
index f3d8f55..72d4322 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetDraggableView/BottomSheetDraggableView.js
@@ -55,10 +55,10 @@ const BottomSheetDraggableViewComponent = ({
const draggableGesture = (0, _react.useMemo)(() => {
let gesture = _reactNativeGestureHandler.Gesture.Pan().enabled(enableContentPanningGesture).shouldCancelWhenOutside(false).runOnJS(false).onStart(contentPanGestureHandler.handleOnStart).onChange(contentPanGestureHandler.handleOnChange).onEnd(contentPanGestureHandler.handleOnEnd).onFinalize(contentPanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
- gesture = gesture.simultaneousWithExternalGesture(simultaneousHandlers);
+ gesture = gesture.simultaneousWithExternalGesture(...simultaneousHandlers);
}
if (activeOffsetX) {
gesture = gesture.activeOffsetX(activeOffsetX);
diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js
index ee9e898..1500886 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetHandle/BottomSheetHandleContainer.js
@@ -59,10 +59,10 @@ function BottomSheetHandleContainerComponent({
const panGesture = (0, _react.useMemo)(() => {
let gesture = _reactNativeGestureHandler.Gesture.Pan().enabled(enableHandlePanningGesture).shouldCancelWhenOutside(false).runOnJS(false).onStart(handlePanGestureHandler.handleOnStart).onChange(handlePanGestureHandler.handleOnChange).onEnd(handlePanGestureHandler.handleOnEnd).onFinalize(handlePanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
- gesture = gesture.simultaneousWithExternalGesture(simultaneousHandlers);
+ gesture = gesture.simultaneousWithExternalGesture(...simultaneousHandlers);
}
if (activeOffsetX) {
gesture = gesture.activeOffsetX(activeOffsetX);
diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js
index ee51e76..5fe8f75 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/components/bottomSheetModal/BottomSheetModal.js
@@ -272,6 +272,9 @@ function BottomSheetModalComponent(props, ref) {
});
}
if (statusRef.current === _constants.MODAL_STATUS.INITIAL) {
+ if (mountRef.current) {
+ unmount();
+ }
return;
}
@@ -315,7 +318,9 @@ function BottomSheetModalComponent(props, ref) {
}
currentIndexRef.current = _index;
nextIndexRef.current = null;
- statusRef.current = _index === -1 ? _constants.MODAL_STATUS.MINIMIZED : _constants.MODAL_STATUS.PRESENTED;
+ if (!(_index === -1 && statusRef.current === _constants.MODAL_STATUS.DISMISSING)) {
+ statusRef.current = _index === -1 ? _constants.MODAL_STATUS.MINIMIZED : _constants.MODAL_STATUS.PRESENTED;
+ }
if (_providedOnChange) {
_providedOnChange(_index, _position, _type);
}
diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/useAnimatedLayout.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/useAnimatedLayout.js
index 973d05c..b484b5f 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/useAnimatedLayout.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/useAnimatedLayout.js
@@ -86,7 +86,7 @@ function useAnimatedLayout(containerLayoutState, topInset, bottomInset, modal, s
});
}, [state, verticalInset, modal]);
(0, _react.useEffect)(() => {
- _reactNative.Dimensions.addEventListener('change', ({
+ const subscription = _reactNative.Dimensions.addEventListener('change', ({
window
}) => {
state.modify(_state => {
@@ -96,6 +96,7 @@ function useAnimatedLayout(containerLayoutState, topInset, bottomInset, modal, s
return _state;
});
});
+ return () => subscription.remove();
}, [state]);
//#endregion
diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/index.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/index.js
index e44ad86..96555ef 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/index.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/index.js
@@ -15,6 +15,7 @@ var _exportNames = {
useBottomSheetTimingConfigs: true,
useBottomSheetInternal: true,
useBottomSheetModalInternal: true,
+ BottomSheetModalInternalProvider: true,
useScrollEventsHandlersDefault: true,
useGestureEventsHandlersDefault: true,
useBottomSheetGestureHandlers: true,
@@ -220,6 +221,13 @@ var _useBottomSheetSpringConfigs = require("./hooks/useBottomSheetSpringConfigs"
var _useBottomSheetTimingConfigs = require("./hooks/useBottomSheetTimingConfigs");
var _useBottomSheetInternal = require("./hooks/useBottomSheetInternal");
var _useBottomSheetModalInternal = require("./hooks/useBottomSheetModalInternal");
+var _modalInternal = require("./contexts/modal/internal");
+Object.defineProperty(exports, "BottomSheetModalInternalProvider", {
+ enumerable: true,
+ get: function () {
+ return _modalInternal.BottomSheetModalInternalProvider;
+ }
+});
var _useScrollEventsHandlersDefault = require("./hooks/useScrollEventsHandlersDefault");
var _useGestureEventsHandlersDefault = require("./hooks/useGestureEventsHandlersDefault");
var _useBottomSheetGestureHandlers = require("./hooks/useBottomSheetGestureHandlers");
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js
index 9efadd2..942b78a 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetDraggableView/BottomSheetDraggableView.js
@@ -49,10 +49,10 @@ const BottomSheetDraggableViewComponent = ({
const draggableGesture = useMemo(() => {
let gesture = Gesture.Pan().enabled(enableContentPanningGesture).shouldCancelWhenOutside(false).runOnJS(false).onStart(contentPanGestureHandler.handleOnStart).onChange(contentPanGestureHandler.handleOnChange).onEnd(contentPanGestureHandler.handleOnEnd).onFinalize(contentPanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
- gesture = gesture.simultaneousWithExternalGesture(simultaneousHandlers);
+ gesture = gesture.simultaneousWithExternalGesture(...simultaneousHandlers);
}
if (activeOffsetX) {
gesture = gesture.activeOffsetX(activeOffsetX);
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js
index 3d1eafe..bf8e366 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetHandle/BottomSheetHandleContainer.js
@@ -53,10 +53,10 @@ function BottomSheetHandleContainerComponent({
const panGesture = useMemo(() => {
let gesture = Gesture.Pan().enabled(enableHandlePanningGesture).shouldCancelWhenOutside(false).runOnJS(false).onStart(handlePanGestureHandler.handleOnStart).onChange(handlePanGestureHandler.handleOnChange).onEnd(handlePanGestureHandler.handleOnEnd).onFinalize(handlePanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
- gesture = gesture.simultaneousWithExternalGesture(simultaneousHandlers);
+ gesture = gesture.simultaneousWithExternalGesture(...simultaneousHandlers);
}
if (activeOffsetX) {
gesture = gesture.activeOffsetX(activeOffsetX);
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetModal/BottomSheetModal.js b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetModal/BottomSheetModal.js
index 94fabdb..d870aa7 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetModal/BottomSheetModal.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/components/bottomSheetModal/BottomSheetModal.js
@@ -265,6 +265,9 @@ function BottomSheetModalComponent(props, ref) {
});
}
if (statusRef.current === MODAL_STATUS.INITIAL) {
+ if (mountRef.current) {
+ unmount();
+ }
return;
}
@@ -308,7 +311,9 @@ function BottomSheetModalComponent(props, ref) {
}
currentIndexRef.current = _index;
nextIndexRef.current = null;
- statusRef.current = _index === -1 ? MODAL_STATUS.MINIMIZED : MODAL_STATUS.PRESENTED;
+ if (!(_index === -1 && statusRef.current === MODAL_STATUS.DISMISSING)) {
+ statusRef.current = _index === -1 ? MODAL_STATUS.MINIMIZED : MODAL_STATUS.PRESENTED;
+ }
if (_providedOnChange) {
_providedOnChange(_index, _position, _type);
}
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/hooks/useAnimatedLayout.js b/node_modules/@gorhom/bottom-sheet/lib/module/hooks/useAnimatedLayout.js
index b0eec93..67713a2 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/hooks/useAnimatedLayout.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/hooks/useAnimatedLayout.js
@@ -82,7 +82,7 @@ export function useAnimatedLayout(containerLayoutState, topInset, bottomInset, m
});
}, [state, verticalInset, modal]);
useEffect(() => {
- Dimensions.addEventListener('change', ({
+ const subscription = Dimensions.addEventListener('change', ({
window
}) => {
state.modify(_state => {
@@ -92,6 +92,7 @@ export function useAnimatedLayout(containerLayoutState, topInset, bottomInset, m
return _state;
});
});
+ return () => subscription.remove();
}, [state]);
//#endregion
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/index.js b/node_modules/@gorhom/bottom-sheet/lib/module/index.js
index 8259637..eb057fe 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/index.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/index.js
@@ -14,6 +14,7 @@ export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs
export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';
export { useBottomSheetInternal } from './hooks/useBottomSheetInternal';
export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';
+export { BottomSheetModalInternalProvider } from './contexts/modal/internal';
export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';
export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';
export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';
diff --git a/node_modules/@gorhom/bottom-sheet/lib/typescript/components/bottomSheet/types.d.ts b/node_modules/@gorhom/bottom-sheet/lib/typescript/components/bottomSheet/types.d.ts
index 6b23056..8d92aae 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/typescript/components/bottomSheet/types.d.ts
+++ b/node_modules/@gorhom/bottom-sheet/lib/typescript/components/bottomSheet/types.d.ts
@@ -353,6 +353,6 @@ export type BottomSheetGestureProps = {
simultaneousHandlers: Parameters<
PanGesture['simultaneousWithExternalGesture']
- >[0];
- waitFor: Parameters<PanGesture['requireExternalGestureToFail']>[0];
+ >[0] | Parameters<PanGesture['simultaneousWithExternalGesture']>;
+ waitFor: Parameters<PanGesture['requireExternalGestureToFail']>[0] | Parameters<PanGesture['requireExternalGestureToFail']>;
};
diff --git a/node_modules/@gorhom/bottom-sheet/lib/typescript/index.d.ts b/node_modules/@gorhom/bottom-sheet/lib/typescript/index.d.ts
index ffc6caa..550f1b3 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/typescript/index.d.ts
+++ b/node_modules/@gorhom/bottom-sheet/lib/typescript/index.d.ts
@@ -7,6 +7,8 @@ export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs
export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';
export { useBottomSheetInternal } from './hooks/useBottomSheetInternal';
export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';
+export { BottomSheetModalInternalProvider } from './contexts/modal/internal';
+export type { BottomSheetModalInternalContextType } from './contexts/modal/internal';
export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';
export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';
export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/types.d.ts b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/types.d.ts
index 6b23056..8d92aae 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/types.d.ts
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/types.d.ts
@@ -353,6 +353,6 @@ export type BottomSheetGestureProps = {
simultaneousHandlers: Parameters<
PanGesture['simultaneousWithExternalGesture']
- >[0];
- waitFor: Parameters<PanGesture['requireExternalGestureToFail']>[0];
+ >[0] | Parameters<PanGesture['simultaneousWithExternalGesture']>;
+ waitFor: Parameters<PanGesture['requireExternalGestureToFail']>[0] | Parameters<PanGesture['requireExternalGestureToFail']>;
};
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx
index 923e430..eeef8cf 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetDraggableView/BottomSheetDraggableView.tsx
@@ -65,12 +65,12 @@ const BottomSheetDraggableViewComponent = ({
.onFinalize(contentPanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
gesture = gesture.simultaneousWithExternalGesture(
- simultaneousHandlers as never
+ ...(simultaneousHandlers as Parameters<typeof gesture.simultaneousWithExternalGesture>)
);
}
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx
index 0223843..4ca56e5 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetHandle/BottomSheetHandleContainer.tsx
@@ -67,12 +67,12 @@ function BottomSheetHandleContainerComponent({
.onFinalize(handlePanGestureHandler.handleOnFinalize);
if (waitFor) {
- gesture = gesture.requireExternalGestureToFail(waitFor);
+ gesture = gesture.requireExternalGestureToFail(...(Array.isArray(waitFor) ? waitFor : [waitFor]));
}
if (simultaneousHandlers) {
gesture = gesture.simultaneousWithExternalGesture(
- simultaneousHandlers as never
+ ...(simultaneousHandlers as Parameters<typeof gesture.simultaneousWithExternalGesture>)
);
}
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
index 2954b3f..936300b 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
@@ -373,7 +373,13 @@ function BottomSheetModalComponent<T = never>(
});
}
+ // A modal that unmounts after presenting but before its first animation is still INITIAL;
+ // returning would leave its portal on the host, sliding open with nothing to close it.
+ // An INITIAL status with nothing mounted is this callback running after `unmount()`.
if (statusRef.current === MODAL_STATUS.INITIAL) {
+ if (mountRef.current) {
+ unmount();
+ }
return;
}
@@ -432,8 +438,15 @@ function BottomSheetModalComponent<T = never>(
currentIndexRef.current = _index;
nextIndexRef.current = null;
- statusRef.current =
- _index === -1 ? MODAL_STATUS.MINIMIZED : MODAL_STATUS.PRESENTED;
+ // A sheet that is dismissing (dismiss(), or unmounting while presented) keeps that status,
+ // so `onClose` lands on DISMISSED and unmounts it; MINIMIZED would read as a user close,
+ // which with `enableDismissOnClose=false` leaves the portal mounted forever.
+ if (_index === -1 && statusRef.current === MODAL_STATUS.DISMISSING) {
+ // keep dismissing
+ } else {
+ statusRef.current =
+ _index === -1 ? MODAL_STATUS.MINIMIZED : MODAL_STATUS.PRESENTED;
+ }
if (_providedOnChange) {
_providedOnChange(_index, _position, _type);
diff --git a/node_modules/@gorhom/bottom-sheet/src/hooks/useAnimatedLayout.ts b/node_modules/@gorhom/bottom-sheet/src/hooks/useAnimatedLayout.ts
index 68c674d..564833c 100644
--- a/node_modules/@gorhom/bottom-sheet/src/hooks/useAnimatedLayout.ts
+++ b/node_modules/@gorhom/bottom-sheet/src/hooks/useAnimatedLayout.ts
@@ -106,13 +106,14 @@ export function useAnimatedLayout(
[state, verticalInset, modal]
);
useEffect(() => {
- Dimensions.addEventListener('change', ({ window }) => {
+ const subscription = Dimensions.addEventListener('change', ({ window }) => {
state.modify(_state => {
'worklet';
_state.window = window;
return _state;
});
});
+ return () => subscription.remove();
}, [state]);
//#endregion
diff --git a/node_modules/@gorhom/bottom-sheet/src/index.ts b/node_modules/@gorhom/bottom-sheet/src/index.ts
index 7aaea57..6a5f5a4 100644
--- a/node_modules/@gorhom/bottom-sheet/src/index.ts
+++ b/node_modules/@gorhom/bottom-sheet/src/index.ts
@@ -12,6 +12,8 @@ export { useBottomSheetSpringConfigs } from './hooks/useBottomSheetSpringConfigs
export { useBottomSheetTimingConfigs } from './hooks/useBottomSheetTimingConfigs';
export { useBottomSheetInternal } from './hooks/useBottomSheetInternal';
export { useBottomSheetModalInternal } from './hooks/useBottomSheetModalInternal';
+export { BottomSheetModalInternalProvider } from './contexts/modal/internal';
+export type { BottomSheetModalInternalContextType } from './contexts/modal/internal';
export { useScrollEventsHandlersDefault } from './hooks/useScrollEventsHandlersDefault';
export { useGestureEventsHandlersDefault } from './hooks/useGestureEventsHandlersDefault';
export { useBottomSheetGestureHandlers } from './hooks/useBottomSheetGestureHandlers';