React Native : Modal does not hide when Alert appears on top of it

vaibhav chaturvedy picture vaibhav chaturvedy · Oct 14, 2016 · Viewed 8.6k times · Source

I noticed a strange behavior that if Modal would present itself and then on top of it, if an Alert appears, the Alert disappears very soon without user clicking anything on it and the Modal, even if removed programmatically, doesn't remove from the screen. I consider is a bug. Is there a workaround?

Answer

Slowyn picture Slowyn · Oct 14, 2016

It seems to be a trouble in React Native. I've met this issue too. The easiest way to fix it is to call alert with timeout after modal is hidden: ... setTimeout(() => Alert.alert(msg), 10); ...