fix: cancel mobile browser long press from root ref

This commit is contained in:
Neil
2026-05-30 14:32:56 -04:00
committed by GitHub
parent 608d562c8f
commit 554388b28d
+12 -3
View File
@@ -188,6 +188,17 @@ export function MobileBrowserPane({
}
}, [])
const setRootViewRef = useCallback(
(node: View | null) => {
// Why: long-press right-click timers belong to this responder surface;
// clearing from ref cleanup preserves the same unmount boundary.
if (node === null) {
clearLongPressTimer()
}
},
[clearLongPressTimer]
)
const resetBrowserZoomState = useCallback(() => {
clearLongPressTimer()
pinchRef.current = null
@@ -694,8 +705,6 @@ export function MobileBrowserPane({
[client, flushPendingWheelCommand, pageParams]
)
useEffect(() => () => clearLongPressTimer(), [clearLongPressTimer])
const mapTouchPoint = useCallback((locationX: number, locationY: number): BrowserPoint | null => {
return mapScreenToBrowserPoint(
locationX,
@@ -1017,7 +1026,7 @@ export function MobileBrowserPane({
)
return (
<View style={styles.root}>
<View ref={setRootViewRef} style={styles.root}>
<View style={styles.toolbar}>
<ToolbarIconButton
disabled={controlsDisabled || !tab.canGoBack}