VirtualizedList- inefficient function passing for CellRenderer
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
- 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Il callback segnalato si trova in Libraries/Lists/VirtualizedList.js, alla riga collegata. Inizia da lì e usa why-did-you-update con il caso descritto di FlatList e CellRenderer per verificare se il rerendering causato solo dalla funzione è evitabile. Il lavoro è completato quando il callback non causa più questi rerendering non necessari di CellRenderer senza modificare il comportamento della lista.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react-native
- Ambito
- mobile
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100