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
6e46d04b
Commit
6e46d04b
authored
May 08, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rendering all payment options inside a single container
parent
f785d1ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
+30
-12
HomePageWithPaymentOptions.tsx
src/screens/HomePageWithPaymentOptions.tsx
+30
-12
No files found.
src/screens/HomePageWithPaymentOptions.tsx
View file @
6e46d04b
...
@@ -8,9 +8,12 @@ import BackgroundGreenWhiteContentArea from "@components/backgrounds/BackgroundG
...
@@ -8,9 +8,12 @@ import BackgroundGreenWhiteContentArea from "@components/backgrounds/BackgroundG
import
Box
from
"@components/bases/Box"
;
import
Box
from
"@components/bases/Box"
;
import
Text
from
"@components/bases/Text"
;
import
Text
from
"@components/bases/Text"
;
import
{
useQuery
}
from
"@tanstack/react-query"
;
import
{
useQuery
}
from
"@tanstack/react-query"
;
import
{
useMemo
}
from
"react"
;
import
{
Dimensions
}
from
"react-native"
;
import
{
Dimensions
}
from
"react-native"
;
import
{
SafeAreaView
}
from
"react-native-safe-area-context"
;
import
{
SafeAreaView
}
from
"react-native-safe-area-context"
;
const
PAYMENT_TYPES
=
new
Set
([
"ORANGE"
,
"FLOOZ"
,
"MTN"
,
"WAVE"
,
"CB"
]);
const
HomePageWithPaymentOptions
:
PaymentStackScreenComponentProps
<
"homePageWithPaymentOptions"
>
=
const
HomePageWithPaymentOptions
:
PaymentStackScreenComponentProps
<
"homePageWithPaymentOptions"
>
=
({
navigation
})
=>
{
({
navigation
})
=>
{
const
{
data
,
isLoading
,
error
}
=
useQuery
({
const
{
data
,
isLoading
,
error
}
=
useQuery
({
...
@@ -19,9 +22,15 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
...
@@ -19,9 +22,15 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
enabled
:
true
,
enabled
:
true
,
});
});
console
.
log
(
"data"
,
data
);
// getting valid payments supported
console
.
log
(
"isLoading"
,
isLoading
);
const
paymentTypesToRender
=
useMemo
(()
=>
{
console
.
log
(
"error"
,
error
);
console
.
log
(
"Filtering payment types"
);
const
paymentTypes
=
data
?.
results
||
[];
return
paymentTypes
.
filter
((
paymentType
)
=>
PAYMENT_TYPES
.
has
(
paymentType
.
code
));
},
[
data
]);
console
.
log
(
"paymentTypesToRender"
,
paymentTypesToRender
);
return
(
return
(
<
BackgroundGreenWhiteContentArea
>
<
BackgroundGreenWhiteContentArea
>
<
SafeAreaView
>
<
SafeAreaView
>
...
@@ -44,7 +53,14 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
...
@@ -44,7 +53,14 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
Méthode de paiement
Méthode de paiement
</
Text
>
</
Text
>
</
Box
>
</
Box
>
<
Box
flexDirection=
{
"row"
}
justifyContent=
{
"space-between"
}
mb=
{
"s"
}
>
{
/* <Box flexDirection={"row"} justifyContent={"space-between"} mb={"s"}> */
}
<
Box
flex=
{
1
}
flexDirection=
{
"row"
}
justifyContent=
{
"space-between"
}
flexWrap=
{
"wrap"
}
rowGap=
{
"m"
}
>
<
PaymentOptionContainer
>
<
PaymentOptionContainer
>
<
PaymentOption
<
PaymentOption
onPress=
{
()
=>
onPress=
{
()
=>
...
@@ -61,8 +77,6 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
...
@@ -61,8 +77,6 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
paymentMethod=
{
"MtnMoney"
}
paymentMethod=
{
"MtnMoney"
}
/>
/>
</
PaymentOptionContainer
>
</
PaymentOptionContainer
>
</
Box
>
<
Box
flexDirection=
{
"row"
}
justifyContent=
{
"space-between"
}
mb=
{
"s"
}
>
<
PaymentOptionContainer
>
<
PaymentOptionContainer
>
<
PaymentOption
<
PaymentOption
onPress=
{
()
=>
onPress=
{
()
=>
...
@@ -71,6 +85,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
...
@@ -71,6 +85,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
paymentMethod=
{
"MoovMoney"
}
paymentMethod=
{
"MoovMoney"
}
/>
/>
</
PaymentOptionContainer
>
</
PaymentOptionContainer
>
<
PaymentOptionContainer
>
<
PaymentOptionContainer
>
<
PaymentOption
<
PaymentOption
onPress=
{
()
=>
onPress=
{
()
=>
...
@@ -79,13 +94,16 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
...
@@ -79,13 +94,16 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
paymentMethod=
{
"WaveMoney"
}
paymentMethod=
{
"WaveMoney"
}
/>
/>
</
PaymentOptionContainer
>
</
PaymentOptionContainer
>
<
PaymentOptionContainer
>
<
PaymentOption
onPress=
{
()
=>
navigation
.
navigate
(
"paymentAmountInputScreen"
)
}
paymentMethod=
{
"VisaCard"
}
/>
</
PaymentOptionContainer
>
</
Box
>
</
Box
>
<
PaymentOptionContainer
>
<
PaymentOption
onPress=
{
()
=>
navigation
.
navigate
(
"paymentAmountInputScreen"
)
}
paymentMethod=
{
"VisaCard"
}
/>
</
PaymentOptionContainer
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
SafeAreaView
>
</
SafeAreaView
>
...
...
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