react / react/react-native

SectionList's `onScrollToIndexFailed` does not catch requested sectionIndex & itemIndex

オープン
#47,909 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る

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

Component: SectionList Issue: Author Provided Repro Needs: Attention Needs: Version Info
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

onScrollToIndexFailed returns index,heighestMeasuredIndex, and averageItemHeight, which is enough in FlatList.
but in sectionList it should return requested sectionIndex and itemIndex, and heighestMeasured section & item index in addition to flat index, because we have only scrollToLocation method available for sectionList and section and item index params are needed.

Steps to reproduce

run the snack, press on scroll to no where, you will see the alert

React Native Version

0.76.3

Affected Platforms

Runtime - Android, Runtime - iOS, Runtime - Web, Runtime - Desktop, Build - MacOS, Build - Windows, Build - Linux

Output of npx react-native info
System:
  OS: Windows 11 10.0.22000
  CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Memory: 8.47 GB / 15.89 GB
Binaries:
  Node:
    version: 23.0.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.0
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 10.9.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20241027.093345.0
    path: E:\Software\Watchman\bin\watchman.EXE
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Disabled
IDEs:
  Android Studio: Not Found
  Visual Studio: Not Found
Languages:
  Java:
    version: 21.0.3
    path: /c/Program Files/Eclipse Adoptium/jdk-21.0.3.9-hotspot/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.2
    wanted: 0.76.2
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
scroll to index failed
Reproducer

https://snack.expo.dev/@arasrezaie/sectionlist-example

Screenshots and Videos

No response

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

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

はじめの一歩

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

調査の方向性

リンクされた Expo Snack から始め、onScrollToIndexFailed を使用して失敗する SectionList のスクロールを再現します。SectionList のコールバック契約と、その scrollToLocation の入力を追跡し、失敗結果にフラットインデックス、高さ、平均アイテム高さに加えて、要求されたセクションおよびアイテムのインデックスと、測定済みの中で最大のセクションおよびアイテムのインデックスが含まれることを確認します。

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

評価

技術スタック
react-native
領域
mobile
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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