Skip to content

scrollToIndex offset is not calculated correctly on Expo v54 (v2) #1938

@kpasi

Description

@kpasi

Description

FlashList’s scrollToIndex does not calculate the correct position from the top of the container.
All views above the list offset the scroll position incorrectly.

Current behavior

A layout contains a Button components and a FlashList with 100 items.
The button calls scrollToIndex({ index: 50, animated: true, viewPosition: 1 });.

As a result, FlashList scrolls to index 49, placing it at the bottom.
The last visible index depends on the height of the button.

If the layout is flipped so that the FlashList is above the button, index 50 is shown correctly.

Image Image

Changing the viewPosition value doesn’t fix or affect this issue — it’s simply the easiest way to demonstrate the problem.

Expected behavior

In the case where the button is above the FlashList, the last visible item should be index 50.

Reproduction

Expo Snack or minimal reproduction link: Snack
Note: iOS and Android versions are broken on Expo 54. Web and Expo 53 are working fine.

Platform

  • iOS
  • Android
  • Web (if applicable)

Environment

FlashList version: @shopify/[email protected]
Expo v54

Additional context

As a workaround, wrap the FlashList in View container.
Or downgrade to Expo 53.

Checklist

  • I've searched existing issues and couldn't find a duplicate
  • I've provided a minimal reproduction (Expo Snack preferred)
  • I'm using the latest version of @shopify/flash-list
  • I've included all required information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions