I am building a chat app and since React-Native
version 0.63
, I am having horrible performance when there are long texts involved on an inverted Flatlist, on Android.
Here is a snack repro showcasing the issue (visible only when trying on a physical Android phone).
I reported a bug for it. It should be pretty flagrant for anyone who is building a chat app with an inverted Flatlist, but somehow I don't see this issue being talked about anywhere.
This made me think that maybe others have solved it somehow? If yes, how can I solve it too? It is making my app barely usable right now.
Use simple components Try to avoid a lot of logic and nesting in your list items. If you are reusing this list item component a lot in your app, create a duplicate just for your big lists and make them with less logic as possible and less nested as possible.
I solved it by applying a style to the flatlist and the rendering view.
It is some kind of problem with android 11, since in previous versions this does not happen with the inverted lists.
add the style scaleY: -1
to the flatlist and to the container of the view you are going to render, like this:
return (
<FlatList
// ...
style={{scaleY: -1}}
renderItem={({item}) => {
return (
<View style={{scaleY: -1}}>
{/* cell content */}
</View
);
}}
>
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With