打算把遇到的一些常见的布局样式记录下来,会持续更新。。。
import { Dimensions, PixelRatio } from "react-native"
const deviceWidth = Dimensions.get("window").width //设备的宽度
const deviceHeight = Dimensions.get("window").height //设备的高度
const devicedpr = PixelRatio.get() //屏幕像素密度
const isIphonex = (deviceWidth===375 && deviceHeight===812) || (deviceWidth===414 && deviceHeight===896);