From 69600101e0d934358dd801dc69f9809d9d205c4b Mon Sep 17 00:00:00 2001 From: Maarten Schumacher Date: Mon, 10 Apr 2017 14:46:12 +0100 Subject: [PATCH] Account for header length when scrolling to index --- Libraries/Lists/VirtualizedList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 2fa3fd3c029a99..181dc1aaf5409c 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -195,9 +195,10 @@ class VirtualizedList extends React.PureComponent { 'otherwise there is no way to know the location of an arbitrary index.', ); const frame = this._getFrameMetricsApprox(index); + const cellOffset = this._headerLength + frame.offset; const offset = Math.max( 0, - frame.offset - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length), + cellOffset - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length), ) - (viewOffset || 0); this._scrollRef.scrollTo(horizontal ? {x: offset, animated} : {y: offset, animated}); }