import { asp as g } from "@asp/asp"; import { Balance } from "@components/Balance"; import { BarnoinPayBackground } from "@components/BarnoinPayBackground"; import BeasyLogoIcon from "@components/BeasyLogoIcon"; import Ionicons from "@expo/vector-icons/Ionicons"; import { LOG } from "@logger"; import { useQuery } from "@tanstack/react-query"; import { Text, View } from "react-native"; import { getPaymentTypes } from "@/features/pay/api"; import PaymentType from "@/features/pay/components/PaymentType"; import type { PaymentStackScreenComponentProps } from "@/navigations/types"; const log = LOG.extend("HomePageWithPaymentOptions"); const HomePageWithPaymentOptions: PaymentStackScreenComponentProps< "homePageWithPaymentOptions" > = ({ navigation }) => { log.debug("HomePageWithPaymentOptions"); const paymentTypesQuery = useQuery({ queryKey: ["paymentTypes"], queryFn: getPaymentTypes, }); const paymentTypes = paymentTypesQuery.isSuccess ? Object.keys(paymentTypesQuery.data.data.results) .map((key) => paymentTypesQuery.data.data.results[key]) .filter((item) => item.etat === true) : []; return ( Types de paiement {paymentTypes.map((paymentType) => { return ( { navigation.navigate("paymentAmountInputScreen", { paymentType, }); }} key={paymentType.reference} style={[{ width: "47%" }]} type={paymentType.code} /> ); })} ); }; export default HomePageWithPaymentOptions;