Skip to content

Commit

Permalink
[native] make SecondaryDeviceQRCodeScanner dismissible
Browse files Browse the repository at this point in the history
Summary:
If you reject the Alert that pops up when you scan a QR code, the same alert will pop up if your phone camera is still pointed at the QR code. Instead, we should just go back when the cancel button is pressed.

https://linear.app/comm/issue/ENG-8935/cant-dismiss-secondarydeviceqrcodescanner

Test Plan: confirmed that if I press cancel on the Alert, I'm navigated back to the linked devices screen

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13036
  • Loading branch information
vdhanan committed Aug 19, 2024
1 parent 093bf14 commit 0632671
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions native/profile/secondary-device-qr-code-scanner.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ function SecondaryDeviceQRCodeScanner(props: Props): React.Node {
[processDeviceListUpdate],
);

const onCancelScan = React.useCallback(() => setScanned(false), []);

const handleBarCodeScanned = React.useCallback(
(barCodeEvent: BarCodeEvent) => {
setScanned(true);
Expand All @@ -328,7 +326,7 @@ function SecondaryDeviceQRCodeScanner(props: Props): React.Node {
{
text: 'Cancel',
style: 'cancel',
onPress: onCancelScan,
onPress: goBack,
},
{
text: 'Connect',
Expand All @@ -338,7 +336,7 @@ function SecondaryDeviceQRCodeScanner(props: Props): React.Node {
{ cancelable: false },
);
},
[onCancelScan, onConnect],
[goBack, onConnect],
);

if (hasPermission === null) {
Expand Down

0 comments on commit 0632671

Please sign in to comment.