🚧 VeloxKit is pre-release software. APIs may change before v1.0. Get started →
Documentation
Components
VirtualizedList

VirtualizedList Stable WINMACLNX

A high-performance list that only renders the rows visible on screen (plus a configurable overscan buffer). For lists of 100+ items where ScrollView becomes sluggish.

Import

import { VirtualizedList } from 'veloxkit'

Basic usage

import { VirtualizedList, View, Text } from 'veloxkit'
 
const ITEM_HEIGHT = 56
 
function ContactList({ contacts }: { contacts: Contact[] }) {
  return (
    <VirtualizedList
      data={contacts}
      itemHeight={ITEM_HEIGHT}
      height={600}
      width={400}
      keyExtractor={(item) => String(item.id)}
      renderItem={({ item }) => (
        <View style={{ height: ITEM_HEIGHT, paddingHorizontal: 16, justifyContent: 'center' }}>
          <Text style={{ fontSize: 15 }}>{item.name}</Text>
          <Text style={{ fontSize: 12, color: '#888' }}>{item.email}</Text>
        </View>
      )}
    />
  )
}

itemHeight must be a fixed number — all rows must be the same height. Variable-height lists are not yet supported.

Props

PropTypeDefaultDescription
dataT[]Array of items to render
renderItem({ item: T, index: number }) => ReactNodeCalled for each visible item
itemHeightnumberRequired. Fixed height of each row in pixels
heightnumberRequired. Visible height of the list container
widthnumberWidth of the container and each row
keyExtractor(item: T, index: number) => stringString(index)Unique key for each row
overscannumber5Extra rows to render above and below the visible window
showScrollbarbooleantrueShow the scroll indicator
scrollbarWidthnumber8Width of the scrollbar in pixels
scrollbarColorstring'#8c8caa99'Scrollbar color (hex or rgba string)
styleViewStyleAdditional styles for the container

Scrolling to a row

Use a ref to scroll programmatically:

import { VirtualizedList, VirtualizedListRef } from 'veloxkit'
import { useRef } from 'react'
 
function MyList({ items }) {
  const listRef = useRef<VirtualizedListRef>(null)
 
  function scrollToBottom() {
    listRef.current?.scrollToIndex(items.length - 1)
  }
 
  return (
    <VirtualizedList
      ref={listRef}
      data={items}
      itemHeight={48}
      height={400}
      width={320}
      renderItem={({ item }) => <Row item={item} />}
    />
  )
}

When to use VirtualizedList vs ScrollView

ScrollViewVirtualizedList
Renders all children at onceYesNo — only visible rows
Suitable for 100+ itemsNoYes
Variable-height childrenYesNo
Programmatic scrollscrollToscrollToIndex

Use ScrollView for content with mixed sizes (paragraphs, cards, images). Use VirtualizedList for long uniform lists (contacts, messages, log entries, table rows).

Performance notes

  • Keep renderItem fast — it's called on every frame during scroll for newly-visible rows.
  • itemHeight must match the actual rendered height. A mismatch causes items to overlap or leave gaps.
  • Increase overscan if you see brief blank rows during fast flings (at the cost of slightly more renders).