简体   繁体   English

React Native - 更改标题的背景颜色

[英]React Native - Change Header's backgroundColor

screenshot of my app我的应用程序的屏幕截图

And I want to know how can I change the white header's color to black?我想知道如何将白色标题的颜色更改为黑色?

I assume you're using React Navigation for navigation on the react native app.我假设您正在使用React Navigation在 React Native 应用程序上进行导航。

Here's a demo code block to configure header background.这是配置 header 背景的演示代码块。

export default function App() {

  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
            name="Home"
            component={HomeScreen}
            options={{ title: 'Demo', headerStyle: {
              backgroundColor: '#000000'
           } }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM