Scroll position not maintained after resume on iOS
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
The scroll position of a ScrollView that has been scrolled to the bottom is not maintained on resume after being backgrounded on iOS.
The position appears to be reset to landscape when the device is in portrait. In addition to triggering an unexpected scroll, the layoutMeasurement.height of the scroll event indicate that the device orientation has changed to portrait. However, no corresponding onLayout event is triggered, and the app resumes in landscape.
Initially I thought this was an issue with FlashList but I found that it can be reproduced with ScrollView alone.
Steps to reproduce
- Run the Snack on an iPad simulator
- Rotate the screen to landscape (app must be fullscreen)
- Scroll to the bottom
- Background the app
- Wait a few seconds
- Open the app
- See that the
ScrollViewposition has changed
React Native Version
0.83.1
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: Linux 6.17 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 11.53 GB / 23.24 GB
Shell:
version: "5.9"
path: /usr/bin/zsh
Binaries:
Node:
version: 22.21.0
path: /usr/bin/node
Yarn:
version: 1.22.22
path: /usr/bin/yarn
npm:
version: 10.9.4
path: /usr/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: AI-252.27397.103.2522.14514259
Languages:
Java: Not Found
Ruby:
version: 3.0.2
path: /home/mhoran/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
https://github.com/user-attachments/assets/6cc7ab12-6996-4576-86d3-d9f696875386
MANDATORY Reproducer
https://snack.expo.dev/@mhoran/restless-green-graham-crackers
Screenshots and Videos
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den obligatorischen Snack-Reproducer auf einem iPad-Simulator auszuführen, und befolge die aufgeführten Schritte für Drehung, Scrollen, Hintergrund und Fortsetzen. Vergleiche die layoutMeasurement.height des ScrollView-Scroll-Ereignisses mit der Geräteausrichtung und prüfe, ob während des Fortsetzens ein onLayout-Ereignis auftritt. Als abgeschlossen gilt die Aufgabe, wenn die Scrollposition stabil bleibt und der Ausrichtungs-/Layoutstatus nach dem erneuten Öffnen der App konsistent ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100