From 2c600b7c5a0e79bfc632b39b471e6ba774d7b0b3 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Tue, 19 May 2020 22:39:35 -0700 Subject: [PATCH] RN: Persist Asynchronously Consumed Events in Pressability Summary: There are a few places in `Pressability` where we asynchronously consume the `event` object. Most places do not encounter any problems because the actual properties on `event` are seldom used. Nonetheless, we should fix these gaps. Changelog: [General][Fixed] - Fix invalid `event` objects from `onPressOut` in certain cases Reviewed By: rickhanlonii Differential Revision: D21657126 fbshipit-source-id: e28d825b85d25602427beaf0bd603d22eaa5960a --- Libraries/Pressability/Pressability.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/Pressability/Pressability.js b/Libraries/Pressability/Pressability.js index 6c1ec97e77b61b..70e12bee3e1189 100644 --- a/Libraries/Pressability/Pressability.js +++ b/Libraries/Pressability/Pressability.js @@ -573,6 +573,7 @@ export default class Pressability { this._config.delayHoverIn, ); if (delayHoverIn > 0) { + event.persist(); this._hoverInDelayTimeout = setTimeout(() => { onHoverIn(event); }, delayHoverIn); @@ -593,6 +594,7 @@ export default class Pressability { this._config.delayHoverOut, ); if (delayHoverOut > 0) { + event.persist(); this._hoverInDelayTimeout = setTimeout(() => { onHoverOut(event); }, delayHoverOut); @@ -729,6 +731,7 @@ export default class Pressability { normalizeDelay(this._config.delayPressOut), ); if (delayPressOut > 0) { + event.persist(); this._pressOutDelayTimeout = setTimeout(() => { onPressOut(event); }, delayPressOut);