Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing console.log/errors when closing #16

Open
C-AAEN opened this issue Jul 12, 2024 · 0 comments
Open

Throwing console.log/errors when closing #16

C-AAEN opened this issue Jul 12, 2024 · 0 comments

Comments

@C-AAEN
Copy link

C-AAEN commented Jul 12, 2024

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

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<CapacitorBarcodeScannerScanResult | undefined> {
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant