Skip to content

Commit

Permalink
adding comments to scroll to top/bottom optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Jul 6, 2022
1 parent 5b2cb47 commit 06fb1dd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
? -1
: initialNumToRenderOrDefault(this.props.initialNumToRender) - 1;
const {first, last} = this.state;
// scroll to top optimization. The first page is always rendered.
if (!this.props.inverted) {
this._pushCells(
cells,
Expand Down Expand Up @@ -1006,6 +1007,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
firstAfterInitial,
last,
);
// scroll to bottom optimization. The last page is always rendered in an inverted flatlist.
if (this.props.inverted) {
this._pushCells(
cells,
Expand Down

0 comments on commit 06fb1dd

Please sign in to comment.