Skip to content

Shopify introduces FlashList as a drop-in FlatList replacement

updated

Shopify's React Native Foundations team has built FlashList, a list component designed to be swapped in for React Native's FlatList with minimal effort.

Goals

The team set three requirements for FlashList:

  • High frame rate: smooth scrolling at a consistent 60 FPS or greater, even on low-end devices.
  • No more blank cells: minimize empty items that appear when rendering can't keep up with fast scrolling.
  • Developer friendly: act as a drop-in replacement for FlatList and add features beyond current alternatives.

Building on RecyclerListView

The post describes RecyclerListView as a third-party package with very good real-world performance that is difficult to use. It needs predicted size estimates for each item, performs poorly when those estimates are inaccurate, and renders the entire layout in JavaScript, which can cause visible glitches. FlashList builds upon RecyclerListView to address these issues.

Performance and memory

Instead of creating new views from scratch on every update as FlatList does, FlashList recycles cells by reusing already allocated views and refreshing their contents. Some layout operations have moved to native code, which smooths over glitches caused by incorrect item sizes. FlashList also uses a smaller render buffer than FlatList. The default buffer is 250 pixels. The team says it tested and benchmarked extensively on Android devices, starting with lower-end hardware. The team describes its approach as metrics-based, measuring blank cells and FPS.

Shopify Mobile uses FlashList as its default list, and the Shop team has moved its search to FlashList.

Migrating from FlatList

FlashList uses almost the same API as FlatList. In the team's words, "If you know how FlatList works, you know how FlashList works." Migrating involves changing the component name and optionally adding the estimatedItemSize prop.

Additional features

The post highlights three additions beyond the standard FlatList props:

  • getItemType: uses separate recycling pools for different item types, such as text and image, to improve render performance.
  • Flexible column spans: grid layouts where each item's column span can be set explicitly or estimated with overrideItemLayout.
  • Performance metrics: reporting on values such as blank items and FPS to help measure and troubleshoot performance.

Community feedback quoted in the post mentions the ability to scrollToIndex to an index outside the current view, and an onLoad feature that shows how long the list takes to load.

Status and resources

FlashList is deployed in Shopify Mobile, Shop and POS. The team says it is working on known issues and improvements. Available resources include a developer portal, documentation, an example app, and guides on using estimatedItemSize and writing performant components.

Source: shopify.engineering