upd : home page

Deskripsi:
- load refresh pada halaman home

No Issues
This commit is contained in:
2025-09-09 11:49:13 +08:00
parent a15724756e
commit 060f96e7b2
8 changed files with 89 additions and 37 deletions

View File

@@ -20,16 +20,16 @@ type Props = {
createdAt: string
}
export default function ProjectHome() {
export default function ProjectHome({ refreshing }: { refreshing: boolean }) {
const { decryptToken, token } = useAuthSession()
const ref = React.useRef<ICarouselInstance>(null);
const width = Dimensions.get("window").width;
const [data, setData] = useState<Props[]>([])
const [loading, setLoading] = useState(true)
async function handleData() {
async function handleData(loading: boolean) {
try {
setLoading(true)
setLoading(loading)
const hasil = await decryptToken(String(token?.current))
const response = await apiGetDataHome({ cat: "kegiatan", user: hasil })
setData(response.data)
@@ -41,12 +41,17 @@ export default function ProjectHome() {
}
useEffect(() => {
handleData()
if (refreshing)
handleData(false)
}, [refreshing]);
useEffect(() => {
handleData(true)
}, []);
return (
<View style={[Styles.mb15]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Kegiatan Terupdate</Text>
<Text style={[Styles.textDefaultSemiBold, Styles.mb10]}>Kegiatan Terupdate</Text>
{
loading ? (<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />)
: