react / react/react-native

FlatList with initialScrollIndex skips earlier items when list fits viewport

オープン
#56,237 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Component: FlatList Needs: Triage :mag:
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

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
  1. Render a short FlatList so all items fit in the viewport (no scrolling)
  2. Set initialScrollIndex to something > 0
  3. 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
Image Image Image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Expo Snack の再現ケースから始め、initialScrollIndex がゼロ以外で、リストが viewport に収まり、getItemLayout が指定されている場合の Android における FlatList の動作を調査します。関連する React Native Android のエントリポイントを追跡し、そのうえで、初期インデックスが引き続き選択された状態で、前のすべての項目がレンダリングされ、到達可能なままであることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。