Skip to content
Open
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
11 changes: 5 additions & 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,9 +104,13 @@ var now = (function() {
}
})();

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

/**
* Number of pixels that are tolerated in between a `touchStart` and `touchEnd`
* in order to still be considered a 'tap' event.
*/
tapMoveThreshold: tapMoveThreshold,

ignoreMouseThreshold: ignoreMouseThreshold,
Expand Down
5 changes: 3 additions & 2 deletions src/injectTapEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var defaultClickRejectionStrategy = require('./defaultClickRejectionStrategy');

var alreadyInjected = false;

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

Expand All @@ -19,8 +19,9 @@ should be injected by the application.'
}

alreadyInjected = true;
tapMoveThreshold = tapMoveThreshold || 10;

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