import { FlatList, Text, ActivityIndicator, RefreshControl } from "react-native"; import { useState } from "react"; import { listNotices } from "@/api/notices"; import { useQuery } from "@tanstack/react-query"; import { NoticeCard } from "@/components/NoticeCard"; export default function Notices() { const [refreshing, setRefreshing] = useState(false); const { data, isLoading, error, refetch } = useQuery({ queryKey: ["notices"], queryFn: listNotices, }); if (isLoading) { return ; } if (error) { console.log(error.message); return Nie udało sie pobrać listy. {error.message}; } const onRefresh = async () => { setRefreshing(true); await refetch(); setRefreshing(false); }; return ( } refreshControl={ } /> ); }