diff --git a/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx b/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx index 6654b6bb063..2019e066ea5 100644 --- a/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx +++ b/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx @@ -25,6 +25,7 @@ import { WalletPaymentOutcome, WalletPaymentOutcomeEnum } from "../types/PaymentOutcomeEnum"; +import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton"; type WalletPaymentOutcomeScreenNavigationParams = { outcome: WalletPaymentOutcome; @@ -36,6 +37,8 @@ type WalletPaymentOutcomeRouteProps = RouteProp< >; const WalletPaymentOutcomeScreen = () => { + useAvoidHardwareBackButton(); + const { params } = useRoute(); const { outcome } = params; @@ -47,6 +50,18 @@ const WalletPaymentOutcomeScreen = () => { outcome }); + // TODO: This is a workaround to disable swipe back gesture on this screen + // .. it should be removed as soon as the migration to react-navigation v6 is completed (https://pagopa.atlassian.net/browse/IOBP-522) + React.useEffect(() => { + // Disable swipe + navigation.setOptions({ gestureEnabled: false }); + navigation.getParent()?.setOptions({ gestureEnabled: false }); + // Re-enable swipe after going back + return () => { + navigation.getParent()?.setOptions({ gestureEnabled: true }); + }; + }, [navigation]); + const paymentAmount = pipe( paymentDetailsPot, pot.toOption,