@@ -384,7 +384,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
384
384
scrollToEnd ( params ?: ?{ animated ?: ?boolean , ...} ) {
385
385
const animated = params ? params . animated : true ;
386
386
const veryLast = this . props . getItemCount ( this . props . data ) - 1 ;
387
- const frame = this . _getFrameMetricsApprox ( veryLast ) ;
387
+ const frame = this . __getFrameMetricsApprox ( veryLast ) ;
388
388
const offset = Math . max (
389
389
0 ,
390
390
frame . offset +
@@ -458,7 +458,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
458
458
} ) ;
459
459
return ;
460
460
}
461
- const frame = this . _getFrameMetricsApprox ( index ) ;
461
+ const frame = this . __getFrameMetricsApprox ( index ) ;
462
462
const offset =
463
463
Math . max (
464
464
0 ,
@@ -950,8 +950,8 @@ class VirtualizedList extends React.PureComponent<Props, State> {
950
950
// See if there are any sticky headers in the virtualized space that we need to render.
951
951
for ( let ii = firstAfterInitial - 1 ; ii > lastInitialIndex ; ii -- ) {
952
952
if ( stickyIndicesFromProps . has ( ii + stickyOffset ) ) {
953
- const initBlock = this . _getFrameMetricsApprox ( lastInitialIndex ) ;
954
- const stickyBlock = this . _getFrameMetricsApprox ( ii ) ;
953
+ const initBlock = this . __getFrameMetricsApprox ( lastInitialIndex ) ;
954
+ const stickyBlock = this . __getFrameMetricsApprox ( ii ) ;
955
955
const leadSpace =
956
956
stickyBlock . offset -
957
957
initBlock . offset -
@@ -968,7 +968,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
968
968
inversionStyle ,
969
969
) ;
970
970
const trailSpace =
971
- this . _getFrameMetricsApprox ( first ) . offset -
971
+ this . __getFrameMetricsApprox ( first ) . offset -
972
972
( stickyBlock . offset + stickyBlock . length ) ;
973
973
cells . push (
974
974
< View key = "$sticky_trail" style = { { [ spacerKey ] : trailSpace } } /> ,
@@ -979,9 +979,9 @@ class VirtualizedList extends React.PureComponent<Props, State> {
979
979
}
980
980
}
981
981
if ( ! insertedStickySpacer ) {
982
- const initBlock = this . _getFrameMetricsApprox ( lastInitialIndex ) ;
982
+ const initBlock = this . __getFrameMetricsApprox ( lastInitialIndex ) ;
983
983
const firstSpace =
984
- this . _getFrameMetricsApprox ( first ) . offset -
984
+ this . __getFrameMetricsApprox ( first ) . offset -
985
985
( initBlock . offset + initBlock . length ) ;
986
986
cells . push (
987
987
< View key = "$lead_spacer" style = { { [ spacerKey ] : firstSpace } } /> ,
@@ -1005,14 +1005,14 @@ class VirtualizedList extends React.PureComponent<Props, State> {
1005
1005
this . _hasWarned . keys = true ;
1006
1006
}
1007
1007
if ( ! isVirtualizationDisabled && last < itemCount - 1 ) {
1008
- const lastFrame = this . _getFrameMetricsApprox ( last ) ;
1008
+ const lastFrame = this . __getFrameMetricsApprox ( last ) ;
1009
1009
// Without getItemLayout, we limit our tail spacer to the _highestMeasuredFrameIndex to
1010
1010
// prevent the user for hyperscrolling into un-measured area because otherwise content will
1011
1011
// likely jump around as it renders in above the viewport.
1012
1012
const end = this . props . getItemLayout
1013
1013
? itemCount - 1
1014
1014
: Math . min ( itemCount - 1 , this . _highestMeasuredFrameIndex ) ;
1015
- const endFrame = this . _getFrameMetricsApprox ( end ) ;
1015
+ const endFrame = this . __getFrameMetricsApprox ( end ) ;
1016
1016
const tailSpacerLength =
1017
1017
endFrame . offset +
1018
1018
endFrame . length -
@@ -1419,16 +1419,16 @@ class VirtualizedList extends React.PureComponent<Props, State> {
1419
1419
const framesInLayout = [ ] ;
1420
1420
const itemCount = this . props . getItemCount ( this . props . data ) ;
1421
1421
for ( let ii = 0 ; ii < itemCount ; ii ++ ) {
1422
- const frame = this . _getFrameMetricsApprox ( ii ) ;
1422
+ const frame = this . __getFrameMetricsApprox ( ii ) ;
1423
1423
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
1424
1424
* suppresses an error found when Flow v0.68 was deployed. To see the
1425
1425
* error delete this comment and run Flow. */
1426
1426
if ( frame . inLayout ) {
1427
1427
framesInLayout . push ( frame ) ;
1428
1428
}
1429
1429
}
1430
- const windowTop = this._getFrameMetricsApprox (this.state.first).offset;
1431
- const frameLast = this._getFrameMetricsApprox (this.state.last);
1430
+ const windowTop = this.__getFrameMetricsApprox (this.state.first).offset;
1431
+ const frameLast = this.__getFrameMetricsApprox (this.state.last);
1432
1432
const windowLen = frameLast.offset + frameLast.length - windowTop;
1433
1433
const visTop = this._scrollMetrics.offset;
1434
1434
const visLen = this._scrollMetrics.visibleLength;
@@ -1642,15 +1642,15 @@ class VirtualizedList extends React.PureComponent<Props, State> {
1642
1642
// Mark as high priority if we're close to the start of the first item
1643
1643
// But only if there are items before the first rendered item
1644
1644
if (first > 0 ) {
1645
- const distTop = offset - this . _getFrameMetricsApprox ( first ) . offset ;
1645
+ const distTop = offset - this . __getFrameMetricsApprox ( first ) . offset ;
1646
1646
hiPri =
1647
1647
hiPri || distTop < 0 || ( velocity < - 2 && distTop < scrollingThreshold ) ;
1648
1648
}
1649
1649
// Mark as high priority if we're close to the end of the last item
1650
1650
// But only if there are items after the last rendered item
1651
1651
if (last < itemCount - 1 ) {
1652
1652
const distBottom =
1653
- this . _getFrameMetricsApprox ( last ) . offset - ( offset + visibleLength ) ;
1653
+ this . __getFrameMetricsApprox ( last ) . offset - ( offset + visibleLength ) ;
1654
1654
hiPri =
1655
1655
hiPri ||
1656
1656
distBottom < 0 ||
@@ -1752,7 +1752,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
1752
1752
maxToRenderPerBatchOrDefault ( this . props . maxToRenderPerBatch ) ,
1753
1753
windowSizeOrDefault ( this . props . windowSize ) ,
1754
1754
state ,
1755
- this . _getFrameMetricsApprox ,
1755
+ this . __getFrameMetricsApprox ,
1756
1756
this . _scrollMetrics ,
1757
1757
) ;
1758
1758
}
@@ -1815,13 +1815,11 @@ class VirtualizedList extends React.PureComponent<Props, State> {
1815
1815
return { index, item, key : this . _keyExtractor ( item , index ) , isViewable} ;
1816
1816
} ;
1817
1817
1818
- _getFrameMetricsApprox = (
1819
- index : number ,
1820
- ) : {
1818
+ __getFrameMetricsApprox : ( index : number ) => {
1821
1819
length : number ,
1822
1820
offset : number ,
1823
1821
...
1824
- } => {
1822
+ } = index = > {
1825
1823
const frame = this . _getFrameMetrics ( index ) ;
1826
1824
if ( frame && frame . index === index ) {
1827
1825
// check for invalid frames due to row re-ordering
0 commit comments