更改导航标题背景颜色

新手上路,请多包涵

努力了解如何更改导航标题栏背景颜色。我正在使用反应导航和 Expo 来构建我的应用程序。

backgroundColor 似乎什么也没做。知道怎么做吗?

我的代码如下:

 static navigationOptions = () => ({
    title: 'My App',
    headerTintColor: Colors.DarkBlue,
    backgroundColor: 'red',
    headerLeft:
      <HeaderBarItem to='InfoScreen' title='App info' />,
    headerRight:
      <HeaderBarItem to='FeedbackScreen' title='Feedback' />
  });

原文由 arled 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 474
1 个回答

这应该有效:

 static navigationOptions = () => ({
    title: 'My App',
    headerTintColor: Colors.DarkBlue,
    headerStyle: {
      backgroundColor: 'red'
    },
    headerLeft:
      <HeaderBarItem to='InfoScreen' title='App info' />,
    headerRight:
      <HeaderBarItem to='FeedbackScreen' title='Feedback' />
  });

原文由 Aakash Sigdel 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题