react-native-virtualized-view icon indicating copy to clipboard operation
react-native-virtualized-view copied to clipboard

Data re-rendering

Open ReactNative-AutoAdvisers opened this issue 2 years ago • 5 comments

Even focused screen data is re-rendering again and again on every screen tap

I'm kind of experiencing this as well.

dmgcoding avatar Mar 14 '23 07:03 dmgcoding

me too

LucasTrombim avatar Dec 13 '23 13:12 LucasTrombim

This is because the ScrollView creates an anonymous function for the ListHeaderComponent prop which is a new component on every render, causing it to get unmounted and remounted again and again. According to the documentation of RN FlatList, the ListHeaderComponent can be a function OR an Element. Changing this to element stops the rerenders.

See https://github.com/hoaphantn7604/react-native-virtualized-view/pull/8 for the fix.

DanielKuhn avatar Jan 31 '24 14:01 DanielKuhn

facing this same issues ... unable tp correct it here

sheggietyn avatar Jun 24 '24 14:06 sheggietyn

The complete implementation of this package is 10 lines of code! Since the maintainer seems to have abandoned it, you can simply copy the ScrollView implementation and use it directly in your project. Just make sure to adjust the ListHeaderComponent like this: https://github.com/hoaphantn7604/react-native-virtualized-view/pull/8/files to avoid constant re-rendering.

DanielKuhn avatar Jun 25 '24 07:06 DanielKuhn