VirtualizedList- inefficient function passing for CellRenderer
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ả
- Review the documentation
- Search for existing issues
- Use the latest React Native release - using version 0.55.2 did not see any changes to the FlatListComponent since that version.
Environment
Run react-native info in your terminal and paste its contents here.
Environment:
OS: Windows 10
Node: 8.11.1
Yarn: 0.21.3
npm: 5.8.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4408382
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: ^0.55.2 => 0.55.4
Description
I used the npm package why-did-you-update to help optimize my components and prevent re-renders. However there is a re-render that I cannot control. This happens for every item in the list. My gues
CellRenderer.props: Changes are in functions only. Possibly avoidable re-render?
Functions before: {onLayout: ƒ}
Functions after: {onLayout: ƒ}
It seems this is caused by an anonymous function at https://github.com/facebook/react-native/blob/d756d94b3a7e2812f17f549c57767ac63734b49c/Libraries/Lists/VirtualizedList.js#L691
I propose that this function be defined on the class to prevent unnecessary re-renders.
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
Callback được báo cáo nằm trong Libraries/Lists/VirtualizedList.js tại dòng được liên kết. Hãy bắt đầu từ đó và sử dụng why-did-you-update với trường hợp FlatList và CellRenderer đã mô tả để xác minh liệu có thể tránh việc rerender chỉ do function gây ra hay không. Hoàn thành nghĩa là callback không còn gây ra những lần rerender CellRenderer không cần thiết đó mà không thay đổi hành vi của list.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, react-native
- Lĩnh vực
- mobile
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100