VirtualizedList- inefficient function passing for CellRenderer
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
- 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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告されたcallbackは、リンク先の行にあるLibraries/Lists/VirtualizedList.jsにあります。そこから始め、説明されているFlatListとCellRendererのケースでwhy-did-you-updateを使用して、関数だけによる再レンダリングを回避できるか確認してください。完了条件は、リストの動作を変更せずに、callbackがそれらの不要なCellRendererの再レンダリングを引き起こさなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react-native
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100