EddyVerbruggen / nativescript-barcodescanner

🔎 NativeScript QR / barcode (bulk)scanner plugin
MIT License
293 stars 73 forks source link

One scan then stops working #217

Closed mrwrighty closed 3 years ago

mrwrighty commented 5 years ago

When scanning a QR code, the camera opens and the overlay appears. The QR code scans and presents the dialog with info thats been found. Closing the dialog leaves the camera open but the scanning overlay has gone. Leaving the page and returning does not fix the problem and the barcode scanner does not re-appear until the app is closed and restarted.

Javascript below.

` var BarcodeScanner = require("nativescript-barcodescanner").BarcodeScanner; var barcodescanner = new BarcodeScanner();

barcodescanner.scan({ formats: "QR_CODE, EAN_13", // cancelLabel: "EXIT. Also, try the volume buttons!", // iOS only, default 'Close' // cancelLabelBackgroundColor: "#333333", // iOS only, default '#000000' (black) //message: "Use the volume buttons for extra light", // Android only, default is 'Place a barcode inside the viewfinder rectangle to scan it.' showFlipCameraButton: false, // default false preferFrontCamera: false, // default false showTorchButton: true, // default false beepOnScan: true, // Play or Suppress beep on scan (default true) torchOn: false, // launch with the flashlight on (default false) closeCallback: () => { console.log("Scanner closed")}, // invoked when the scanner was closed (success or abort) // resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text // orientation: orientation, // Android only, default undefined (sensor-driven orientation), other options: portrait|landscape openSettingsIfPermissionWasPreviouslyDenied: true // On iOS you can send the user to the settings app if access was previously denied }).then((result) => { // Note that this Promise is never invoked when a 'continuousScanCallback' function is provided alert({ title: "Scan result", message: "Format: " + result.format + ",\nValue: " + result.text, okButtonText: "OK" }); }, (errorMessage) => { console.log("No scan. " + errorMessage); } ); `

XML Below

`

<ActionBar title="Scan QR Tag" class="action-bar">
</ActionBar>
<GridLayout rows="*" width="100%" height="100%"
    backgroundColor="white">
    <iOS>
    <Barcode:BarcodeScannerView
  class="scanner-round"
  formats="QR_CODE, EAN_13"
  beepOnScan="true"
  reportDuplicates="true"
  preferFrontCamera="false"
  scanResult="onScanResult" />
    </iOS>
</GridLayout>

`

EddyVerbruggen commented 5 years ago

What happens if you use console.log instead of alert?

mrwrighty commented 5 years ago

Ok will check tomorrow, but code is direct from example

kefahB commented 4 years ago

Do you use the BottomNavigation concept in your app ? I have made a mistake that you can found here