Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: press event order #1696

Merged
merged 11 commits into from
Oct 30, 2024
Merged

fix: press event order #1696

merged 11 commits into from
Oct 30, 2024

Conversation

mdjastrzebski
Copy link
Member

@mdjastrzebski mdjastrzebski commented Oct 25, 2024

Summary

Resolves: #1687

Reverses pressOut and press event order so that it matches experimental data for regular presses:

  1. pressIn,
  2. (press duration)
  3. pressOut
  4. (no waiting) press.

The previous setup matched edge case for very short (< 130ms) presses, when order was:

  1. pressIn
  2. (short press duration < 130 ms)
  3. press
  4. (wait till 130 ms - short press duration)
  5. pressOut

Scope

  • Fix event order
  • Prevent triggering events on unmounted components

See experiments: https://github.com/callstack/react-native-testing-library/wiki/Press-Events

Test plan

All tests pass

@mdjastrzebski mdjastrzebski changed the title fix: press event order fix: press event order [WIP] Oct 25, 2024
@mdjastrzebski
Copy link
Member Author

@pierrezimmermannbam I'm messing with User Event press / longPress implementation. You might want to take a look,

@winghouchan
Copy link

@mdjastrzebski: interesting observation in regards to 'short' presses. I was able to reproduce this in my own experimentation too. Do you know if this phenomenon is documented somewhere (whether that be actual documentation or a reference to source code)?

@mdjastrzebski
Copy link
Member Author

@mdjastrzebski mdjastrzebski changed the title fix: press event order [WIP] fix: press event order Oct 26, 2024
Copy link
Collaborator

@pierrezimmermannbam pierrezimmermannbam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work investigating the issue! The fix is correct but I suggested a slightly different approach

@mdjastrzebski mdjastrzebski merged commit 5de8790 into main Oct 30, 2024
8 checks passed
@mdjastrzebski mdjastrzebski deleted the fix/press-event-order branch October 30, 2024 20:19
@mdjastrzebski
Copy link
Member Author

This PR has been released in v12.8.1 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants