Screen width in React Native

前端 未结 10 968
独厮守ぢ
独厮守ぢ 2020-12-13 08:33

How do I get screen width in React native?

(I need it because I use some absolute components that overlap and their position on screen changes with different device

10条回答
  •  难免孤独
    2020-12-13 09:04

    React Native comes with "Dimensions" api which we need to import from 'react-native'

    import { Dimensions } from 'react-native';
    

    Then,

    
    

提交回复
热议问题