Skip to content

Commit 0caf26b

Browse files
committed
feat: add List component and update related documentation and examples
1 parent cb63718 commit 0caf26b

File tree

18 files changed

+1152
-235
lines changed

18 files changed

+1152
-235
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This is a carefully crafted Expo starter template featuring:
3030
For detailed guidance on specific areas, refer to these specialized instruction files:
3131

3232
- **[API Development](instructions/api.instructions.md)** - API patterns, React Query usage, data fetching
33+
- **[Component Development](instructions/components.instructions.md)** - UI components, List usage, component patterns
3334
- **[State Management](instructions/state.instructions.md)** - Context patterns, global state management
3435
- **[Styling with Unistyles](instructions/styling.instructions.md)** - Theming, responsive design, component styling
3536
- **[Git and Conventional Commits](instructions/git.instructions.md)** - Commit message format, conventional commits,

.github/instructions/api.instructions.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ export const authQueries = {
6161
**Usage in components:**
6262

6363
```typescript
64-
import { FlatList } from 'react-native';
6564
import { StyleSheet } from 'react-native-unistyles';
6665
import { useQuery } from '@/hooks/useQuery/useQuery';
6766
import { authQueries } from '@/api/actions/auth/auth.queries';
68-
import { Typography, Box, Loader } from '@/components/ui';
67+
import { Typography, Box, Loader, List } from '@/components/ui';
6968

7069
const UsersList = () => {
7170
// List with parameters using query factory
@@ -92,12 +91,13 @@ const UsersList = () => {
9291

9392
return (
9493
<Box style={styles.container}>
95-
<FlatList
96-
data={usersResponse?.users}
94+
<List
95+
data={usersResponse?.users || []}
9796
keyExtractor={(item) => item.id}
9897
renderItem={({ item }) => (
9998
<Typography>{item.name}</Typography>
10099
)}
100+
estimatedItemSize={60}
101101
/>
102102
</Box>
103103
);
@@ -234,11 +234,11 @@ export const authQueries = {
234234
**Usage:**
235235
236236
```typescript
237-
import { FlatList, Pressable } from 'react-native';
237+
import { Pressable } from 'react-native';
238238
import { StyleSheet } from 'react-native-unistyles';
239239
import { useInfiniteQuery } from '@/hooks/useInfiniteQuery/useInfiniteQuery';
240240
import { authQueries } from '@/api/actions/auth/auth.queries';
241-
import { Typography, Box } from '@/components/ui';
241+
import { Typography, Box, List } from '@/components/ui';
242242

243243
const InfiniteUsersList = () => {
244244
const {
@@ -276,13 +276,14 @@ const InfiniteUsersList = () => {
276276

277277
return (
278278
<Box style={styles.container}>
279-
<FlatList
279+
<List
280280
data={allUsers}
281281
keyExtractor={(item) => item.id}
282282
renderItem={renderUser}
283283
ListFooterComponent={renderFooter}
284284
onEndReached={() => hasNextPage && fetchNextPage()}
285285
onEndReachedThreshold={0.5}
286+
estimatedItemSize={80}
286287
/>
287288
</Box>
288289
);
@@ -430,11 +431,11 @@ const styles = StyleSheet.create((theme) => ({
430431
1. **Use descriptive names**: `getCurrentUser` not `getUser`
431432
2. **Group related operations**: Keep all auth operations in `auth` collection
432433
3. **Type everything**: Never use `any` - define proper interfaces
433-
4. **Handle loading states**: Always show `Loader` component or loading indicators
434+
4. **Handle loading states**: Always show loading indicators (see [Component Instructions](components.instructions.md))
434435
5. **Handle errors gracefully**: Use `useHandleQueryErrors` and `Alert` for user feedback
435436
6. **Cache efficiently**: Leverage React Query's built-in caching
436437
7. **Use optimistic updates**: For mutations that should feel instant
437-
8. **Follow React Native patterns**: Use `FlatList` for lists, `StyleSheet` for styling
438+
8. **Follow component patterns**: Use project UI components (see [Component Instructions](components.instructions.md))
438439
9. **Use @ aliases**: Import from `@/` for internal modules
439440
10. **Zod imports**: Always use `from 'zod/v4'` instead of `from 'zod'` for schema validation
440441
11. **Constants naming**: Use SCREAMING_SNAKE_CASE for constants (e.g., `BASE_URL`, `REFRESH_TOKEN_URL`)

0 commit comments

Comments
 (0)