Woj*_*ski 11 android reactjs react-native expo
我开始将 React Native 与 Expo 结合使用,并遇到了第一个问题。我想更改 Android 上导航栏的颜色。不幸的是,我不知道该怎么做。
我尝试使用https://github.com/thebylito/react-native-navigation-bar-color#readme但它打印出以下错误:
TypeError:TypeError:null不是对象(正在评估“NavigationBarColor.changeNavigationBarColor”)
if (Platform.OS == 'android') {
changeNavigationBarColor('#f00', true);
}
Run Code Online (Sandbox Code Playgroud)
小智 10
该功能已于 8 月 9 日合并到 expo 中。您需要将这些指令添加到 app.json
{
"androidNavigationBar": {
/*
Determines to show or hide bottom navigation bar.
"true" to show, "false" to hide.
If set to false, status bar will also be hide. As it's a general rule to hide both status bar and navigation bar on Android developer official docs.
*/
"visible": BOOLEAN,
/*
Configure the navigation bar icons to have light or dark color.
Valid values: "light-content", "dark-content".
*/
"barStyle": STRING,
/*
Configuration for android navigation bar.
6 character long hex color string, eg: "#000000"
*/
"backgroundColor": STRING
}
}
Run Code Online (Sandbox Code Playgroud)
这是包含更多信息的拉取请求https://github.com/expo/expo/pull/5280
| 归档时间: |
|
| 查看次数: |
14065 次 |
| 最近记录: |