Shopify / Shopify/flash-list

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

Open
#1,938 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P1
Dominant language
TypeScript
Stars
7.2k
Forks
393
Avg merge
1d 3h
Merged PRs (30d)
1

Description

Description

FlashList’s scrollToIndex calculates scroll position from the top of the parent container, not from the top of the list. 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/flash-list@2.1.0
Expo v54

Additional context

As a workaround, wrap the FlashList in View container without any other views.
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Expo Snack on iOS and Android with Expo 54, then compare its scrollToIndex behavior with Expo 53 and web. Trace how the list position is calculated relative to parent views; done means the button-above-list case shows index 50 correctly without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.