mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-06 03:45:18 +00:00
[fix] Pressable prevent longpress contextmenu on Windows
Long-press with a touch on a Pressable does not suppress the contextmenu on Windows. On iOS and Android, the contextmenu is triggered while the pointer is down, after a certain length of time. However, on Windows, the contextmenu is displayed after pointerup (with the same timestamp as pointerup), whether triggered by a mouse right-click or a touch long-press. Fix #2296 Close #2316
This commit is contained in:
committed by
Nicolas Gallagher
parent
07feddf300
commit
4a9bea27a8
@@ -14,5 +14,9 @@
|
|||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-native-web": "0.18.6"
|
"react-native-web": "0.18.6"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.18.6",
|
||||||
|
"@babel/preset-flow": "^7.18.6"
|
||||||
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -482,7 +482,12 @@ export default class PressResponder {
|
|||||||
event: ResponderEvent
|
event: ResponderEvent
|
||||||
): void {
|
): void {
|
||||||
if (isTerminalSignal(signal)) {
|
if (isTerminalSignal(signal)) {
|
||||||
this._isPointerTouch = false;
|
// Pressable suppression of contextmenu on windows.
|
||||||
|
// On Windows, the contextmenu is displayed after pointerup.
|
||||||
|
// https://github.com/necolas/react-native-web/issues/2296
|
||||||
|
setTimeout(() => {
|
||||||
|
this._isPointerTouch = false;
|
||||||
|
}, 0);
|
||||||
this._touchActivatePosition = null;
|
this._touchActivatePosition = null;
|
||||||
this._cancelLongPressDelayTimeout();
|
this._cancelLongPressDelayTimeout();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user