Skip to content

List

High-performance list built on FlashList, with optional swipe actions and section headers.

import { List, ListItem, SectionHeader } from "@truongdq01/ui";
import { Mail, ChevronRight } from "lucide-react-native";
const items = [
{ id: "1", title: "Inbox", subtitle: "5 unread" },
{ id: "2", title: "Archive", subtitle: "Updated yesterday" },
];
<SectionHeader title="Today" />
<List
data={items}
keyExtractor={(item) => item.id}
estimatedItemSize={64}
renderItem={(item, index) => (
<ListItem
title={item.title}
subtitle={item.subtitle}
leading={<Mail />}
trailing={<ChevronRight />}
showSeparator={index < items.length - 1}
/>
)}
/>
PropTypeDefaultDescription
dataT[]—Array of items
renderItem(item: T, index: number) => ReactElement—Render each row
estimatedItemSizenumber60FlashList estimate for perf
separatorbooleanfalseRender simple separators
emptyComponentReactElement—Render when data is empty
isLoadingbooleanfalseShow skeleton rows
loadingCountnumber5Skeleton row count

List also accepts all FlashList props (e.g. contentContainerStyle, refreshing, onEndReached).

PropTypeDefaultDescription
titlestring—Primary text
subtitlestring—Secondary text
leadingReactNode—Leading icon or element
trailingReactNode—Trailing icon or element
onPress() => void—Row press handler
onLongPress() => void—Long press handler
leadingActionsSwipeAction[][]Swipe-right actions
trailingActionsSwipeAction[][]Swipe-left actions
disabledbooleanfalseDisable interaction
showSeparatorbooleantrueShow bottom separator

SwipeAction shape:

  • label: string
  • color: string
  • textColor?: string
  • onPress: () => void
<ListItem
title="Delete me"
trailingActions={[{ label: 'Delete', color: '#F44336', onPress: () => {} }]}
/>