12345678910111213141516171819202122232425262728293031323334 |
- let {Dimensions,StatusBar,Platform,PixelRatio} = require('react-native');
- let {width,scale,height,fontScale} = Dimensions.get("window");
- let isIOS = Platform.OS == "ios";
- let statusBarHeight = isIOS? 20: StatusBar.currentHeight;
- let pixelRatio = PixelRatio;
- fontScale = scale;
- export default Dimensions = {
- get:Dimensions.get,
- screenWidth:width,
- screenHeight:height,
- screenScale:scale,
- width:width,
- height:height,
- scale:scale,
- fontScale:fontScale,
- statusBarHeight:statusBarHeight,
- contentHeight:height-statusBarHeight,
- pixelRatio: pixelRatio,
- getFontSize:function(size){
- return size*fontScale;
- },
- getWidth:function(width){
- return width*fontScale;
- },
- getHeight:function(height){
- return height*fontScale;
- },
- size:{
- "1":1*fontScale
- }
- }
|