diff --git a/native/profile/linked-devices-header-right-button.react.js b/native/profile/linked-devices-header-right-button.react.js --- a/native/profile/linked-devices-header-right-button.react.js +++ b/native/profile/linked-devices-header-right-button.react.js @@ -6,15 +6,25 @@ import { SecondaryDeviceQRCodeScannerRouteName } from '../navigation/route-names.js'; import { useStyles } from '../themes/colors.js'; +import Alert from '../utils/alert.js'; +import { devIsEmulator } from '../utils/url-utils.js'; function LinkedDevicesHeaderRightButton(): React.Node { const styles = useStyles(unboundStyles); const navigation = useNavigation(); - const navigateToQRCodeScanner = React.useCallback( - () => navigation.navigate(SecondaryDeviceQRCodeScannerRouteName), - [navigation], - ); + const navigateToQRCodeScanner = React.useCallback(() => { + if (devIsEmulator) { + Alert.alert( + 'Unsupported device', + "You can't access the QR code scanner on a simulator.", + [{ text: 'OK' }], + { cancelable: false }, + ); + return; + } + navigation.navigate(SecondaryDeviceQRCodeScannerRouteName); + }, [navigation]); return ( diff --git a/native/utils/url-utils.js b/native/utils/url-utils.js --- a/native/utils/url-utils.js +++ b/native/utils/url-utils.js @@ -78,4 +78,5 @@ natNodeServer, setCustomServer, normalizeURL, + devIsEmulator, };