react-native获取屏幕尺寸
项目中需要获取手机的尺寸
import {Dimensions} from "react-native"
var WINDOW = Dimensions.get("window");
var width = WINDOW.width;
var height = WINDOW.height;
var scale = WINDOW.scale;
其中 width, height, scale分别为宽,高,缩放因子,注意react-native对屏幕分辨率进行了统一的封装,(width*scale)*(height*scale)才是屏幕的分辨率,
滑动触摸事件的gesture的dy、dx单位与width、height一致,故不需要转为分辨率来比较大小。
标签:scale,height,react,width,WINDOW,屏幕,native From: https://www.cnblogs.com/sexintercourse/p/16911616.html