Open basurahan opened 5 years ago
YES, body tag still have style="background-color: transparent;"
Use this to fix the error temporary.
` import { Component, ChangeDetectorRef } from '@angular/core';
setTimeout(() => { window.document.body.style.backgroundColor = '#FFF'; this.ref.detectChanges(); }, 500); `
Use this to fix the error temporary.
` import { Component, ChangeDetectorRef } from '@angular/core';
setTimeout(() => { window.document.body.style.backgroundColor = '#FFF'; this.ref.detectChanges(); }, 500); `
Thanks! Im using vanilla javascript. Can you provide more detail what does this.ref.detectChanges();
do and what is the equivalent code of it in vanilla javasript
Having the same issue here too. Where about does the above code go? As the background is still remaining transparent for me. I understand that based off the angular docs (https://angular.io/api/core/ChangeDetectorRef) that the change detector checks for changes in the view, however don't fully understand where this needs to go to perform properly.
@devleaf-matt I found it work on my ionic3 project. But not work on ionic4 project.
is there any turn around for this ? i really need the fix today
I wrote a quick and dirty workaround like this:
scan() {
document.body.style.backgroundColor = 'transparent';
QRScanner.show();
QRScanner.scan(displayContents);
function displayContents(err, text) {
if(err){
console.log('error', err);
} else {
alert(text);
if (text) {
QRScanner.hide();
QRScanner.cancelScan();
document.body.style.backgroundColor = '#FFF';
}
}
}
}
Any more info on this? I've found that both hide() and cancelScan() result in different body background colors. cancelScan() seems to revert it to transparent. Will this be fixed?
I have created a pull request that fixes this:
https://github.com/bitpay/cordova-plugin-qrscanner/pull/279
This bug was created by this previous commit:
https://github.com/bitpay/cordova-plugin-qrscanner/commit/c9531b85e93d4cf5b844b83f265975c683cbee11
Or, if my PR is not accepted, you can use my clone:
I have created a pull request that fixes this:
279
This bug was created by this previous commit:
Or, if my PR is not accepted, you can use my clone:
We are facing the same issue, @p3v9d5ui PR should be approved.
Below code works for me
$("html").hide();
QRScanner.scan(displayContents);
function displayContents(err,text){
if(err){
alert("Something went wrong. Please try after some time.");
}
else{
$("html").show();
QRScanner.hide();
QRScanner.cancelScan();
alert(text);
}
}
QRScanner.show();
Hope it helps, Happy coding!
Seems like the background stays transparent when the sacn is destroyed