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) => ReactElementRender each row
estimatedItemSizenumber60FlashList estimate for perf
separatorbooleanfalseRender simple separators
emptyComponentReactElementRender when data is empty
isLoadingbooleanfalseShow skeleton rows
loadingCountnumber5Skeleton row count

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

PropTypeDefaultDescription
titlestringPrimary text
subtitlestringSecondary text
leadingReactNodeLeading icon or element
trailingReactNodeTrailing icon or element
onPress() => voidRow press handler
onLongPress() => voidLong 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: () => {} }]}
/>