Screen width in React Native

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

    Just discovered react-native-responsive-screen repo here. Found it very handy.

    react-native-responsive-screen is a small library that provides 2 simple methods so that React Native developers can code their UI elements fully responsive. No media queries needed.

    It also provides an optional third method for screen orienation detection and automatic rerendering according to new dimensions.

提交回复
热议问题