ant design react的modal组件问题

各位大佬,这个close不能从外部关闭modal.alert吗?

const modalAlert = Modal.alert('', <Text style={styles.modalText}>{this.props.t('mycart:nowgo')}</Text>, [
        {text: this.props.t('muaccount:cancel'), style: {color: '#737373',fontSize:16}},
        {text: this.props.t('mycart:cart'), onPress: () => this.props.navigation.navigate('Cart'), style: {color: '#ff3d11',fontSize:16}},
    ]);
    setTimeout(() => {
        console.log(modalAlert)
        modalAlert.close()
    }, 2000);

clipboard.png

https://rn.mobile.ant.design/...
官方文档也是这样写的,有大佬遇到过这样的问题吗

阅读 4.1k
2 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题