我希望在几秒钟后自动关闭警报,而不需要用户自己执行此操作。
如果可能的话,我想使用Alert (不是AlertIOS)来做这件事,但是如果只有AlertIOS有它,那么我想我没有其他选择。
非常感谢!
发布于 2017-03-10 03:38:38
我建议您使用Modal组件
<Modal
animationType={"slide"}
transparent={false}
visible={this.state.modalVisible}></Modal>
因此,您可以在函数中调用setTimeout()来更新状态变量modalVisible以显示/隐藏它。在官方文档(https://facebook.github.io/react-native/docs/modal.html)中可以找到更多示例
https://stackoverflow.com/questions/42707264
复制