Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid VirtualizedList viewability updates during state updates
Summary: VirtualizedList refactoring moved [a call of `_updateViewableItems`](https://www.internalfb.com/code/fbsource/[a9d4ad3cf149][history][blame]/xplat/js/react-native-github/Libraries/Lists/VirtualizedList.js?lines=1431-1447) to the inside of a state update. This call may trigger an `onViewableItemsChanged`, which is normally not an issue (minus changing timing), but creates problems if the users callback then calls imperative methods on the VirtualizedList, since the batched state update may be in the process of changing the props/state the imperative method is reading. See #36329 for what I suspect is an example of this. This moves the `_updateViewableItems` call to before the state update, like the previous version of VirtualizedList. Changelog: [General][Fixed] - Avoid VirtualizedList viewability updates during state updates Reviewed By: javache Differential Revision: D43665606 fbshipit-source-id: 9398273c5209e371e69aafb02bac173c69874273
- Loading branch information