1

Let's say I have a code like this:

alert('Hello World') 

So on my device is going to appear an alert message saying 'Hello World'. That message will be there until I press Ok.

But is there any way to remove the alert message from the screen with code? Instead of pressing Ok on the device?

jsdario
  • 6,477
  • 7
  • 41
  • 75
LuisPinto
  • 1,667
  • 1
  • 17
  • 36

2 Answers2

2

You can't.

Javascript close alert box

Not even in react-native. Best alternative would be to use custom dialogs or modals.

Community
  • 1
  • 1
jsdario
  • 6,477
  • 7
  • 41
  • 75
0

I had the same problem and this worked for me: https://github.com/CodeSeven/toastr

Anis D
  • 761
  • 11
  • 25
Fran Rios
  • 821
  • 9
  • 20