Skip to content

Commit d8eb28a

Browse files
Adjust scrollToLocation when using sticky section headers
1 parent a5c57b4 commit d8eb28a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Libraries/Lists/VirtualizedSectionList.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,13 @@ class VirtualizedSectionList<
149149
for (let i = 0; i < params.sectionIndex; i++) {
150150
index += this.props.getItemCount(this.props.sections[i].data) + 2;
151151
}
152+
let viewOffset = 0;
153+
if (params.itemIndex > 0 && this.props.stickySectionHeadersEnabled) {
154+
const frame = this._listRef._getFrameMetricsApprox(index - params.itemIndex);
155+
viewOffset = frame.length;
156+
}
152157
const toIndexParams = {
158+
viewOffset,
153159
...params,
154160
index,
155161
};

0 commit comments

Comments
 (0)