Skip to content

Commit

Permalink
Add tests for Press responder event module (#15290)
Browse files Browse the repository at this point in the history
* Add Press responder event tests

Behavior being tested takes cues from React Native's Pressability.
A couple of these tests fail and require the Press implementation to be patched.
  • Loading branch information
necolas authored and trueadm committed Apr 2, 2019
1 parent 296c439 commit f243dea
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 80 deletions.
10 changes: 1 addition & 9 deletions packages/react-events/src/Press.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,14 @@ function dispatchPressStartEvents(
if ((props.onLongPress || props.onLongPressChange) && !state.isLongPressed) {
const delayLongPress = calculateDelayMS(
props.delayLongPress,
0,
10,
DEFAULT_LONG_PRESS_DELAY_MS,
);

state.longPressTimeout = setTimeout(() => {
state.isLongPressed = true;
state.longPressTimeout = null;

if (
props.onPressChange &&
props.onLongPressShouldCancelPress &&
props.onLongPressShouldCancelPress()
) {
dispatchPressChangeEvent(false);
}

if (props.onLongPress) {
const longPressEventListener = e => {
props.onLongPress(e);
Expand Down
Loading

0 comments on commit f243dea

Please sign in to comment.