From b6aedca7eb008eefd4d0490d7188504108bb17c3 Mon Sep 17 00:00:00 2001 From: G Date: Wed, 29 May 2024 17:08:47 +0000 Subject: [PATCH] use the custom hook to retrieve and show transactions history --- src/screens/TransactionHistoryScreen.tsx | 64 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/src/screens/TransactionHistoryScreen.tsx b/src/screens/TransactionHistoryScreen.tsx index e2947eb..d001385 100644 --- a/src/screens/TransactionHistoryScreen.tsx +++ b/src/screens/TransactionHistoryScreen.tsx @@ -1,8 +1,9 @@ -import { getTransactionsHistory } from "@/utils/requests/transactions"; +import Input from "@components/Input"; import TransactionInformationsItem from "@components/TransactionInformationsItem"; import BackgroundWithBeasyIconAndWhiteContentArea from "@components/backgrounds/BackgroundWithBeasyIconAndWhiteContentArea"; +import Box from "@components/bases/Box"; +import useTransactionsHistory from "@hooks/useTransactionsHistory"; import { LOG } from "@logger"; -import { useQuery } from "@tanstack/react-query"; import { RefreshControl, ScrollView } from "react-native"; const log = LOG.extend("TransactionHistoryScreen"); @@ -10,37 +11,44 @@ const log = LOG.extend("TransactionHistoryScreen"); const TransactionHistoryScreen = () => { log.verbose("TransactionHistoryScreen"); - const { data, isLoading, error, refetch } = useQuery({ - queryKey: ["transactionsHistory"], - queryFn: getTransactionsHistory, - }); + const { transactionsHistory: data, isLoading, error, refetch } = useTransactionsHistory(); + + // const { data, isLoading, error, refetch } = useQuery({ + // queryKey: ["transactionsHistory"], + // queryFn: getTransactionsHistory, + // }); console.info("Data", data); return ( - } - contentContainerStyle={{ - gap: 10, - padding: 10, - marginTop: 10, - paddingBottom: 30, - flexDirection: "column", - }} - showsVerticalScrollIndicator={false} - > - {data?.map((transaction) => ( - - ))} - + <> + + + + } + contentContainerStyle={{ + gap: 10, + padding: 10, + // marginTop: 10, + paddingBottom: 30, + flexDirection: "column", + }} + showsVerticalScrollIndicator={false} + > + {data?.map((transaction) => ( + + ))} + + ); }; -- libgit2 0.27.1