From 06fb1dd587b03556650086c1d6e4012de9315622 Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Wed, 6 Jul 2022 13:06:53 +0800 Subject: [PATCH] adding comments to scroll to top/bottom optimization --- Libraries/Lists/VirtualizedList.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index dafd1d226203bd..e2abd1a1738607 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -944,6 +944,7 @@ class VirtualizedList extends React.PureComponent { ? -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, @@ -1006,6 +1007,7 @@ class VirtualizedList extends React.PureComponent { firstAfterInitial, last, ); + // scroll to bottom optimization. The last page is always rendered in an inverted flatlist. if (this.props.inverted) { this._pushCells( cells,