fix : notification page
Deskripsi: - load refresh notification page No Issues
This commit is contained in:
@@ -9,7 +9,7 @@ import { pushToPage } from "@/lib/pushToPage";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
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";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -31,6 +31,7 @@ export default function Notification() {
|
|||||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const updateNotification = useSelector((state: any) => state.notificationUpdate)
|
const updateNotification = useSelector((state: any) => state.notificationUpdate)
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
async function handleLoad(loading: boolean, thisPage: number) {
|
async function handleLoad(loading: boolean, thisPage: number) {
|
||||||
try {
|
try {
|
||||||
@@ -88,33 +89,12 @@ export default function Notification() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function pushToPage(category: string, idContent: string) {
|
const handleRefresh = async () => {
|
||||||
// const cat = category.split('/')
|
setRefreshing(true)
|
||||||
// if (cat.length > 1) {
|
handleLoad(false, 1)
|
||||||
// if (cat[2] == 'calendar') {
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
// router.push(`/division/${cat[1]}/calendar/${idContent}`)
|
setRefreshing(false)
|
||||||
// } 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}`)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
@@ -156,6 +136,12 @@ export default function Notification() {
|
|||||||
onEndReached={loadMoreData}
|
onEndReached={loadMoreData}
|
||||||
onEndReachedThreshold={0.5}
|
onEndReachedThreshold={0.5}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={refreshing}
|
||||||
|
onRefresh={handleRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user