/* eslint-disable react-hooks/exhaustive-deps */ import { LoaderCustom, TextCustom, ViewWrapper } from "@/components"; import Investment_BoxDetailDocument from "@/screens/Invesment/Document/RecapBoxDetail"; import { apiInvestmentGetDocument } from "@/service/api-client/api-investment"; import { useFocusEffect, useLocalSearchParams } from "expo-router"; import _ from "lodash"; import { useCallback, useState } from "react"; export default function InvestmentListOfDocument() { const { id } = useLocalSearchParams(); console.log("ID >> ", id); const [list, setList] = useState(null); const [loadList, setLoadList] = useState(false); useFocusEffect( useCallback(() => { onLoadListDocument(); }, [id]) ); const onLoadListDocument = async () => { try { setLoadList(true); const response = await apiInvestmentGetDocument({ id: id as string, category: "all-document", }); setList(response.data); } catch (error) { console.log("[ERROR]", error); setList([]); } finally { setLoadList(false); } }; return ( {loadList ? ( ) : _.isEmpty(list) ? ( Tidak ada data ) : ( list?.map((item: any, index: number) => ( )) )} ); }