According to Facebook's documentation,
ListView - A core component designed for efficient display of vertically scrolling lists of changing data.
FlatList - A performant interface for rendering simple, flat lists.
It seems both are efficient. What should we consider when choosing one from the other?
SectionList s are like FlatList s, but they can have section headers to separate groups of rows. SectionList s render each item in their input sections using the renderSectionHeader and renderItem prop. Each item in sections should be an object with a unique id (the key), and an array data of row data.
FlatList is used to render the items in a scrollable list view. Large Data: When we have a large list of data and the number of data can change over time we can use FlatList as large data affect rendering speed and using FlatList won't affect the rendering speed.
React Native ListView is a view component which contains the list of items and displays in a vertical scrollable list. The minimum API to create list view is ListView. DataSource. It populates a simple array of data blobs, and instantiate a ListView component with data source and a renderRow callback.
FlatList - More performant compared to ListView. ListView rendering can get slow once the number of items grows larger. FlatList significantly improves memory usage and efficiency (especially for large or complex lists) while also significantly simplifying the props — no more dataSource necessary!
Features
Flatlist is packed with new components full of features to handle the majority of use cases out of the box:
FlatList is still missing some features, like sticky headers, but it's evolving fast. ListView is going to get deprecated.
ListView is deprecated now and Sticky Headers in Flat list working now
Better options out there
I was getting performance issues while rendering 5000+ items in flat-list. Looked for other alternatives and found recyclerlistview - High performance list-view for React Native and web. Much better scrollTo performance and better rendering optimisations compared to flat-list.
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