Commit de216ba5 by G

remove onPress event, for CloseModal, it is self handled

parent 9a05e902
import { useModalsManagerContext } from "@/contexts/ModalsManagerContext";
import Button from "@components/Button"; import Button from "@components/Button";
import Box from "@components/bases/Box"; import Box from "@components/bases/Box";
import ErrorIcon from "@components/icons/ErrorIcon"; import ErrorIcon from "@components/icons/ErrorIcon";
...@@ -5,10 +6,11 @@ import { Text } from "react-native"; ...@@ -5,10 +6,11 @@ import { Text } from "react-native";
interface Props { interface Props {
message?: string; message?: string;
onPress?: () => void; // onPress?: () => void;
} }
const ErrorModal = ({ message = "Une erreur s'est produite", onPress = () => {} }: Props) => { const ErrorModal = ({ message = "Une erreur s'est produite" }: Props) => {
const { closeModal } = useModalsManagerContext();
return ( return (
<Box <Box
width={300} width={300}
...@@ -34,7 +36,7 @@ const ErrorModal = ({ message = "Une erreur s'est produite", onPress = () => {} ...@@ -34,7 +36,7 @@ const ErrorModal = ({ message = "Une erreur s'est produite", onPress = () => {}
variant={"fullError"} variant={"fullError"}
textVariants={"white"} textVariants={"white"}
label="Fermer" label="Fermer"
onPress={onPress} onPress={closeModal}
/> />
</Box> </Box>
</Box> </Box>
......
...@@ -85,16 +85,9 @@ const useOrangeMoney = () => { ...@@ -85,16 +85,9 @@ const useOrangeMoney = () => {
if (error instanceof Error) { if (error instanceof Error) {
if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") { if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") {
log.warn("handlePaymentButton | ORANGE_PAYMENT_IN_PROGRESS"); log.warn("handlePaymentButton | ORANGE_PAYMENT_IN_PROGRESS");
showModal( showModal(<ErrorModal message="Le payment est toujours en cours." />);
<ErrorModal
message="Le payment est toujours en cours."
onPress={async () =>
await openBrowserThenCheckStatus(paymentUrl, orderId)
}
/>,
);
} else if (error.name === "ORANGE_PAYMENT_FAILED") { } else if (error.name === "ORANGE_PAYMENT_FAILED") {
showModal(<ErrorModal message="Le paiment à échoué." onPress={closeModal} />); showModal(<ErrorModal message="Le paiment à échoué." />);
log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED"); log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED");
} }
} else { } else {
......
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