Search code examples
reactjsreact-nativetextstylesstylesheet

React Native - Text is in statusbar - how to put it further down?


My text is in the statusbar of the phone. I want to ask what is the best way to put the text further down, is it marginTop? i don't know if i should use marginTop, because screens have different sizes and i want to have it on the same Y-Position on every phone.

So is there any other way to make the text "be not in the statusbar"? Is it maybe possible to get the device height and then divide it by X or so?


Solution

  • yes, marginTop is the best way to get text below statusbar and for android you can use inbuilt component of react-native (StatusBar) and use its method currentHeight to get height of the your android device Statusbar