Open winghouchan opened 5 days ago
Let's continue this in your original issue in Expo Router: https://github.com/expo/expo/issues/32313#issuecomment-2437042183
Moving the convo here because there's probably not anything for Expo's team to do. Summary of the conversation so far:
pressOut
event to the Link
after it has become unmounted due to the navigation triggered on the press
event. Follow the stack trace and see this point in the source.pressIn
→ longPress
(if pressed for more than the delay) → pressOut
→ press
(if not a long press) (source). React Native Testing Library simulates the events in the following order: pressIn
→ press
| longPress
→ pressOut
(source). Fixing this would resolve this particular issue as the Link
component would no longer be unmounted due to the behaviour of unmounting being triggered on the last event.
Describe the bug
When using React Native Testing Library with Expo Router Testing Library, simulating a user press event on a
Link
triggers the following error:More details, including a hypothesis and investigation notes, can be found in the original issue opened in Expo's GitHub: expo/expo/issues/32313. I'm unsure where the responsibility of the issue lies (here versus Expo), hence opening an issue here as well.
Expected behavior
The above error does not occur. The press event simulations are successful.
Steps to Reproduce
A minimal reproducible example is available here. After cloning and installing dependencies:
npm test
.Versions