react / react/react-native

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

Đang mở
#47,909 4 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Component: SectionList Issue: Author Provided Repro Needs: Attention Needs: Version Info
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

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với Expo Snack được liên kết và tái hiện việc cuộn SectionList thất bại bằng onScrollToIndexFailed. Theo dõi hợp đồng callback của SectionList và các đầu vào của scrollToLocation, sau đó xác minh rằng kết quả lỗi bao gồm các chỉ mục section và item được yêu cầu cũng như các chỉ mục section và item đã đo cao nhất, ngoài chỉ mục phẳng, chiều cao và chiều cao item trung bình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react-native
Lĩnh vực
mobile
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.