需要 Dimensions
导入 var Dimensions=require('Dimensions')
使用如下
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image,
ListView
} from 'react-native';
var Dimensions=require('Dimensions')
export default class Good extends Component<{}> {
render() {
return (
<View>
<Text>当前屏幕的宽度是{Dimensions.get('window').width}</Text>
<Text>当前屏幕的高度是{ Dimensions.get('window').height}</Text>
</View>
);
}
}
const styles=StyleSheet.create({
})
网友评论