Virtual List
A View container to display large list of items (thousands) without performance penalty.
VirtualList is a perfect component for implementing Infinite Scroll experience because its rendering speed does not depend on the number of items in the list.
Props
Prop | Type | Default | Description |
---|---|---|---|
items | Array | Required | List of items to render (can be an array of any value) |
initialItems | Unsigned Integer |
| Number of items to render initially, or when |
grid | Boolean | Whether to render as grid (equivalent to | |
row | Boolean | Whether to render in horizontal layout direction | |
renderItem | Function | Function(item, index, items, self) to render each item in the list, default is | |
renderRadius | Boolean |Number |
| Percentage of the visible list container size to pre-render items around.
|
Examples
Unique Features
- List items can vary in sizes (both width and height)
- No need to specify or calculate item dimensions
- Grid layout support.
Virtual List works by only rendering the visible items in the list. As user scrolls, it pre-renders the incoming items within renderRadius
, and stops rendering those that scroll out of view.
This dynamic rendering is great for Infinite Scroll experience. It can support millions of rows and columns without UI lags or freezes.