VirtualizedList: Fix spacer size calculation (#18105)

Summary:
See https://github.com/facebook/react-native/issues/18104

Tested the above snack with:
- stickyHeadersEnabled true/false
- initialScrollIndex set and not

Visibly verified consistent rendering.

[GENERAL] [BUGFIX] [VirtualizedList] - Fix for jumpy content when initialScrollIndex specified
Pull Request resolved: https://github.com/facebook/react-native/pull/18105

Differential Revision: D8382122

Pulled By: sahrens

fbshipit-source-id: 9421351469e8684bc61438605abbd9988b664c29
This commit is contained in:
Rasmus K. Brosbøl 2018-07-20 00:12:05 -07:00 committed by Facebook Github Bot
parent 7091f15602
commit e0c73633cf
1 changed files with 1 additions and 2 deletions

View File

@ -805,8 +805,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
const initBlock = this._getFrameMetricsApprox(lastInitialIndex);
const stickyBlock = this._getFrameMetricsApprox(ii);
const leadSpace =
stickyBlock.offset - (initBlock.offset + initBlock.length);
const leadSpace = stickyBlock.offset - initBlock.offset;
cells.push(
<View key="$sticky_lead" style={{[spacerKey]: leadSpace}} />,
);