Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k views
in Technique[技术] by (71.8m points)

antd Modal.alert() 无法关闭的问题,求解决

RN:0.61.4
antd:@ant-design/react-native 3.3.0

代码:

   Modal.alert( "错误", "错误信息", [{ text: '确定' }])

我RN + ANTD 在二级页面 Modal.alert() 在不关闭alert的情况下 滑动返回了上一页 结果alert在一级页面也还在,请问这个问题有人遇到过吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Modal.alert()挂载的节点一般是<body></body>,和路由的根节点是并列关系,因此当路由变化时,只是路由节点内部的dom发生改变,而弹窗不会关闭


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...