Skip to content

Commit

Permalink
fix: qr scanner on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 27, 2024
1 parent 58894ff commit e407338
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const styles = StyleSheet.create({
});

interface QRCodeScannerProps {
onScanned: (data: string) => void;
onScanned: (data: string) => Promise<boolean>;
startScanning: boolean;
}

Expand Down Expand Up @@ -49,11 +49,11 @@ function QRCodeScanner({
setScanning(status === "granted");
}

const handleScanned = (data: string) => {
const handleScanned = async (data: string) => {
if (isScanning) {
console.info(`Bar code with data ${data} has been scanned!`);
onScanned(data);
setScanning(false);
const result = await onScanned(data);
setScanning(!result);
}
};

Expand Down

0 comments on commit e407338

Please sign in to comment.