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);
}
);
`
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
`
`