Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native FlatList won't render until I scroll

On my Main Screen I have some search parameters that an user can choose from, like brand and price. If I select any of them and press search it send the data to the Second Screen, to show the list, but It won't render until I scroll on it.

But if I search without setting any parameters it shows the list correctly. Since Im sending the parameters to another screen I thought it should re-render.

The same happens with my sort filters... When I'm on the list, if I select "sorte by price" it won't re-render until I scroll again... What am I doing wrong?

EDIT: im not alone: https://github.com/facebook/react-native/issues/13316

Setting removeClippedSubviews={false} fixes the initial search, but the sort filters are still not working.

like image 599
waze Avatar asked Jun 24 '26 15:06

waze


1 Answers

I solved by using this on my FlatList: extraData={this.state} this way, FlatList knows it has to re-render.

It's in the docs.

like image 95
waze Avatar answered Jun 26 '26 05:06

waze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!