Skip to content

Commit 2c600b7

Browse files
yungstersfacebook-github-bot
authored andcommitted
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
1 parent c8d678a commit 2c600b7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Libraries/Pressability/Pressability.js

+3
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ export default class Pressability {
573573
this._config.delayHoverIn,
574574
);
575575
if (delayHoverIn > 0) {
576+
event.persist();
576577
this._hoverInDelayTimeout = setTimeout(() => {
577578
onHoverIn(event);
578579
}, delayHoverIn);
@@ -593,6 +594,7 @@ export default class Pressability {
593594
this._config.delayHoverOut,
594595
);
595596
if (delayHoverOut > 0) {
597+
event.persist();
596598
this._hoverInDelayTimeout = setTimeout(() => {
597599
onHoverOut(event);
598600
}, delayHoverOut);
@@ -729,6 +731,7 @@ export default class Pressability {
729731
normalizeDelay(this._config.delayPressOut),
730732
);
731733
if (delayPressOut > 0) {
734+
event.persist();
732735
this._pressOutDelayTimeout = setTimeout(() => {
733736
onPressOut(event);
734737
}, delayPressOut);

0 commit comments

Comments
 (0)