Skip to content

Commit 3bf2583

Browse files
Avoid VirtualizedList viewability updates during state updates
1 parent 0f84b5b commit 3bf2583

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Libraries/Lists/VirtualizedList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ export default class VirtualizedList extends StateSafePureComponent<
613613
const onEndReachedThreshold = onEndReachedThresholdOrDefault(
614614
props.onEndReachedThreshold,
615615
);
616-
this._updateViewableItems(props, cellsAroundViewport);
617616

618617
const {contentLength, offset, visibleLength} = this._scrollMetrics;
619618
const distanceFromEnd = contentLength - visibleLength - offset;
@@ -1796,6 +1795,8 @@ export default class VirtualizedList extends StateSafePureComponent<
17961795
};
17971796

17981797
_updateCellsToRender = () => {
1798+
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
1799+
17991800
this.setState((state, props) => {
18001801
const cellsAroundViewport = this._adjustCellsAroundViewport(
18011802
props,

0 commit comments

Comments
 (0)