React native 为什么我的模态高度占据了屏幕的一半?
我的模态——noDevicesModalContainer——占用了大量的屏幕,我不知道为什么 我对本地和web开发的反应非常新,所以请不要害怕过度的抱怨 提前感谢您的建议React native 为什么我的模态高度占据了屏幕的一半?,react-native,React Native,我的模态——noDevicesModalContainer——占用了大量的屏幕,我不知道为什么 我对本地和web开发的反应非常新,所以请不要害怕过度的抱怨 提前感谢您的建议 class DevicesEmptyScreen extends Component { render() { return ( <View style={styles.screen}> <View style={styles.noDevicesImage}>
class DevicesEmptyScreen extends Component {
render() {
return (
<View style={styles.screen}>
<View style={styles.noDevicesImage}>
<Image
source={require('./../../../android/app/src/main/res/drawable/no_devices.png')}
/>
</View>
<View style={styles.noDevicesTextContainer}>
<Text style={styles.noDevicesText}>You do not have any devices yet</Text>
</View>
<View style={styles.noDevicesModalContainer}>
<Text style={[styles.noDevicesText, styles.noDevicesModalText]}>
In case no devices have been assigned, please contact your administrator
</Text>
</View>
</View>
)
}
}
export default DevicesEmptyScreen
const styles = StyleSheet.create({
screen: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
noDevicesImage: {
flex: 1,
marginTop: 40
},
noDevicesTextContainer: {
flex: 1,
justifyContent: 'center'
},
noDevicesText: {
color: '#89C7C8',
padding: 10
},
noDevicesModalContainer: {
flex: 1,
backgroundColor: '#EBF5F6',
borderRadius: 10,
marginHorizontal: 30,
marginVertical: 30
},
noDevicesModalText: {
marginLeft: 20
}
})
类设备清空屏幕扩展组件{
render(){
返回(
您还没有任何设备
如果未分配任何设备,请与管理员联系
)
}
}
导出默认设备清空屏幕
const styles=StyleSheet.create({
屏幕:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“中心”
},
节点设备映像:{
弹性:1,
玛金托普:40
},
NodeDevicesTextContainer:{
弹性:1,
为内容辩护:“中心”
},
节点设备文本:{
颜色:'#89C7C8',
填充:10
},
节点设备ModalContainer:{
弹性:1,
背景颜色:“#EBF5F6”,
边界半径:10,
marginHorizontal:30,
澳门时间:30
},
NodeDevicesModAltext:{
边缘左侧:20
}
})
如文件所示。试试这个
<Modal transparent={true}
visible={this.state.isVisible}
onRequestClose={this.closeModal}>
<View style={{
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'}}>
<View style={{
width: 300,
height: 300}}>
...
</View>
</View>
</Modal>
...
您能否添加结果的屏幕截图,并解释您希望模态是什么?使用模态时,您的屏幕在哪里?