FlatList with initialScrollIndex skips earlier items when list fits viewport
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 127k
- Fork
- 25.3k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với trình tái hiện Expo Snack và kiểm tra hành vi của FlatList trên Android khi initialScrollIndex khác 0, danh sách vừa với viewport và getItemLayout được cung cấp. Truy vết các entry point liên quan của React Native Android, sau đó xác minh rằng tất cả các mục trước đó đều được render và vẫn có thể truy cập trong khi index ban đầu vẫn được chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, react-native
- Lĩnh vực
- mobile
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100