import Styles from "@/constants/Styles"; import { apiGetDataHome } from "@/lib/api"; import { useAuthSession } from "@/providers/AuthProvider"; import { router } from "expo-router"; import React, { useEffect, useState } from "react"; import { Dimensions, Text, View } from "react-native"; import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel"; import PaperGridContent from "../paperGridContent"; type Props = { id: string name: string jumlah: number } export default function DivisionHome() { const { decryptToken, token } = useAuthSession() const ref = React.useRef(null); const width = Dimensions.get("window").width; const [data, setData] = useState([]) async function handleData() { try { const hasil = await decryptToken(String(token?.current)) const response = await apiGetDataHome({ cat: "division", user: hasil }) setData(response.data) } catch (error) { console.error(error) } } useEffect(() => { handleData() }, []); return ( Divisi Teraktif ( { router.push(`/division/${data[index].id}`) }} content="carousel" title={data[index].name} headerColor="warning"> {data[index].jumlah} KEGIATAN )} /> ) }