[iOS] SectionList - Weird ListHeaderComponent re-render when no section data
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
Only on iOS, when using a SectionList ListHeaderComponent, providing sections = [] will cause a weird re-render, whereas if there is any section data, this re-render does not happen.
Basically, is there any reason that the HeaderComponent should be forced to re-render when "sections" changes?

See Snack below of repro steps.
Version
0.67.2
Output of npx react-native info
System:
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Pro
Memory: 581.61 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Watchman: 2022.05.30.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 17.0.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
See Snack below, and follow these steps (need to load on iOS device, doesn't happen in web/android)
- Scroll "filter pills" component to it's right-most state
- Click "One", notice how the section list data filters to only rows with "One"
- Deselect "One"
- Click "Seven", notice how the "filter pills" component has jolted all the way back to the left, as there is no data found to filter by
Snack, code example, screenshot, or link to a repository
https://snack.expo.dev/@tyler16cote/section-list-empty-render
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 bằng cách tái hiện ví dụ Snack trên một thiết bị iOS với SectionList, một mảng sections rỗng và một ListHeaderComponent. Theo dõi hành vi của SectionList khi sections thay đổi và xác nhận rằng header không còn được render lại hoặc bị giật khi danh sách không có dữ liệu, đồng thời vẫn giữ nguyên hành vi đối với sections có dữ liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ios, 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
- 35/100