Closed phatakrajan closed 5 years ago
When you navigate away from the scanner page, are you sure the page is destroyed? That should also destroy the scanner object. Can you check that for me, please?
If the page is actually destroyed and you still receive updates, then it'd be very helpful for me to know whether you experience this on iOS, Android, or both?
@EddyVerbruggen The page is not getting destroyed since i am navigating using < page-router-outlet > and i think when i move from Component 1 -> 2, it just caches it. Is there any way i should destroy page manually? or only scanner control for that matter? i tried that by calling disposeNativeView.
I am currently working only on Android. Not tested on iOS.
@EddyVerbruggen I explicitly unloaded the control on getting first scanned barcode.
this.scanner = this.scannerEle.nativeElement;
this._page.unloadView(this.scanner);
Is this the right way to do it? Or will there be any better way to unload the control?
Did that solve the issue? (I'm on vacation, so a bit hard to check myself).
Not completely. I am facing issue if i want to show the values in a modal dialog on same activity. I am unable to close object properly before showing a modal dialog and keep getting the events. However we can take a look at the issue once you are back from vacation
In documentation does not explain if exist some method or property to stop scanner, Its would be helpfully implement this functionallity to setup the scanner or prevent firing events of Scanning Result multiple times.
At this time the solution is destroy the view after navigate?
This is my code (NativeScript Vue) and 'navigateBack' its firing twice (or more)
if(typeof args.value.barcodes[0] !== 'undefined'){
if(args.value.barcodes[0].format == 'QR_CODE'){
console.log(args.value.barcodes[0].value)
this.$navigateBack({props:{dispenser_id:args.value.barcodes[0].value}})
}
}
@EddyVerbruggen Can you please let us know on how this issue can be fixed? We really don't know on how to stop firing this events.
I've just published 7.2.0 which adds a bindable pause
property to the scanner UI widget. Docs here, and the demo has been updated as well:
Excellent :)
I have implemented barcode scanner as suggested in ML Kit documentation. Here is my HTML
And here is my code
I am routing to a different page upon successfully receiving the barcodes. However i still keep getting scanResult events and automatically navigate back to the scanning screen. I also tried to dispose the object upon receiving first set of barcodes/removing the event listener. However both does not work. Not sure why events are being emitted upon movement.