React Native StatusBar:黑暗内容不适用于android [英] React Native StatusBar: dark-content not working on android

查看:38
本文介绍了React Native StatusBar:黑暗内容不适用于android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将标题的颜色和状态栏的图标更改为黑色.因此,根据 react-native status-bar 文档,我将 barStyle 设置为 dark-content 但没有任何变化.

I'm trying to change the color of the title and the icons of the status-bar to be black. so, according to the react-native status-bar documentation, I set the barStyle to dark-content but nothing change.

<StatusBar barStyle="dark-content" backgroundColor={'white'}/>

推荐答案

如果您使用 Expo,您应该使用他们自己的 Statusbar.您可以通过运行来安装它:

If you are using Expo you should work with their own Statusbar. You can install it by running:

expo install expo-status-bar

并像这样修改它:

import { StatusBar } from 'expo-status-bar';
...
   <StatusBar style="dark" />
...

否则,您可能想尝试通过运行以下命令来升级您的 react native 版本:

Otherwise you may want to try upgrading Your version of react native by running:

npx react-native upgrade

这篇关于React Native StatusBar:黑暗内容不适用于android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆