From de5149bac464b158ff88a066d092178bca59ae87 Mon Sep 17 00:00:00 2001 From: zongwan Date: Mon, 22 May 2017 13:03:18 +0800 Subject: [PATCH] Update VirtualizedList.js fix #14033 fix wrong position after `scrollToEnd` when `props.refreshing === true` --- Libraries/Lists/VirtualizedList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 21ce56dc0e61..2cf035721953 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -192,8 +192,8 @@ class VirtualizedList extends React.PureComponent { const animated = params ? params.animated : true; const veryLast = this.props.getItemCount(this.props.data) - 1; const frame = this._getFrameMetricsApprox(veryLast); - const offset = frame.offset + frame.length + this._footerLength - - this._scrollMetrics.visibleLength; + const offset = Math.max(0, frame.offset + frame.length + this._footerLength - + this._scrollMetrics.visibleLength); this._scrollRef.scrollTo( this.props.horizontal ? {x: offset, animated} : {y: offset, animated} );