From d1564f4bd8e139709471bab30ab3bbf097c760cd Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 8 May 2017 11:17:23 +1000 Subject: [PATCH] prevent unnecessarily event persistence --- src/TappableMixin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TappableMixin.js b/src/TappableMixin.js index 2ffff35..71adb8c 100644 --- a/src/TappableMixin.js +++ b/src/TappableMixin.js @@ -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); @@ -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();