Dimensions api

简单介绍

Dimensions reamx版本实现

使用说明

import { Dimensions } from 'react-native'

const { width, height, fontScale, scale } = Dimensions.get("window");
const { width, height, fontScale, scale} = Dimensions.get("screen");

方法

  • get()
    static get('window' | 'screen')
  • addEventListener()
    static addEventListener(type, handler)
  • removeEventListener()
    static removeEventListener(type, handler)
  • set()
    const dim = { window: { width: 375, height: 640 },screen: { width: 375, height: 640 }}
    static set(dim)