Skip to content

Scroll position not maintained after resume on iPadOS #2036

@mhoran

Description

@mhoran

Description

When resuming an app that has been backgrounded, the scroll position will not be maintained.

Current behavior

When scrolled to the bottom of a FlashList, after backgrounding the app and subsequent resume, the scroll position will jump upwards. This is most easily reproducible using an 11 inch iPad Air simulator in landscape mode.

Simulator.Screen.Recording.-.iPad.Air.11-inch.M3.-.2025-12-18.at.10.32.27.mov

Expected behavior

The scroll position should be maintained, as it is in portrait mode.

Reproduction

Expo Snack or minimal reproduction link:

https://snack.expo.dev/@mhoran/bold-green-apples

Note: The bug may not initially reproduce. You may have to first resize the window and then maximize. Sometimes it will reproduce on the first try, sometimes it takes a few tries. Eventually it will reproduce reliably.

Platform

  • iOS
  • Android
  • Web (if applicable)

Environment

React Native info output:
System:
  OS: macOS 26.2
  CPU: (12) arm64 Apple M4 Pro
  Memory: 1.42 GB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.5
    path: /Users/matthew.horan/.nvm/versions/node/v20.19.5/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/matthew.horan/.nvm/versions/node/v18.20.8/bin/yarn
  npm:
    version: 10.8.2
    path: /Users/matthew.horan/.nvm/versions/node/v20.19.5/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.2
    wanted: ^20.0.2
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.5
    wanted: 0.81.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

FlashList version: 2.2.0

Additional context

When backgrounding the app, one onLayout event fires and two onScroll events fire. The onLayout event has the correct width and height. The first onScroll event has incorrect width and height. The second has correct width and height. The first event seems to be the cause of this issue, as it forces a scroll due to the perceived change in width and height.

 LOG  {"layout": {"height": 682, "width": 1180, "x": 0, "y": 0}, "target": 2172}
 LOG  {"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 7086.5}, "contentSize": {"height": 8128.5, "width": 820}, "layoutMeasurement": {"height": 1042, "width": 820}, "target": 2172, "timestamp": 61750343.12187501, "zoomScale": 1}
 LOG  {"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 7102.5}, "contentSize": {"height": 8145, "width": 1180}, "layoutMeasurement": {"height": 682, "width": 1180}, "target": 2172, "timestamp": 61750454.55587501, "zoomScale": 1}

It actually seems as though the app is reset to portrait mode when backgrounded. Upon resume, landscape mode is restored, but the scroll position has changed for portrait.

It might make sense to store the current scroll position when backgrounded in order to work around this bug. I found that FlatList seems to have the same issue (initially I did not think it did, but found that an inverted FlatList has this issue when scrolled to the top.)

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