From 1e73ed600f6e697ebf05fae55b639a11b7cb38ca Mon Sep 17 00:00:00 2001 From: Federico Mastrini Date: Fri, 12 Jan 2024 15:57:40 +0100 Subject: [PATCH] chore: [IOBP-486] Add hardware button back navigation in Barcode scan screen for Android devices (#5395) ## Short description This PR enables the back navigation using hardware buttons on Android ## List of changes proposed in this pull request - `ts/features/barcode/screens/BarcodeScanScreen.tsx`: added `useHardwareBackButton` ## How to test Within the Barcode scan screen, try to navigate back using Android hardware back button. --- ts/features/barcode/screens/BarcodeScanScreen.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ts/features/barcode/screens/BarcodeScanScreen.tsx b/ts/features/barcode/screens/BarcodeScanScreen.tsx index 2117641b07c..b5d54f90311 100644 --- a/ts/features/barcode/screens/BarcodeScanScreen.tsx +++ b/ts/features/barcode/screens/BarcodeScanScreen.tsx @@ -39,6 +39,7 @@ import { import { BarcodeFailure } from "../types/failure"; import { getIOBarcodesByType } from "../utils/getBarcodesByType"; import { WalletBarcodeRoutes } from "../../walletV3/barcode/navigation/routes"; +import { useHardwareBackButton } from "../../../hooks/useHardwareBackButton"; const BarcodeScanScreen = () => { const navigation = useNavigation>(); @@ -46,6 +47,11 @@ const BarcodeScanScreen = () => { const openDeepLink = useOpenDeepLink(); const isIdPayEnabled = useIOSelector(isIdPayEnabledSelector); + useHardwareBackButton(() => { + navigation.goBack(); + return true; + }); + const { dataMatrixPosteEnabled } = useIOSelector( barcodesScannerConfigSelector );