Core Data Props
For simplicity, data is a plain array of items of a given type.
Takes an item from The render function receives:
data and renders it into the list. Provides additional metadata like index and target.item(Object): The item fromdatabeing renderedindex(number): The index corresponding to this item in thedataarraytarget(RenderTarget): Indicates why the item is being rendered:"Cell"- Normal list item rendering"Measurement"- Invoked for size measurement (not visible, can be ignored in analytics)"StickyHeader"- Item is being used as a sticky header
extraData(any): The value passed to theextraDataprop
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.Allows developers to override type of items. This will improve recycling if you have different types of items in the list. The right type will be used for the right item. Default type is 0.If you don’t want to change type for certain indexes, just return undefined.
Additional Data
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.Component Props
Each cell is rendered using this element. Can be a React Component Class, or a render function. The root component should always be a
CellContainer which is also the default component used.Ensure that the original props are passed to the returned CellContainer. The props will include:onLayout: Method for updating data about the realCellContainerlayoutindex: Index of the cell in the liststyle: Style ofCellContainer, including:flexDirection: Depends on whether your list is horizontal or verticalposition: Value will beabsolute(how FlashList positions elements)left: Position on x axistop: Position on y axiswidth: Width of element (present when list is vertical)height: Height of element (present when list is horizontal)
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 (if available) 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 (e.g.
SomeComponent), or a React element (e.g. <SomeComponent />).Styling for internal View for
ListHeaderComponent.Rendered at the bottom of all the items. Can be a React Component (e.g.
SomeComponent), or a React element (e.g. <SomeComponent />).Styling for internal View for
ListFooterComponent.Rendered as the main scrollview. Allows you to replace the internal ScrollView with a custom implementation.
Type Reference
ListRenderItemInfo<TItem>
The info object passed torenderItem:
ListRenderItem<TItem>
The type for therenderItem function: