From de216ba5321f42cef711dcdd2d422a99df50a6d6 Mon Sep 17 00:00:00 2001 From: G Date: Tue, 28 May 2024 15:31:49 +0000 Subject: [PATCH] remove onPress event, for CloseModal, it is self handled --- src/components/modals/ErrorModal.tsx | 8 +++++--- src/hooks/useOrangeMoney.tsx | 11 ++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/components/modals/ErrorModal.tsx b/src/components/modals/ErrorModal.tsx index b5b59cc..5623afd 100644 --- a/src/components/modals/ErrorModal.tsx +++ b/src/components/modals/ErrorModal.tsx @@ -1,3 +1,4 @@ +import { useModalsManagerContext } from "@/contexts/ModalsManagerContext"; import Button from "@components/Button"; import Box from "@components/bases/Box"; import ErrorIcon from "@components/icons/ErrorIcon"; @@ -5,10 +6,11 @@ import { Text } from "react-native"; interface Props { 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 ( {} variant={"fullError"} textVariants={"white"} label="Fermer" - onPress={onPress} + onPress={closeModal} /> diff --git a/src/hooks/useOrangeMoney.tsx b/src/hooks/useOrangeMoney.tsx index 4a8a2d0..3612365 100644 --- a/src/hooks/useOrangeMoney.tsx +++ b/src/hooks/useOrangeMoney.tsx @@ -85,16 +85,9 @@ const useOrangeMoney = () => { if (error instanceof Error) { if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") { log.warn("handlePaymentButton | ORANGE_PAYMENT_IN_PROGRESS"); - showModal( - - await openBrowserThenCheckStatus(paymentUrl, orderId) - } - />, - ); + showModal(); } else if (error.name === "ORANGE_PAYMENT_FAILED") { - showModal(); + showModal(); log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED"); } } else { -- libgit2 0.27.1