Commit c84d94d2 by G

- remove safeAreaView that caused a wrong offset on the bottom side of the screen

- manually rounding the white container around the input amount - remove the balance container container - add 'montant à payé' label and its amount right below it. - continuously update the total in the header part when changed
parent 57b49330
import type { PaymentStackScreenComponentProps } from "@/navigations/Types"; import type { PaymentStackScreenComponentProps } from "@/navigations/Types";
import BalanceContainer from "@components/BalanceContainer";
import BeasyLogoIcon from "@components/BeasyLogoIcon"; import BeasyLogoIcon from "@components/BeasyLogoIcon";
import Button from "@components/Button"; import Button from "@components/Button";
import GoBackIconButton from "@components/GoBackIconButton"; import GoBackIconButton from "@components/GoBackIconButton";
import Input from "@components/Input"; import Input from "@components/Input";
import PaymentOption from "@components/PaymentOption"; import PaymentOption from "@components/PaymentOption";
import BackgroundGreenWhiteContentArea from "@components/backgrounds/BackgroundGreenWhiteContentArea"; import BackgroundDefault from "@components/backgrounds/BackgroundDefault";
import Box from "@components/bases/Box"; import Box from "@components/bases/Box";
import { SafeAreaView } from "react-native-safe-area-context"; import Text from "@components/bases/Text";
import { useState } from "react";
import { useSafeAreaInsets } from "react-native-safe-area-context";
const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountInputScreen"> = ({ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountInputScreen"> = ({
route, route,
navigation, navigation,
}) => { }) => {
const { paymentType } = route.params; const { paymentType } = route.params;
const [amountToPay, setAmountToPay] = useState(0);
console.log("Payment type :: {}", paymentType); const insets = useSafeAreaInsets();
const updateAmountToPay = (amount: string) => {
const amountParsed = Number.parseInt(amount);
if (!Number.isNaN(amountParsed)) {
return setAmountToPay(amountParsed);
}
return setAmountToPay(0);
};
return ( return (
<BackgroundGreenWhiteContentArea> <BackgroundDefault>
<SafeAreaView> {/* <SafeAreaView> */}
<Box style={{ height: "100%", width: "100%" }}> <Box
style={{
height: "100%",
width: "100%",
marginTop: insets.top,
}}
>
<Box <Box
px={"l"} px={"l"}
flexDirection={"row"} flexDirection={"row"}
justifyContent={"space-between"} justifyContent={"space-between"}
alignItems={"center"} alignItems={"center"}
mb={"l"} mb={"m"}
> >
<BeasyLogoIcon /> <BeasyLogoIcon />
<GoBackIconButton onPress={() => navigation.goBack()} /> <GoBackIconButton onPress={() => navigation.goBack()} />
</Box> </Box>
<Box height={150} alignItems={"center"} justifyContent={"center"}> {/* <Box height={150} alignItems={"center"} justifyContent={"center"}>
<BalanceContainer balance={78000} label="Total des ventes" /> <BalanceContainer balance={78000} label="Total des ventes" />
</Box> */}
<Box height={90} padding={"s"} paddingLeft={"l"}>
<Text color={"black"}>Montant à payé</Text>
<Text color={"black"} variant={"header"}>
{amountToPay}
</Text>
</Box> </Box>
<Box p={"l"} paddingTop={"xl"}> <Box
p={"l"}
paddingTop={"xl"}
backgroundColor={"white"}
flex={1}
borderTopLeftRadius={20}
borderTopRightRadius={20}
>
<Box width={75} height={50} mb={"l"} borderRadius={10} overflow={"hidden"}> <Box width={75} height={50} mb={"l"} borderRadius={10} overflow={"hidden"}>
<PaymentOption onPress={() => {}} paymentMethod={paymentType} /> <PaymentOption onPress={() => {}} paymentMethod={paymentType} />
</Box> </Box>
...@@ -43,6 +73,7 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI ...@@ -43,6 +73,7 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI
label="Entrez le montant" label="Entrez le montant"
autoFocus={true} autoFocus={true}
keyboardType="numeric" keyboardType="numeric"
onChangeText={(e) => updateAmountToPay(e)}
/> />
</Box> </Box>
<Button <Button
...@@ -53,8 +84,8 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI ...@@ -53,8 +84,8 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI
/> />
</Box> </Box>
</Box> </Box>
</SafeAreaView> {/* </SafeAreaView> */}
</BackgroundGreenWhiteContentArea> </BackgroundDefault>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment