构建后 React Native iOS StatusBar 不可见? [英] React Native iOS StatusBar invisible after build?
问题描述
我有一个使用 Expo 编写的 React Native 项目——当我在 Expo 上开发和发布时,顶部的状态栏(时间、wifi 等)很好,我从来不必担心它-- 它一直都在,所以我从来不需要读入一个单独的 StatusBar 组件或类似的东西.
I have a React Native project I've written using Expo -- when I develop and publish on Expo, the Status Bar up top (the time, wifi etc) is fine, I've never had to be concerned about it -- it's always been there, so I've never had to read-in a separate StatusBar component or anything like that.
但是当我构建"应用程序以获取 IPA 文件然后在 TestFairy 上部署时,应用程序的状态栏是完全不可见的(不确定字体是白色的还是覆盖层还是什么).
But when I 'build' the app to get the IPA file and then deploy on TestFairy, the App's statusbar is completely invisible (not sure if the font is white or it's an overlay or what).
有什么想法吗?谢谢!
推荐答案
正如 Expo 中提到的 文档
As mentioned in the Expo docs
Expo 在 Android 上默认状态栏半透明,与 iOS 一致,更符合 Material Design.
Expo makes the status bar translucent by default on Android which is consistent with iOS, and more in line with material design.
因此使用 react-native 的 StatusBar 就可以配置了如下
Therefore using the react-native's StatusBar you can configure it as follows
<ParentWrapper style={{flex: 1}}>
<View style={{ height, backgroundColor }}>
<StatusBar { ...props } />
</View>
// ... Your navigation or the child components
</ParentWrapper>
高度是 Platform.OS === 'ios' ?20 : StatusBar.currentHeight
这篇关于构建后 React Native iOS StatusBar 不可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!