diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index 193484036f5..de44f303b07 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -1886,6 +1886,19 @@ class VirtualizedList extends StateSafePureComponent { const focusedCellIndex = lastFocusedCellRenderer.props.index; const itemCount = props.getItemCount(props.data); + // The last cell we rendered may be at a new index. Bail if we don't know + // where it is. + if ( + focusedCellIndex >= itemCount || + this._keyExtractor( + props.getItem(props.data, focusedCellIndex), + focusedCellIndex, + props, + ) !== this._lastFocusedCellKey + ) { + return []; + } + let first = focusedCellIndex; let heightOfCellsBeforeFocused = 0; for (