Please sign in to comment.
Fix and optimize VirtualizedList update triggers
Summary: - If the initial render doesn't extend past `onEndReachedThreshold` it is likely that onEndReached won't get called until scroll, which can be a bad experience if the `initialNumToRender` is very close to the viewport height. This happens because when `onContentSizeChange`, `onLayout` may not have fired yet so we don't know what the `visibleLength` is. Fix is to also call `maybeCallOnEndReached` in `_onLayout` as well. - We have an optimization that does hi-pri render window updates when scrolling quickly and the content reaches the edge of the viewport, but there is also an important case where the user has scrolled to the end of the content and is waiting for a network response. Once the new data comes in, we want to render it ASAP because the user is waiting for it. To solve this we refactor our scheduling code into a shared function that always checks if it should be a hi-pri update instead of just in `_onScroll`. Reviewed By: bvaughn Differential Revision: D4975314 fbshipit-source-id: 8d64832ecbcbdbac430a08a4018d7a32b2216a85
- Loading branch information...
Showing with 33 additions and 26 deletions.