Skip to content

Commit

Permalink
Adjust scrollToLocation when using sticky section headers
Browse files Browse the repository at this point in the history
  • Loading branch information
danilobuerger committed May 7, 2019
1 parent a5c57b4 commit 39dda67
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Libraries/Lists/VirtualizedSectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,15 @@ class VirtualizedSectionList<
for (let i = 0; i < params.sectionIndex; i++) {
index += this.props.getItemCount(this.props.sections[i].data) + 2;
}
let viewOffset = 0;
if (params.itemIndex > 0 && this.props.stickySectionHeadersEnabled) {
const frame = this._listRef._getFrameMetricsApprox(
index - params.itemIndex,
);
viewOffset = frame.length;
}
const toIndexParams = {
viewOffset,
...params,
index,
};
Expand Down

0 comments on commit 39dda67

Please sign in to comment.