Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [IOBP-502] Disable swipe back while payment outcome showed #5434

Merged
merged 8 commits into from
Jan 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
WalletPaymentOutcome,
WalletPaymentOutcomeEnum
} from "../types/PaymentOutcomeEnum";
import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton";

type WalletPaymentOutcomeScreenNavigationParams = {
outcome: WalletPaymentOutcome;
Expand All @@ -36,6 +37,8 @@ type WalletPaymentOutcomeRouteProps = RouteProp<
>;

const WalletPaymentOutcomeScreen = () => {
useAvoidHardwareBackButton();

const { params } = useRoute<WalletPaymentOutcomeRouteProps>();
const { outcome } = params;

Expand All @@ -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,
Expand Down
Loading