Skip to content

Commit 39dda67

Browse files
committed
Adjust scrollToLocation when using sticky section headers
1 parent a5c57b4 commit 39dda67

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Libraries/Lists/VirtualizedSectionList.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,15 @@ 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(
155+
index - params.itemIndex,
156+
);
157+
viewOffset = frame.length;
158+
}
152159
const toIndexParams = {
160+
viewOffset,
153161
...params,
154162
index,
155163
};

0 commit comments

Comments
 (0)