Scroll position not maintained after resume on iPadOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 393
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Description
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.
https://github.com/user-attachments/assets/6cc7ab12-6996-4576-86d3-d9f696875386
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked Expo Snack on an 11-inch iPad Air simulator in landscape mode and reproduce the background/resume sequence. Inspect FlashList's onLayout and onScroll handling around the first incorrect dimensions, then verify that the scroll offset remains at the bottom after resuming and that portrait behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100