Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
b6aedca7
You need to sign in or sign up before continuing.
Commit
b6aedca7
authored
May 29, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the custom hook to retrieve and show transactions history
parent
b3c5e622
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
28 deletions
+36
-28
TransactionHistoryScreen.tsx
src/screens/TransactionHistoryScreen.tsx
+36
-28
No files found.
src/screens/TransactionHistoryScreen.tsx
View file @
b6aedca7
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
(
<
BackgroundWithBeasyIconAndWhiteContentArea
>
<
ScrollView
refreshControl=
{
<
RefreshControl
refreshing=
{
isLoading
}
onRefresh=
{
refetch
}
/>
}
contentContainerStyle=
{
{
gap
:
10
,
padding
:
10
,
marginTop
:
10
,
paddingBottom
:
30
,
flexDirection
:
"column"
,
}
}
showsVerticalScrollIndicator=
{
false
}
>
{
data
?.
map
((
transaction
)
=>
(
<
TransactionInformationsItem
key=
{
transaction
.
reference
}
paymentType=
{
transaction
.
type_paiement_label
}
reference=
{
transaction
.
reference
}
amount=
{
transaction
.
montant
}
date=
{
transaction
.
date
}
status=
{
transaction
.
status
}
/>
))
}
</
ScrollView
>
<>
<
Box
px=
{
"m"
}
mt=
{
"m"
}
>
<
Input
label=
{
"Reference"
}
/>
</
Box
>
<
ScrollView
refreshControl=
{
<
RefreshControl
refreshing=
{
isLoading
}
onRefresh=
{
refetch
}
/>
}
contentContainerStyle=
{
{
gap
:
10
,
padding
:
10
,
// marginTop: 10,
paddingBottom
:
30
,
flexDirection
:
"column"
,
}
}
showsVerticalScrollIndicator=
{
false
}
>
{
data
?.
map
((
transaction
)
=>
(
<
TransactionInformationsItem
key=
{
transaction
.
reference
}
paymentType=
{
transaction
.
type_paiement_label
}
reference=
{
transaction
.
reference
}
amount=
{
transaction
.
montant
}
date=
{
transaction
.
date
}
status=
{
transaction
.
status
}
/>
))
}
</
ScrollView
>
</>
</
BackgroundWithBeasyIconAndWhiteContentArea
>
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment