From 54b6a8e0bd8f5c71098d7b6a47f69aac6f6923b5 Mon Sep 17 00:00:00 2001 From: Alessandro Izzo Date: Wed, 24 Jan 2024 14:24:02 +0100 Subject: [PATCH 1/2] chore: Disable swipe back and android back in payment outcome screen --- .../screens/WalletPaymentOutcomeScreen.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx b/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx index 6654b6bb063..84ac5ff06ac 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 }); + // 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 + 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, From 86f52584f9264aa3477f75af6a659c3fd7fae345 Mon Sep 17 00:00:00 2001 From: Alessandro Izzo Date: Thu, 25 Jan 2024 14:02:56 +0100 Subject: [PATCH 2/2] docs: added jira ticket reference to the workaround comment --- .../walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx b/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx index 84ac5ff06ac..2019e066ea5 100644 --- a/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx +++ b/ts/features/walletV3/payment/screens/WalletPaymentOutcomeScreen.tsx @@ -50,8 +50,8 @@ const WalletPaymentOutcomeScreen = () => { outcome }); - // 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 + // 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 });