- app/(application)/(user)/donation/(tabs)/index.tsx - app/(application)/(user)/donation/(tabs)/my-donation.tsx - app/(application)/(user)/donation/[id]/(transaction-flow)/index.tsx Donation – Admin - app/(application)/admin/donation/[id]/disbursement-of-funds.tsx Image Preview - app/(application)/(image)/preview-image/[id]/index.tsx ### No Issue
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import {
|
|
FloatingButton,
|
|
LoaderCustom,
|
|
TextCustom,
|
|
ViewWrapper,
|
|
} from "@/components";
|
|
import Donation_BoxPublish from "@/screens/Donation/BoxPublish";
|
|
import { apiDonationGetAll } from "@/service/api-client/api-donation";
|
|
import { router, useFocusEffect } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useCallback, useState } from "react";
|
|
|
|
export default function DonationBeranda() {
|
|
const [list, setList] = useState<any[] | null>(null);
|
|
const [loadList, setLoadList] = useState(false);
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
onLoadData();
|
|
}, [])
|
|
);
|
|
|
|
const onLoadData = async () => {
|
|
try {
|
|
setLoadList(true);
|
|
const response = await apiDonationGetAll({
|
|
category: "beranda"
|
|
});
|
|
|
|
setList(response.data);
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
} finally {
|
|
setLoadList(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<ViewWrapper
|
|
hideFooter
|
|
floatingButton={
|
|
<FloatingButton onPress={() => router.push("/donation/create")} />
|
|
}
|
|
>
|
|
{loadList ? (
|
|
<LoaderCustom />
|
|
) : _.isEmpty(list) ? (
|
|
<TextCustom align="center" color="gray">Belum ada donasi</TextCustom>
|
|
) : (
|
|
list?.map((item: any, index: number) => (
|
|
<Donation_BoxPublish data={item} key={index} id={item.id} />
|
|
))
|
|
)}
|
|
</ViewWrapper>
|
|
);
|
|
}
|