Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to disable fastclick #55

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Moved if Math.abs(downX - upX) > MOVE_THRESHOLD;
var MOVE_THRESHOLD = 8;
var TOUCH_DELAY = 1000;
var ignoreClass = 'no-fastclick'; // don't apply fastclick to elements with this class

var touchKeysToStore = [
'clientX',
Expand Down Expand Up @@ -231,8 +232,13 @@
if (type && typeof type === 'string' && (
(props && typeof props.onClick === 'function') || handleType[type]
)) {
// Add our own events to props
args[1] = propsWithFastclickEvents(type, props || {});
// check we have not disabled fastclick for this item
var classes = new Set(props.className && props.className.split(" "));

if (!classes.has(ignoreClass)) {
// Add our own events to props
args[1] = propsWithFastclickEvents(type, props || {});
}
}

// Apply args to original createElement function
Expand Down