FlashList is a high-performance alternative to React Native’s FlatList. It uses cell recycling to achieve smooth scrolling with large datasets.
Usage
Props
Required Props
Array of items to render in the list.
Takes an item from
data and renders it into the list.The function receives:item: The item fromdatabeing renderedindex: The index corresponding to this item in thedataarraytarget: Render context -"Cell","StickyHeader", or"Measurement"extraData: Value passed to theextraDataprop
Layout Props
If
true, renders items next to each other horizontally instead of stacked vertically.Default: falseMultiple columns can only be rendered with
horizontal={false} and will zig-zag like a flexWrap layout.Items should all be the same height - masonry layouts are not supported on old architecture.Draw distance for advanced rendering in dp/px. Controls how far off-screen items are rendered.Larger values improve scroll performance but use more memory.
Component Props
Each cell is rendered using this element. Can be a React Component Class or render function.The root component should always be a
CellContainer which is the default. The props include:onLayout: Method for updating layout dataindex: Index of the cell in the liststyle: Cell positioning and sizing styles
Changing layout of the cell can conflict with native layout operations. You may need to set
disableAutoLayout to true to prevent this.Rendered in between each item, but not at the top or bottom.By default,
leadingItem and trailingItem props are provided.Rendered when the list is empty. Can be a React Component (e.g.
SomeComponent) or a React element (e.g. <SomeComponent />).Rendered at the top of all the items. Can be a React Component or a React element.
Styling for internal View for
ListHeaderComponent.Rendered at the bottom of all the items. Can be a React Component or a React element.
Styling for internal View for
ListFooterComponent.Rendered as the main scroll view. Use this to customize the underlying scroll component.
Data Management Props
Used to extract a unique key for a given item at the specified index.Key is used for optimizing performance. Defining
keyExtractor is also necessary when doing layout animations to uniquely identify animated components.A marker property for telling the list to re-render (since it implements
PureComponent).If any of your renderItem, Header, Footer, etc. functions depend on anything outside of the data prop, stick it here and treat it immutably.Allows developers to override type of items. This will improve recycling if you have different types of items in the list.Right type will be used for the right item. Default type is
0.overrideItemLayout
(layout: { span?: number }, item: T, index: number, maxColumns: number, extraData?: any) => void
This method can be used to change column span of an item.Changing item span is useful when you have grid layouts (
numColumns > 1) and you want few items to be bigger than the rest.Modify the given layout. Do not return. FlashList will fallback to default values if this is ignored.Scroll & Interaction Props
Instead of starting at the top with the first item, start at
initialScrollIndex.Additional configuration for
initialScrollIndex.Use viewOffset to apply an offset to the initial scroll position as defined by initialScrollIndex. Ignored if initialScrollIndex is not set.Called once when the scroll position gets within
onEndReachedThreshold of the rendered content.How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the
onEndReached callback.Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.Default: 0.5Called once when the scroll position gets within
onStartReachedThreshold of the start of the content.How far from the start (in units of visible length of the list) the top edge of the list must be from the start of the content to trigger the
onStartReached callback.Thus a value of 0.5 will trigger onStartReached when the start of the content is within half the visible length of the list.Default: 0.2This event is raised once the list has drawn items on the screen. It also reports
elapsedTimeInMs which is the time it took to draw the items.This is required because FlashList doesn’t render items in the first cycle. Items are drawn after it measures itself at the end of first render.If you’re using ListEmptyComponent, this event is raised as soon as ListEmptyComponent is rendered.If provided, a standard RefreshControl will be added for “Pull to Refresh” functionality.Make sure to also set the
refreshing prop correctly.Set this
true while waiting for new data from a refresh.Set this when offset is needed for the loading indicator to show correctly.
Viewability Props
Called when the viewability of rows changes, as defined by the
viewabilityConfig prop.Array of changed includes ViewTokens for both visible and non-visible items. You can use the isViewable flag to filter the items.If you are tracking the time a view becomes (non-)visible, use the timestamp property.A default configuration for determining whether items are viewable.
List of
ViewabilityConfig/onViewableItemsChanged pairs.A specific onViewableItemsChanged will be called when its corresponding ViewabilityConfig’s conditions are met.Sticky Header Props
Array of indices of items that should stick to the top of the list as you scroll.Inherited from React Native’s
ScrollView.Callback invoked when the currently displayed sticky header changes.Receives the current sticky header index and the previous sticky header index. This is useful for tracking which header is currently stuck at the top while scrolling.The index refers to the position of the item in your data array that’s being used as a sticky header.
Configuration for sticky header behavior.
Advanced Props
Allows overriding internal ScrollView props. Props provided here are spread onto the internal ScrollView after all other props, so they take highest priority.This can be useful for cases where you need to set a style on the ScrollView itself rather than the outer container. For example, to enable visible overflow:
Maximum number of items in the recycle pool. These are the items that are cached in the recycle pool when they are scrolled off the screen.Unless you have a huge number of item types, you shouldn’t need to set this. Setting this to
0 will disable the recycle pool and items will unmount once they are scrolled off the screen.There’s no limit by default.Enable masonry layout. Items can have different heights and will be arranged in a Pinterest-style layout.
If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order.
Configuration for maintaining scroll position when content changes. Useful for chat-like interfaces where new messages can be added at the top or bottom.
Called when the layout is committed. Can be used to measure list.
Style for the RecyclerView’s parent container.Please avoid anything which can mess size of children in this view. For example, margin is okay but padding is not.
To enable
overflow: "visible", you must also set it on the internal ScrollView via overrideProps.ScrollView Props
FlashList also accepts all ScrollView props except maintainVisibleContentPosition (use the FlashList-specific version instead on new architecture).
Common ScrollView props include:
contentContainerStyleshowsVerticalScrollIndicatorshowsHorizontalScrollIndicatoronScrollscrollEventThrottleinverted- And many more from React Native’s ScrollView
Ref Methods
Access these methods by passing a ref toFlashList:
Scrolling Methods
Scrolls the list to a specific offset position.Use this method when you want precise control over the scroll position in pixels rather than by item index.
Scrolls to a specific index in the list. This is the most common method to scroll to a particular item.
Scrolls to a specific item in the list.Similar to
scrollToIndex, but works with the item reference instead of its index. Useful when you have a reference to an item but don’t know its index.Scrolls to the end of the list.
Scrolls to the top (or start) of the list.
Makes the scroll indicators flash momentarily.Useful to indicate to users that there is more content to scroll.
Information Methods
Returns the layout information for a specific item.Use this to get position and size information for an item at a given index.
Returns the currently visible item indices.Use this to determine which items are currently visible to the user.
Returns the index of the first visible item.Convenience method when you only need the first visible item.
Returns the offset of the first item (accounts for header/padding).Useful when implementing custom scroll behavior or calculating positions.
Returns the current viewport dimensions.
Returns the dimensions of the child container.
Returns the absolute last scroll offset.Useful for implementing custom scroll tracking functionality.
Get access to current props.
Native Access Methods
Returns the underlying native scroll view reference.Use this when you need direct access to the native scroll component. This is generally not recommended for regular use.
Returns a reference to the scroll responder.Useful for more advanced scroll handling and integrations.
Returns the underlying scrollable node.Primarily used for platform-specific integrations.
Advanced Methods
Forces recalculation of viewable items (viewability callbacks).Call this after any operation that might affect item visibility but doesn’t trigger a scroll event.
Marks the list as having been interacted with.Call this method when you want to manually trigger the
onViewableItemsChanged callback without an actual scroll event.Disables item recycling in preparation for layout animations.Call this before performing layout animations to prevent visual glitches. Remember to reset disableRecycling after animations complete.
Clears the layout cache on update.Call this when you want to clear the layout cache on update. Can be useful for carousels when orientation changes.This should be called before the render and not in an effect.
Type Definitions
ListRenderItemInfo
RenderTarget
Cell: This is for your list itemMeasurement: Might be invoked for size measurement and won’t be visible. You can ignore this in analytics.StickyHeader: This is for your sticky header. Use this to change your item’s appearance while it’s being used as a sticky header.