RN 中如何设置宽高为100%
在组件中引入Dimensions,调用get方法
import React from 'react'
import{Dimensions, View, Text} from 'react-native'
const screenHeight = Dimensions.get('window').height;
const screenWidth = Dimensions.get('window').width;
function MainComp(props){
return (
<View style={{
height: screenHeight,
width: screenWidth,
backgroundColor: '#ccc',
}}>
<Text></Text>
</View>)
}