Adding onViewableItemsChanged to SectionList changes the items passed to each section's keyExtractor
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
We wrote a SectionList component where each section defines it's own keyExtractor. One of the sections uses a key from a nested object in each item in the section. It broke when we wanted to add visibility tracking to the section list, and it seems like the section objects are being run through the keyExtractor but only when onViewableItemsChanged prop is provided.
I expect that only items within each section should be run through the section's keyExtractor function, and that the behavior is consistent regardless of what props are provided.
Steps to reproduce
- Open expo snack linked below
- Run it on android or iOS device and observe it works
- Uncomment the
onViewableItemsChangedline from the SectionList and observe the break
React Native Version
0.75.3
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
See expo snack for reproduction
Stacktrace or Logs
Cannot read property 'id' of undefined
Reproducer
https://snack.expo.dev/V1Ad0VTld860Zdt8n-qb7
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 Expo Snack được liên kết và tái hiện lỗi trên Android hoặc iOS bằng cách bật tắt prop onViewableItemsChanged của SectionList. Theo dõi cách việc theo dõi khả năng hiển thị gọi section keyExtractor và xác minh rằng chỉ các item trong từng section được truyền cho nó một cách nhất quán, dù có hay không có prop đó.
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
- Lỗi
- Độ 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
- 42/100