Problem when calling two native.showAlert immediately after another

Hi!

I want to show an alert box created with native.showAlert immediately on completion of another alert box.

And if the second alert box is completed, I want to call another function.

So it shall be like this:

Show AlertBox1, onComplete1 -> Show AlertBox2, onComplete2 -> call function X

The problem is, that both alert boxes are shown, but function X is not called (most of the time). Strangely it is called sometimes, but most of the time not.

Seems like some kind of race condition to me.

I could reproduce this behaviour in Windows Simulator and on my Android devices.

I could solve the problem by adding a delay of 500ms before the second alert. But I would like to know if there is any more sophisticated solution to this issue you could recommend.

Thx!

PS: The first alert is called within a “scene:overlayEnded” function, but I guess that should not make any difference, right?

using a timer as you suggested is fine.

using a timer as you suggested is fine.