Creating Dialog.alert inside .then((result) not working
See original GitHub issueHi!
When I use the scanner and the code scanned did not match a param an alert is triggered to let the user know the scan is wrong. So in the result I have the following line to test:
.then((result) => {
const alertOptions = {
title: 'Warning',
message: 'Something terrible has happened.',
okButtonText: 'Okay',
cancelable: false // [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
}
Dialogs.alert(alertOptions).then(() => {
console.log('Ok chosen!')
})
});
This bit of code results in the next warning/error:
Warning: Attempt to present <UIAlertController: 0x10309c000> on <QRCodeReaderViewController: 0x102468590> whose view is not in the window hierarchy!
No alert is showing up which is obvious if you look at the warning/error.
I’m using: “@angular/core”: “~11.2.5”, “@nativescript/core”: “8.0.2”, “nativescript-barcodescanner”: “^4.1.0”,
Anyone a suggestion how to fix this? Is it a scanner issue or do I do something wrong?
Thanks in advance for any answer!!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SweetAlert2 confirm dialog not working properly in onclick
Your code is fine. Looks like the page is refreshing because the button click is being treated as a form submission. You'll need...
Read more >The neatest way to handle alert dialogs in React
So here we go. Everything we need is to render only 1 top-level modal at the root of our application and show it...
Read more >Dialogs - Android Developers
A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill...
Read more >Lesson 1: Using JavaScript to Show an Alert
Try modifying your showAlert() script with your own custom alert message. Then test it to be sure it works. Using the onclick event....
Read more >Window.alert() - Web APIs - MDN Web Docs - Mozilla
The alert dialog should be used for messages which do not require any response on the part of the user, other than the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it, thank you!
This was the issue… I’ve copied the code from GitHub and your last message got me thinking about the modal…
it looks like
is not doing anything but deleting excluding the “presentInroot” showed me an alert without any warning or error.
Maybe I’ll look into that in te future if I got some time and know how to debug the plugin but for now its ok for me.
It’s up to you if you want this issue to be open to work on it later or close it.
Kind regards.
Oh that’s nice! Glad you found a way to make it disappear.