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:
parent
7091f15602
commit
e0c73633cf
|
@ -805,8 +805,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||||
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
|
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
|
||||||
const initBlock = this._getFrameMetricsApprox(lastInitialIndex);
|
const initBlock = this._getFrameMetricsApprox(lastInitialIndex);
|
||||||
const stickyBlock = this._getFrameMetricsApprox(ii);
|
const stickyBlock = this._getFrameMetricsApprox(ii);
|
||||||
const leadSpace =
|
const leadSpace = stickyBlock.offset - initBlock.offset;
|
||||||
stickyBlock.offset - (initBlock.offset + initBlock.length);
|
|
||||||
cells.push(
|
cells.push(
|
||||||
<View key="$sticky_lead" style={{[spacerKey]: leadSpace}} />,
|
<View key="$sticky_lead" style={{[spacerKey]: leadSpace}} />,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue