react native iOS 本机代码中是否有一个地方可以修改以设置 iOS 状态栏背景颜色? RCTRootView.m ?
react native StatusBar 组件 仅支持 Android 的 backgroundColor 。
原文由 Ed of the Mountain 发布,翻译遵循 CC BY-SA 4.0 许可协议
react native iOS 本机代码中是否有一个地方可以修改以设置 iOS 状态栏背景颜色? RCTRootView.m ?
react native StatusBar 组件 仅支持 Android 的 backgroundColor 。
原文由 Ed of the Mountain 发布,翻译遵循 CC BY-SA 4.0 许可协议
Add import { StatusBar } from 'react-native';
to the top of your app.js
and then add StatusBar.setBarStyle('light-content', true);
as the first line in your render()
to change the status bar text/图标为白色。
其他颜色选项是 'default'
和 'dark-content'
。
有关详细信息,请参阅 https://facebook.github.io/react-native/docs/statusbar.html 。
除此之外:不,您必须点击您提供的链接。
原文由 dv3 发布,翻译遵循 CC BY-SA 3.0 许可协议
1 回答1.6k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答1k 阅读
2 回答1k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
1 回答2.7k 阅读
2.3k 阅读
iOS 没有状态栏 bg 的概念。以下是您如何以跨平台方式实现这一目标:
也许代码中不清楚,但诀窍是使用
StatusBar
,它适用于 Android,并创建一个“假”状态栏(一个View
和backgroundColor
) 对于 IOS。