Skip to content

Commit

Permalink
Merge pull request #87 from AndrewSouthpaw/patch-1
Browse files Browse the repository at this point in the history
Fix nulled event in onPress callback.
  • Loading branch information
dcousens authored May 8, 2017
2 parents 6ed5e9f + 30bcc1a commit a04fe17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/TappableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ 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 @@ -347,4 +349,4 @@ var Mixin = {
}
};

module.exports = Mixin;
module.exports = Mixin;
2 changes: 2 additions & 0 deletions src/TappableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ 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

0 comments on commit a04fe17

Please sign in to comment.