SectionList ListHeaderComponent gets rerendered when sections data changes
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
🐛 Bug Report
This is a duplicate of:
https://github.com/facebook/react-native/issues/16824
https://github.com/facebook/react-native/issues/16823
https://github.com/facebook/react-native/issues/14249
But since those 3 were closed and they are missing a reproducible example of the bug I'm reopening.
Description
If one uses a TextInput as a ListHeaderComponent when searching and when the returned sections are empty the TextInput loses focus.
If when searching the sections still have data - then the TextInput in the ListHeaderComponent doesn't lose focus.
To Reproduce
https://snack.expo.io/H12h3BgHV
Expected Behavior
I would expect for the TextInput not to lose focus
Code Example
https://snack.expo.io/H12h3BgHV
Environment
[skip envinfo]
RN 0.58
I've been trying to debug this with @pawelczerepak and what we noticed is that VirtualizedCellWrapper
https://github.com/facebook/react-native/blob/master/Libraries/Lists/VirtualizedList.js#L1759
gets unmounted and mounted when sections is an empty array. And when this happens everything inside of it gets unmounted and mounted again.
@sahrens - any ideas on what might be going on here?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fokusverlust mit dem Snack-Beispiel und untersuche anschließend den Code von VirtualizedCellWrapper rund um Libraries/Lists/VirtualizedList.js Zeile 1759. Verfolge, warum es ausgehängt und wieder eingehängt wird, wenn sections leer wird, und überprüfe, dass das TextInput in ListHeaderComponent fokussiert bleibt, während sich die Abschnittsdaten ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react-native
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100