Skip to content

Commit

Permalink
Merge pull request #104 from JedWatson/dcousens-patch-1
Browse files Browse the repository at this point in the history
prevent extraneous event persistence
  • Loading branch information
dcousens authored May 8, 2017
2 parents a04fe17 + d1564f4 commit 440c370
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/TappableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ var Mixin = {
this.processEvent(event);
window._blockMouseEvents = true;
if (event.touches.length === 1) {
// SyntheticEvent objects are pooled, so persist the event so it can be referenced asynchronously
event.persist();
this._initialTouch = this._lastTouch = getTouchProps(event.touches[0]);
this.initScrollDetection();
this.initPressDetection(event, this.endTouch);
Expand Down Expand Up @@ -154,6 +152,10 @@ var Mixin = {

initPressDetection: function (event, callback) {
if (!this.props.onPress) return;

// SyntheticEvent objects are pooled, so persist the event so it can be referenced asynchronously
event.persist();

this._pressTimeout = setTimeout(function () {
this.props.onPress(event);
callback();
Expand Down

0 comments on commit 440c370

Please sign in to comment.