import { ActivityIndicator, FlatList, StyleSheet, View } from "react-native"; import { EmptyState } from "@/components/ui/EmptyState"; import { SectionHeader } from "@/components/ui/Sections"; import { NotificationRow } from "@/components/notifications/NotificationRow"; import { useNotificationsInfinite } from "@/hooks"; import { Colors, Spacing } from "@/constants/theme"; export default function NotificationsInbox() { const { data, isLoading, fetchNextPage, hasNextPage, isFetchingNextPage, } = useNotificationsInfinite(); const notifications = data?.pages.flatMap((page) => page.notifications) ?? []; return ( String(notification.id)} renderItem={({ item }) => } ListHeaderComponent={ notifications.length > 0 ? : null } contentContainerStyle={styles.content} onEndReachedThreshold={0.5} onEndReached={() => { if (hasNextPage && !isFetchingNextPage) fetchNextPage(); }} ListEmptyComponent={ isLoading ? ( ) : ( ) } ListFooterComponent={ isFetchingNextPage ? ( ) : null } /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: Colors.light.background, }, content: { paddingHorizontal: Spacing.containerPadding, paddingVertical: Spacing.sectionGap, }, footer: { paddingVertical: Spacing.cardGap, }, });