Shopify Aug 17, 2022

Instant Performance Upgrade: From FlatList to FlashList

Article Summary

Shopify's React Native team just solved one of mobile development's most persistent headaches: getting lists to scroll smoothly without blank cells or frame drops.

The React Native Foundations team built FlashList, an open-source drop-in replacement for FlatList that delivers native-like performance across all devices. After seeing consistent performance issues with FlatList on lower-end Android devices, they created a solution that works seamlessly on everything from budget phones to flagship devices.

Key Takeaways

Critical Insight

FlashList maintains 60+ FPS even on budget Android devices while using a fraction of the memory, with almost zero migration effort required.

The team's metrics-first approach revealed why testing on the latest iPhone was actually hiding critical performance problems.

About This Article

Problem

RecyclerListView, an existing third-party option, required developers to estimate item sizes ahead of time. When those estimates were wrong or items had varying heights, the entire layout would render in JavaScript and cause visible glitches.

Solution

Shopify's React Native Foundations team moved layout calculations to the native layer and added automatic size measurement. This removed the need to predict item sizes manually. They also reduced memory use by switching to a 250-pixel buffer instead of FlatList's larger pre-rendering approach.

Impact

FlashList cut memory consumption for large feeds with 200-300 items per page. Load times improved and apps stayed responsive. Users could scroll to any index without requiring items to already be loaded in the current view.