Skip to content

[SectionList] Cannot scroll to top of a SectionList with Header #14392

Closed
@mikelambert

Description

@mikelambert

SectionList.scrollToLocation internally calls VirtualizedList.scrollToIndex. Calling it with {itemIndex: 0, sectionIndex: 0} will scroll to the first element, but in the case of a header, will leave the header offscreen.

In writing this up, I discovered an ugly hack workaround that takes advantage of the calculation code: {itemIndex: 0, sectionIndex: 0, viewPosition: 100} will scroll to the top of the page (or some sufficiently high number to guarantee the code clamps to 0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions