Screen width in React Native

前端 未结 10 941
独厮守ぢ
独厮守ぢ 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:05

    I think using react-native-responsive-dimensions might help you a little better on your case.

    You can still get:

    device-width by using and responsiveScreenWidth(100)

    and

    device-height by using and responsiveScreenHeight(100)

    You also can more easily arrange the locations of your absolute components by setting margins and position values with proportioning it over 100% of the width and height

提交回复
热议问题