ionic-team / ionic-team/capacitor-barcode-scanner

Throwing console.log/errors when closing

Open
#16 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
64
Forks
47
Avg merge
1h 55m
Merged PRs (30d)
1

Description

I know it is only V1.0.1 and more features are coming. It would be nice for it not to throw console.log/errors when i close the scanner. This occurs both on android, IOS and web
![image](https://github.com/user-attachments/assets/e9b1363f-01d3-4883-a02f-b1d6e0b92b60)

The console.log comes every time i close the scanner.
If I close the scanner before the scanner is ready to scan, it throws the error. It seems wierd that closing the scanner fast after opening it should cause errors.

I use the scanner like this

`import { CapacitorBarcodeScanner, CapacitorBarcodeScannerTypeHintALLOption, CapacitorBarcodeScannerScanOrientation, CapacitorBarcodeScannerCameraDirection, type CapacitorBarcodeScannerOptions, type CapacitorBarcodeScannerScanResult, CapacitorBarcodeScannerAndroidScanningLibrary } from '@capacitor/barcode-scanner';

export async function scanBarcode(): Promise {
try {
const options: CapacitorBarcodeScannerOptions = {
hint: CapacitorBarcodeScannerTypeHintALLOption.ALL,
cameraDirection: CapacitorBarcodeScannerCameraDirection.BACK,
scanOrientation: CapacitorBarcodeScannerScanOrientation.PORTRAIT,
android: {
scanningLibrary: CapacitorBarcodeScannerAndroidScanningLibrary.ZXING,
},
web: {
showCameraSelection: true,
scannerFPS: 30,
},
};

return await CapacitorBarcodeScanner.scanBarcode(options);
} catch (error) {
console.error('Error scanning barcode:', error);
}
}
`

and set up the android manifest and podfile like shown on the install guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.