mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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 https://github.com/facebook/react-native/issues/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