2017-04-05 48 views

回答

1

StatusBar.currentHeight工作仅适用于Android,作为反应本地文档中建议:https://facebook.github.io/react-native/docs/statusbar.html

如果你想在iOS上的状态栏的高度,你可以写你自己的反应,本地库,或使用一个:

https://github.com/jgkim/react-native-status-bar-size

但你也可以做这样的事情,如果没有第三个库:

const height = Platform.OS === 'ios' ? 20 : StatusBar.currentHeight 

希望我的回答能帮到你:)

相关问题