FlatList with initialScrollIndex skips earlier items when list fits viewport
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
If initialScrollIndex is set to a non-zero value and the list fits entirely on screen, items before that index are not rendered on Android.
You land at the correct index, but the items before it never appear and can’t be reached
Steps to reproduce
- Render a short FlatList so all items fit in the viewport (no scrolling)
- Set
initialScrollIndexto something > 0 - Provide
getItemLayout
The provided expo snack has a complete demo example with trigger buttons.
React Native Version
0.84.1
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26200
CPU: "(16) x64 AMD Ryzen 7 6800H with Radeon Graphics "
Memory: 4.72 GB / 15.25 GB
Binaries:
Node:
version: 23.5.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Users\Andrei\AppData\Roaming\npm\yarn.CMD
npm:
version: 11.9.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowAllTrustedApps: Enabled
Versions:
- 10.0.26100.0
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java:
version: 23.0.1
path: C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.1.0
wanted: 20.1.0
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.84.1
wanted: 0.84.1
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
There is no crash or thrown error in this case.
This is a rendering issue:
MANDATORY Reproducer
https://snack.expo.dev/@andyhoover/flatlist-initialscrollindex-bug-2026
Screenshots and Videos
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 mit dem Expo Snack-Reproducer und untersuche das Verhalten von FlatList unter Android, wenn initialScrollIndex nicht null ist, die Liste in den Viewport passt und getItemLayout bereitgestellt wird. Verfolge die relevanten React Native Android-Einstiegspunkte und überprüfe anschließend, dass alle früheren Elemente gerendert werden und erreichbar bleiben, während der anfängliche Index weiterhin ausgewählt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, 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