-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pressability: Fix Missing
onLongPress
Gestures
Summary: The current implementation of `Pressability` has a bug related to `onLongPress`. When a user starts a press gesture, we keep track of the activation position (occurs after waiting `delayPressIn` milliseconds). If the touch moves away from that position by more than 10dp, we rule out the long press gesture. This means no matter how long you hold down the press, even if you move it back to within 10dp, we will not fire `onLongPress`. However, there is currently a bug where we never reset the cached activation position. This means that after the first press gesture, all subsequent long press gestures must start within 10dp of that first press gesture. This leads to seemingly intermittent missing long press gestures. This fixes the bug by ensuring that whenever a press gestures is terminated (either via a cancel or release), we reset the activation position. Changelog: [General][Fixed] - Fixed Pressability to properly fire `onLongPress`. Reviewed By: TheSavior Differential Revision: D20410075 fbshipit-source-id: e4727b7a9585ce3ea39481fc13e56b6b91740c8c
- Loading branch information
1 parent
147f0f2
commit 5ca1d8f
Showing
2 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters