From e4fd9babe03d82fcf39ba6a46376f746a8a3e960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20B=C3=BCrger?= Date: Mon, 4 Feb 2019 08:11:51 -0800 Subject: [PATCH] Fix regression of VirtualizedList jumpy header (#22025) Summary: Fixes #20956, #21361, #21198, #21468 Keeps the intended outcome of #18105 Pull Request resolved: https://github.com/facebook/react-native/pull/22025 Differential Revision: D13941915 Pulled By: cpojer fbshipit-source-id: 59a0a834ea2d0dd4678e80a82ddaf95cecf87d38 --- Libraries/Lists/VirtualizedList.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index f6a9c6e2e..8455c51d6 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -806,7 +806,10 @@ class VirtualizedList extends React.PureComponent { if (stickyIndicesFromProps.has(ii + stickyOffset)) { const initBlock = this._getFrameMetricsApprox(lastInitialIndex); const stickyBlock = this._getFrameMetricsApprox(ii); - const leadSpace = stickyBlock.offset - initBlock.offset; + const leadSpace = + stickyBlock.offset - + initBlock.offset - + (this.props.initialScrollIndex ? 0 : initBlock.length); cells.push( , );