zilverline / react-tap-event-plugin

Instant TapEvents for React
http://facebook.github.io/react/
MIT License
1.07k stars 110 forks source link

shouldRejectClick fires continuously on mouse move on non-touch devices #80

Closed deepfriedbrain closed 7 years ago

deepfriedbrain commented 8 years ago

I have implemented shouldRejectClick in my code. I added couple console.log statements in it and noticed that it fires continuously as the mouse cursor is moved on non-touch devices. Is this an intended behavior? I thought it was supposed to fire only on touch tap or click.

Here's my code:

injectTapEventPlugin({
    shouldRejectClick: function (lastTouchEventTimestamp, clickEventTimestamp) {
        console.log("Inside shouldRejectClick : " + lastTouchEventTimestamp + " / " + clickEventTimestamp);
        if (lastTouchEventTimestamp && (clickEventTimestamp - lastTouchEventTimestamp) < 2000) {
            console.log("Reject click : " + (clickEventTimestamp - lastTouchEventTimestamp));
            return true;
        }
    }
});
s0meone commented 7 years ago

Thanks, this is now fixed.