Open Tukkan opened 6 years ago
I have seen this too.
Now in new version of plugin I can also see this behaviour when navigating back to screen when barcode scanner was used (tested on Android).
I'm also having this issue is there any update on this ?
Any update on that issue? It also happens when navigating to the next screen and then going back with android back button or just switching apps and going back.
The workaround I used is the reinitialization of the component by using *ngIf and setTimeout around it and subscription to suspend\resume events of the app activity. Not a good way to resolve it but at least it helped.
Any news on this ????
It actually work now for me guys ! I had this issue for months, i did update to nativescript 6.0 and i have nativescript-firebase 9.0.2, and now it just work for IOS and Android ! I checked with the version i have in production (which is still in nativescript 5) and it doesn't work there so seems that it's the solution
Just to pitch in for NativeScript 7 (and Angular 10), running version 11.1.3 of the plugin
Error in Firebase MLKit's runCamera function: Error: java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN
The workaround for Android is currently to wrap the <MLKitBarcodeScanner>
tag in a <ng-container *ngIf="loadScanner">
which is hidden on component initialization and activated using setTimeout
fired off by the page loaded event (in a ngZone
).
I opened a similar problem https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/1766 I have found the solution to this problem: I have implemented it in vue, they will have to pass it to angular:
Important: with v-if this doesn't work, it has to be v-show
<template>
<MLKitBarcodeScanner
v-show="!clearViewML"
@loaded="loadedMLKitBarcodeScanner"
:pause="pause"
.
.
.
>
</MLKitBarcodeScanner>
</template>
<script>
export default {
data() {
return {
ml: null,
pause: false,
clearViewML: false,
};
},
methods: {
loadedMLKitBarcodeScanner(args) {
if (isAndroid) {
if (this.ml == null) {
this.ml = args.object;
} else {
this.pause = true;
this.clearViewML = true;
setTimeout(() => {
this.clearViewML = false;
this.pause = false;
}, 50);
}
}
}
}
};
</script>
When having app opened, locking the phone (or when it's being automatically locked) and going back to the app after unlock or switching from the other app, the camera view from ML Kit is black on Android. iOS seems to work fine.