mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08: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) => {
|
||||
const hasActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches > 0;
|
||||
if (
|
||||
// Filter out mousemove events when there hasn't been a touch yet
|
||||
(topLevelType === topMouseMove && !hasActiveTouches) ||
|
||||
// Filter out mousemove and mouseup events when a touch hasn't started yet
|
||||
((topLevelType === topMouseMove || topLevelType === topMouseUp) && !hasActiveTouches) ||
|
||||
// Filter out events from wheel/middle and right click.
|
||||
(nativeEvent.button === 1 || nativeEvent.button === 2)
|
||||
) {
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class DraggableCircle extends PureComponent {
|
||||
|
||||
_handleMoveShouldSetPanResponder = (e: Object, gestureState: Object): boolean => {
|
||||
// Should we become active when the user moves a touch over the circle?
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
_handlePanResponderGrant = (e: Object, gestureState: Object) => {
|
||||
|
||||
Reference in New Issue
Block a user