-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[ScrollView] Incorrect event coalescing causes onChangeVisibleRows to fail #1782
Comments
The `ScrollView` sends important `updatedChildFrames` data to the `ListView` to be able to implement `onChangeVisibleRows` method. Coalescing operates very strongly on older devices like the iPhone 4s where this data is then lost. Fixes facebook#1782.
The `ScrollView` sends important `updatedChildFrames` data to the `ListView` to be able to implement `onChangeVisibleRows` method. Coalescing operates very strongly on older devices like the iPhone 4s where this data is then lost. Fixes facebook#1782.
@paramaggarwal how does the event fail ? Possibly related issue here : the I haven't been able to find a strict test case for this, but it seems to happen after rendering some rows, when scrolling rapidly. Applying the fix from #1783 does not solve the issue for me. |
@VonD The problem you are seeing where If you are still facing the problem - maybe there are some other places also where this data is lost. Try debugging it! :) |
The `ScrollView` sends important `updatedChildFrames` data to the `ListView` to be able to implement `onChangeVisibleRows` method. Coalescing operates very strongly on older devices like the iPhone 4s where this data is then lost. Fixes facebook#1782.
Summary: The `ScrollView` sends important `updatedChildFrames` data to the `ListView` to be able to implement `onChangeVisibleRows` method. Coalescing operates very strongly on older devices like the iPhone 4s where this data is then lost. Fixes facebook#1782. `ListView` has a method called `onChangeVisibleRows` that is called whenever the rows visible on screen change. This method is critical to be able to implement deletion/creation of views and hence be conservative in memory usage. I have an infinite scrolling view which uses this method to only render the full rows for what is visible on screen and put placeholders for everything else. In the `RCTEventDispatcher`, we [coalesce events](https://github.com/facebook/react-native/blob/522fd33d6f3c8fb339b0dde35b05df34c1233306/React/Base/RCTEventDispatcher.m#L135-L152) that are meant to be sent across the bridge. They are [dequeued](https://github.com/facebook/react-native/blob/522fd33d6f3c8fb339b0dde35b05df34c1233306/React/Base/RCTEventDispatcher.m#L180-L188) on each Closes facebook#1783 Github Author: Param Aggarwal <paramaggarwal@gmail.com>
Performance sensitive issue - shows on iPhone 4s.
ListView
has a method calledonChangeVisibleRows
that is called whenever the rows visible on screen change. This method is critical to be able to implement deletion/creation of views and hence be conservative in memory usage. I have an infinite scrolling view which uses this method to only render the full rows for what is visible on screen and put placeholders for everything else.In the
RCTEventDispatcher
, we coalesce events that are meant to be sent across the bridge. They are dequeued on each and everyRCTFrameUpdate
.But when we coalesce the events for
RCTScrollView
, we are only picking the latest event. This means that theupdatedChildFrames
generated here are lost and theListView
in JS, does not know about the new frames of the rows - and hence cannot correctly calculate theonChangeVisibleRows
changes.To test my theory, I turned off coalescing in code and JS receives all the events. Hence, the coalescing method needs to take into account the
childUpdatedFrames
object from previous events here:Currently, it is blindly picking up the latest event. It should instead do a merge of the events taking care of
childUpdatedFrames
. I'll raise a PR with the change soon, till then looking for thoughts and comments.The text was updated successfully, but these errors were encountered: