Skip to content Skip to sidebar Skip to footer

How To Automatically Close An Alert After A Certain Time React Native

I would like to automatically close an alert after a couple of seconds without having the user do it themselves. If possible I would like to do this using Alert (not AlertIOS), but

Solution 1:

I suggest you use Modal component

<ModalanimationType={"slide"}
  transparent={false}visible={this.state.modalVisible}></Modal>

So you can call setTimeout() in your function to update the state variable modalVisible to show / hide it. More examples can be found here from the official doc (https://facebook.github.io/react-native/docs/modal.html)

Post a Comment for "How To Automatically Close An Alert After A Certain Time React Native"