What's the difference between ListView and FlatList?

According to the Facebook documentation,

ListView is the main component for efficiently displaying vertically scrolling lists of changing data.

FlatList is an interface for rendering simple, flat lists.

Both seem to be effective. What should we consider when choosing one from the other?

+13


source to share


1 answer


FlatList is more performant than ListView. Rendering of the ListView can become slow as the number of items increases. FlatList greatly improves memory usage and efficiency (especially for large or complex lists) and also makes props much easier - no data source needed anymore!

Features
Flatlist is packed with new components full of functionality to handle most use cases out of the box:

  • Loading scroll (onEndReached).
  • Pull to refresh (onRefresh / refreshing).
  • Custom Viewable Callbacks (VPV) (onViewableItemsChanged / viewabilityConfig).
  • Horizontal mode (horizontal).
  • Smart separators of elements and sections.
  • Support for multiple columns (numColumns)
  • scrollToEnd, scrollToIndex and scrollToItem
  • Better to type on the keyboard.


FlatList is still missing some features like sticky headers, but it's evolving quickly. The ListView is about to be deprecated .

ListView is now deprecated and Sticky Headers on Flat list now work

+37


source







All Articles