Skip to content

Commit

Permalink
VirtualizedList: Fix spacer size calculation (#18105)
Browse files Browse the repository at this point in the history
Summary:
See #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: #18105

Differential Revision: D8382122

Pulled By: sahrens

fbshipit-source-id: 9421351469e8684bc61438605abbd9988b664c29
  • Loading branch information
rbrosboel authored and facebook-github-bot committed Jul 20, 2018
1 parent 7091f15 commit e0c7363
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}} />,
);
Expand Down

0 comments on commit e0c7363

Please sign in to comment.