diff --git a/app/(application)/notification.tsx b/app/(application)/notification.tsx index 49c4e25..0722e26 100644 --- a/app/(application)/notification.tsx +++ b/app/(application)/notification.tsx @@ -9,7 +9,7 @@ import { pushToPage } from "@/lib/pushToPage"; import { useAuthSession } from "@/providers/AuthProvider"; import { Feather } from "@expo/vector-icons"; import { useEffect, useState } from "react"; -import { SafeAreaView, View, VirtualizedList } from "react-native"; +import { RefreshControl, SafeAreaView, View, VirtualizedList } from "react-native"; import { useDispatch, useSelector } from "react-redux"; type Props = { @@ -31,6 +31,7 @@ export default function Notification() { const arrSkeleton = Array.from({ length: 5 }, (_, index) => index) const dispatch = useDispatch() const updateNotification = useSelector((state: any) => state.notificationUpdate) + const [refreshing, setRefreshing] = useState(false) async function handleLoad(loading: boolean, thisPage: number) { try { @@ -88,33 +89,12 @@ export default function Notification() { } } - // function pushToPage(category: string, idContent: string) { - // const cat = category.split('/') - // if (cat.length > 1) { - // if (cat[2] == 'calendar') { - // router.push(`/division/${cat[1]}/calendar/${idContent}`) - // } else if (cat[2] == 'discussion') { - // router.push(`/division/${cat[1]}/discussion/${idContent}`) - // } else if (cat[2] == 'document') { - // router.push(`/division/${cat[1]}/document/${idContent}`) - // } else if (cat[2] == 'task') { - // router.push(`/division/${cat[1]}/task/${idContent}`) - // } - // } else { - // if (cat[0] == 'announcement') { - // router.push(`/announcement/${idContent}`) - // } else if (cat[0] == 'discussion-general') { - // router.push(`/discussion/${idContent}`) - // } else if (cat[0] == 'division') { - // router.push(`/division/${idContent}`) - // } else if (cat[0] == 'member') { - // router.push(`/member/${idContent}`) - // } else if (cat[0] == 'project') { - // router.push(`/project/${idContent}`) - // } - // } - // } - + const handleRefresh = async () => { + setRefreshing(true) + handleLoad(false, 1) + await new Promise(resolve => setTimeout(resolve, 2000)); + setRefreshing(false) + }; return ( @@ -156,6 +136,12 @@ export default function Notification() { onEndReached={loadMoreData} onEndReachedThreshold={0.5} showsVerticalScrollIndicator={false} + refreshControl={ + + } /> : Tidak ada data