Skip to content

fix: prevent rerender of ListHeaderComponent#8

Open
DanielKuhn wants to merge 1 commit intohoaphantn7604:masterfrom
DanielKuhn:fix-ListHeaderComponent-rerenders
Open

fix: prevent rerender of ListHeaderComponent#8
DanielKuhn wants to merge 1 commit intohoaphantn7604:masterfrom
DanielKuhn:fix-ListHeaderComponent-rerenders

Conversation

@DanielKuhn
Copy link
Copy Markdown

Instead of creating an anonymous function for the ListHeaderComponent prop (which is a new component on every render, causing it to get unmounted and remounted on every render) render the children as an Element.

According to the documentation of RN FlatList, the ListHeaderComponent can be a function OR an Element. Changing this to element stops the rerenders.

Instead of creating an anonymous function for the ListHeaderComponent prop
(which is a new component on every render, causing it to get unmounted and remounted on every render)
render the children as an Element.

According to the documentation of RN FlatList (https://reactnative.dev/docs/flatlist#listheadercomponent),
the ListHeaderComponent can be a function OR an Element. Changing this to element stops the rerenders.
@DanielKuhn DanielKuhn mentioned this pull request Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant