Skip to content

Unexpected scroll jump with initialIndex set to last item #73

@DmitryLudin

Description

@DmitryLudin

Hello! First of all, I would like to express my gratitude for your library - it's the best virtualization tool I've ever worked with. However, I came across a visual issue: when the initialIndex is set as the last item in the list, there's a noticeable jump in scrolling. This is particularly noticeable when using initialDelay. At the moment, we've addressed this with the visibility: hidden hack for the container until all elements are fully rendered. Do you perhaps have a more optimal solution?

          <ViewportList
            viewportRef={scrollAreaRef}
            items={data}
            overscan={20}
            initialIndex={data.length - 1}
            initialPrerender={10}
            initialDelay={1000}
            initialAlignToTop={false}
            indexesShift={indexesShift}
            onViewportIndexesChange={handleViewportIndexesChange}
          >
            {handleRenderItem}
          </ViewportList>

first video without the visibility: hidden hack
second with the visibility: hidden hack

Screen.Recording.2023-10-17.at.10.34.28.mov
Screen.Recording.2023-10-17.at.10.51.52.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions