mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 09:44:21 +00:00
[fix] ResponderEventPlugin skips 'mouseup' when no touch is active
Prevent the responder system recording 'mouseup' events if there is no active 'touch'. Fix #816
This commit is contained in:
@@ -43,8 +43,8 @@ const originalExtractEvents = ResponderEventPlugin.extractEvents;
|
|||||||
ResponderEventPlugin.extractEvents = (topLevelType, targetInst, nativeEvent, nativeEventTarget) => {
|
ResponderEventPlugin.extractEvents = (topLevelType, targetInst, nativeEvent, nativeEventTarget) => {
|
||||||
const hasActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches > 0;
|
const hasActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches > 0;
|
||||||
if (
|
if (
|
||||||
// Filter out mousemove events when there hasn't been a touch yet
|
// Filter out mousemove and mouseup events when a touch hasn't started yet
|
||||||
(topLevelType === topMouseMove && !hasActiveTouches) ||
|
((topLevelType === topMouseMove || topLevelType === topMouseUp) && !hasActiveTouches) ||
|
||||||
// Filter out events from wheel/middle and right click.
|
// Filter out events from wheel/middle and right click.
|
||||||
(nativeEvent.button === 1 || nativeEvent.button === 2)
|
(nativeEvent.button === 1 || nativeEvent.button === 2)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default class DraggableCircle extends PureComponent {
|
|||||||
|
|
||||||
_handleMoveShouldSetPanResponder = (e: Object, gestureState: Object): boolean => {
|
_handleMoveShouldSetPanResponder = (e: Object, gestureState: Object): boolean => {
|
||||||
// Should we become active when the user moves a touch over the circle?
|
// Should we become active when the user moves a touch over the circle?
|
||||||
return false;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
_handlePanResponderGrant = (e: Object, gestureState: Object) => {
|
_handlePanResponderGrant = (e: Object, gestureState: Object) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user