-
Notifications
You must be signed in to change notification settings - Fork 273
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
fireEvent.scroll
doesn't update the FlatList's render window on React Native 0.73
#1540
Comments
fireEvent.scroll
doesn't update the FlatList's render window on React Native 0.73
@j-piasecki Hmmm, I'm quite surprised to learn that Fire Event API is very simple and works by finding a matching event handler (here: Fire Event API is not intended for RN env simulation, for that purpose, we have created the User Event API. Take a look at the |
That's exactly what's been happening.
Thanks! I'll look into that more.
It's possible that |
I've looked into this more, and it seems like
At this point, I'm not sure whether it should be handled by the library or by the users on a case-by-case basis, since it's necessary only for VirtualizedLists and the documentation clearly states that it focuses on the host |
@j-piasecki we could extend |
That would be great! This change alone should make it work with |
Here's how we could implement this:
await userEvent.scrollTo(flatlist, {
y: 480,
contentSize: { height: 480, width: 240 },
layoutMeasurement: { height: 480, width: 240 },
});
Both values seem to be stable for the duration of user interaction, so we just forward them. If User Event lacks certain event in the sequence, the we could as them. @j-piasecki Would you be able to submit a PR for that? |
Sorry for the delay, the PR is up |
Describe the bug
Since facebook/react-native#38529 React Native's
VirtualizedList
doesn't update itscontentLength
when handling thescroll
event. This means that usingfireEvent.scroll(...)
is not enough to render items outside theinitialNumToRender
- invokingonContentSizeChange
is also necessary.Expected behavior
Steps to Reproduce
Try the following snippet on RN 0.72 and 0.73. Without the commented-out line, the test will be failing on 73 but not on 72.
Screenshots
Versions
The text was updated successfully, but these errors were encountered: