react-native中长度单位换算
2020-11-06 15:47 在思考中成长 阅读(310) 评论(0) 编辑 收藏 举报import {
Dimensions,
Platform
} from 'react-native';
//获取屏幕大小
const { width, height } = Dimensions.get("window");
const ScreenWidth = Math.min( width, 540); //判断是否是 iphone Plus
//db数值转化
export function getPixel(num, designWidth = 375) {
return num * ScreenWidth / designWidth ;
}