A real data table for Expo apps.
Sorting, filters, search, pagination, and selection in one typed component. Stop rebuilding a table on top of a list.
- Platforms
- iOS, Android
- Expo SDK
- 55 – 57
- Lists
- FlashList 2
- License
- MIT
OrdersScreen.tsx
import { DataGrid, type ColumnDef } from 'expo-flash-datagrid';
type Order = { id: string; customer: string; total: number; placedAt: string };
const columns: ColumnDef<Order>[] = [
{ field: 'customer', headerName: 'Customer', flex: 1 },
{ field: 'total', headerName: 'Total', type: 'number', width: 110 },
{ field: 'placedAt', headerName: 'Placed', type: 'date', width: 130 },
];
export function OrdersScreen({ orders }: { orders: Order[] }) {
return (
<DataGrid<Order>
mode="client"
rows={orders}
columns={columns}
enableMultiSort
checkboxSelection
style={{ flex: 1 }}
/>
);
}
One prop decides who does the work.
Keep the full dataset on the device, send every query to your API, or mix the two.
All rows are on the device. The grid does the rest.
| Step | Done by |
|---|---|
| Filter | Grid |
| Search | Grid |
| Sort | Grid |
| Paginate | Grid |
<DataGrid<User>
mode="client"
rows={rows}
columns={columns}
/>
What you stop building
| Capability | What the grid handles | Main props |
|---|---|---|
| Sorting | Single or multi-column, with custom comparators | sortModel, enableMultiSort |
| Filtering | Operators and inputs matched to each column type | filterModel, maxFilters |
| Search | Debounced across every searchable column | searchText, searchDebounceMs |
| Pagination | Footer controls with page sizes | paginationModel, rowCount |
| Infinite scroll | Load more as people reach the end | infinite, onEndReached |
| Selection | Checkboxes or long press, tracked by row ID | selectionModel, checkboxSelection |
| Row actions | Long-press menus and actions columns | rowActions, rowActionMenuTrigger |
| Column visibility | A built-in menu to show and hide columns | columnVisibilityModel |
| Theming | Override colors, sizes, and row styles | theme, getRowStyle, zebraRows |
| Localization | English and Portuguese, with overrides | locale, localeText |
Typed from row to callback.
ColumnDef<TRow> carries your row type into formatters, cell renderers, comparators, and row actions.
import { Text } from 'react-native';
import type { ColumnDef } from 'expo-flash-datagrid';
type Invoice = {
id: string;
amount: number;
paid: boolean;
};
export const columns: ColumnDef<Invoice>[] = [
{
field: 'amount',
headerName: 'Amount',
type: 'number',
valueFormatter: (value, row) =>
`${row.paid ? 'Paid' : 'Due'}: $${value}`,
},
{
field: 'paid',
headerName: 'Status',
type: 'boolean',
renderCell: ({ row, isSelected }) => (
<Text
style={{ fontWeight: isSelected ? '700' : '400' }}
>
{row.paid ? 'Settled' : 'Open'}
</Text>
),
},
];
Rendered with FlashList.
On iOS, rows render through FlashList by default. On Android the default is FlatList, and one prop switches it.
listMode | iOS | Android |
|---|---|---|
auto | FlashList | FlatList |
flash-list | FlashList | FlashList |
flat-list | FlatList | FlatList |
import {
applyClientPipeline,
getPaginationRange,
} from 'expo-flash-datagrid';
import { initialQuery, userColumns, users } from '../data';
const { sortedRows, paginatedRows } = applyClientPipeline({
...initialQuery,
rows: users,
columns: userColumns,
searchText: 'recife',
});
export const page = paginatedRows;
export const range = getPaginationRange(
sortedRows.length,
initialQuery.paginationModel
);
Keep the logic, skip the component.
The sort, filter, search, and pagination steps are exported as pure functions. Use them in adapters, tests, or a mock API.
Utilities referenceInstall it.
- npm
- yarn
npm install expo-flash-datagrid @shopify/flash-list react-native-safe-area-context @expo/vector-icons @react-native-community/datetimepicker expo expo-font
yarn add expo-flash-datagrid @shopify/flash-list react-native-safe-area-context @expo/vector-icons @react-native-community/datetimepicker expo expo-font
Wrap your app in SafeAreaProvider, then build your first grid.