import Styles from "@/constants/Styles"; import { apiGetDivisionOneFeature } from "@/lib/api"; import { useAuthSession } from "@/providers/AuthProvider"; import { Feather } from "@expo/vector-icons"; import { useLocalSearchParams } from "expo-router"; import React, { useEffect, useState } from "react"; import { Dimensions, Text, View } from "react-native"; import { ICarouselInstance } from "react-native-reanimated-carousel"; import Skeleton from "../skeleton"; type Props = { id: string name: string extension: string path: string share: boolean } export default function FileDivisionDetail() { const ref = React.useRef(null); const width = Dimensions.get("window").width; const [data, setData] = useState([]) const { token, decryptToken } = useAuthSession() const { id } = useLocalSearchParams<{ id: string }>() const [loading, setLoading] = useState(true) async function handleLoad() { try { setLoading(true) const hasil = await decryptToken(String(token?.current)) const response = await apiGetDivisionOneFeature({ user: hasil, id, cat: 'new-file' }) setData(response.data) } catch (error) { console.error(error) } finally { setLoading(false) } } useEffect(() => { handleLoad() }, []) return ( Dokumen Terkini { loading ? : data.length > 0 ? { data.map((item, index) => ( {item.name}.{item.extension} )) } // ( // // // // // // // {data[index].name}.{data[index].extension} // // )} // /> : Tidak ada file } ) }