diff --git a/Libraries/Lists/VirtualizeUtils.js b/Libraries/Lists/VirtualizeUtils.js index 3936bf6f6491e9..3a70d9f683091e 100644 --- a/Libraries/Lists/VirtualizeUtils.js +++ b/Libraries/Lists/VirtualizeUtils.js @@ -128,7 +128,7 @@ export function computeWindowedRenderLimits( } { const itemCount = props.getItemCount(props.data); if (itemCount === 0) { - return prev; + return {first: 0, last: -1}; } const {offset, velocity, visibleLength, zoomScale = 1} = scrollMetrics; diff --git a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js index 4641ec0b0860d1..ebe059a01bd14f 100644 --- a/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js +++ b/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js @@ -641,7 +641,9 @@ class VirtualizedList extends StateSafePureComponent { !this._scrollMetrics.offset && Math.abs(distanceFromEnd) >= Number.EPSILON ) { - return cellsAroundViewport; + return cellsAroundViewport.last >= getItemCount(data) + ? VirtualizedList._constrainToItemCount(cellsAroundViewport, props) + : cellsAroundViewport; } newCellsAroundViewport = computeWindowedRenderLimits(