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
  • 5,947
  • 7
  • 39
  • 72
LuisPinto
  • 1,591
  • 1
  • 16
  • 35

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
  • 5,947
  • 7
  • 39
  • 72
0

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

Anis D
  • 703
  • 9
  • 24
Fran Rios
  • 810
  • 8
  • 20