您好,我正在尝试在我的 react native 应用程序中放置一个简单的 react native 模态(在 expo 上运行它),但它始终可见。当我将 visible 道具设置为 false 时,它仍然显示。相关代码如下:
主要部件
import React, {Component} from 'react';
import {View, Text, Modal} from 'react-native';
class Home extends Component {
render() {
return (
<View>
<Modal visible={false}>
<Text>Test</Text>
</Modal>
</View>
);
}
}
包.json
"dependencies": {
"expo": "~37.0.3",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-web": "~0.11.7",
"react-redux": "^7.2.0",
"redux": "^4.0.5"
},
基本上,模式总是显示,即使可见设置为 false。我在这里错过了什么吗?