/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, DummyLandscapeImage, Grid, ProgressCustom, StackCustom, TextCustom, } from "@/components"; import { countDownAndCondition } from "@/utils/countDownAndCondition"; import { useEffect, useState } from "react"; import { View } from "react-native"; export default function Donation_BoxPublish({ id, data, }: { id: string; data: any; }) { const [value, setValue] = useState({ sisa: 0, reminder: false, }); useEffect(() => { updateCountDown(); }, [data]); const updateCountDown = () => { const countDown = countDownAndCondition({ duration: data?.durasiDonasi, publishTime: data?.publishTime, }); setValue({ sisa: countDown.durationDay, reminder: countDown.reminder, }); }; return ( <> {data?.title || "-"} {value.reminder ? ( Waktu berakhir ) : ( Sisa hari: {value.sisa} )} {/* Terkumpul : Rp 300.000 */} ); }