Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 1 addition & 6 deletions src/TapEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ var isTouch = function(topLevelType) {
return touchTypes.indexOf(topLevelType) >= 0;
}

/**
* Number of pixels that are tolerated in between a `touchStart` and `touchEnd`
* in order to still be considered a 'tap' event.
*/
var tapMoveThreshold = 10;
var ignoreMouseThreshold = 750;
var startCoords = {x: null, y: null};
var lastTouchEvent = null;
Expand Down Expand Up @@ -109,7 +104,7 @@ var now = (function() {
}
})();

function createTapEventPlugin(shouldRejectClick) {
function createTapEventPlugin(shouldRejectClick, tapMoveThreshold) {
return {

tapMoveThreshold: tapMoveThreshold,
Expand Down
8 changes: 7 additions & 1 deletion src/injectTapEventPlugin.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
var invariant = require('fbjs/lib/invariant');
var defaultClickRejectionStrategy = require('./defaultClickRejectionStrategy');
/**
* Number of pixels that are tolerated in between a `touchStart` and `touchEnd`
* in order to still be considered a 'tap' event.
*/
var defaultTapMoveThreshold = 10;

var alreadyInjected = false;

module.exports = function injectTapEventPlugin (strategyOverrides) {
strategyOverrides = strategyOverrides || {}
var shouldRejectClick = strategyOverrides.shouldRejectClick || defaultClickRejectionStrategy;
var tapMoveThreshold = strategyOverrides.tapMoveThreshold || defaultTapMoveThreshold;

if (process.env.NODE_ENV !== 'production') {
invariant(
Expand All @@ -21,6 +27,6 @@ should be injected by the application.'
alreadyInjected = true;

require('react-dom/lib/EventPluginHub').injection.injectEventPluginsByName({
'TapEventPlugin': require('./TapEventPlugin.js')(shouldRejectClick)
'TapEventPlugin': require('./TapEventPlugin.js')(shouldRejectClick, tapMoveThreshold)
});
};