React Native Modal Not Closing
React Native Modal Not Closing
我正在我的iOS应用程序中覆盖以下Modal组件,同时等待几个异步请求回来。
<Modal transparent={true} visible={this.state.visible}>
<View style={{flex: 1}}>
<ActivityIndicator color="white" size="large"/>
</View>
</Modal>
this.state。一旦所有请求都返回,Visible被设置为false。然而,大约有50%的时间,即使在请求返回之后,模态仍然无限期地留在屏幕上。我已经在我的渲染函数的顶部记录了this.state.visible,正如预期的那样,它是假的,但模态并没有消失。你知道为什么会这样吗?
也许这和我现在面临的问题是一样的。
当关闭一个模态并打开另一个模态时,我得到这个问题,有些人正在使用模态和警报…
https://github.com/facebook/react-native/issues/10471目前,解决方案是在操作之前超时(600ms应该可以解决)。
现在有一个简单的解决方案,在再次显示对话框之前,首先,使用时间延迟使其不可见,然后再次显示对话框
this.setState({
showPopUp: false,
}, () => {
let timer = setTimeout(() => {
this.setState({
showPopUp: true,
});
}, 300);
})
您可以使用react-native-paper模式。
import { Modal } from 'react-native-paper';
相关文章:
- jQuery is not loaded
- AngularJS JSON not arriving php
- $rootScope not working
- reactRedux is not defined
- jQuery document.ready not working
- Javascript/Jquery Blob not showing Chrome PDF
- ReferenceError: not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Javascript getElementsByTagName not working?
- jQuery's trim()的前缀为not运算符
- Javascript - element.childNodes does not see an append.newch
- SemanticUI模态not onDeny/onApprove事件未激发
- WebkitTransform not fluent
- JQuery.val( ) not working
- Tomcat websocket is not working
- :not选择器不适用于ul类-备选方案
- Javascript JSON.parse not working
- NodeJS Multer is not working
- React, Webpack: bundle.js is not generated
- React Native Modal Not Closing