Skip to content

Commit

Permalink
office-shared-comments-ui aeb76bb4
Browse files Browse the repository at this point in the history
  • Loading branch information
NickGerleman committed Dec 17, 2021
1 parent e57c818 commit b8a64f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
// Mark as high priority if we're close to the end of the last item
// But only if there are items after the last rendered item
if (last < itemCount - 1) {
if (last > 0 && last < itemCount - 1) {
const distBottom =
this._getFrameMetricsApprox(last).offset - (offset + visibleLength);
hiPri =
Expand Down Expand Up @@ -1954,7 +1954,11 @@ class VirtualizedList extends React.PureComponent<Props, State> {
// check for invalid frames due to row re-ordering
return frame;
} else {
const {getItemLayout} = this.props;
const {data, getItemCount, getItemLayout} = this.props;
invariant(
index >= 0 && index < getItemCount(data),
'Tried to get frame for out of range index ' + index,
);
invariant(
!getItemLayout,
'Should not have to estimate frames when a measurement metrics function is provided',
Expand All @@ -1977,7 +1981,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
} => {
const {data, getItem, getItemCount, getItemLayout} = this.props;
invariant(
getItemCount(data) > index,
index >= 0 && index < getItemCount(data),
'Tried to get frame for out of range index ' + index,
);
const item = getItem(data, index);
Expand Down

0 comments on commit b8a64f0

Please sign in to comment.