<VirtualizedList renderScrollComponent> should preserve child elements #40740
Labels
Component: VirtualizedList
Needs: Repro
This issue could be improved with a clear list of steps to reproduce the issue.
Needs: Triage 🔍
Never gets stale
Prevent those issues and PRs from getting stale
Description
It's extremely confusing that this works:
but this doesn't:
The reason appears to be that the third
cells
argument tocloneElement
call here (which in this case would be passed a<View>
) overrides the children of that top-level element. So theScrollView
inside gets lost.What I believe should happen instead is that
scrollProps
should includechildren: cells
. Then it's up to yourrenderScrollComponent
function to decide what to do with it.That would be a breaking change but it seems a lot more in line with how React components are supposed to work? It's bad that wrapping a top-level component completely breaks the logic. (I spent an hour debugging this because I couldn't believe a built-in RN component would do this :). It's possible that I badly misunderstood something, so apologies if that's the case.
React Native Version
0.72.5
Output of
npx react-native info
Steps to reproduce
see earlier
Snack, screenshot, or link to a repository
this is about API design
The text was updated successfully, but these errors were encountered: