简体   繁体   English

我怎样才能改变 Header 反应本机的条形高度?

[英]How can i change Header Bar height in react native?

i'm trying to change Header Bar height in React-Native Stack Navigator我正在尝试更改 React-Native Stack Navigator 中的 Header Bar 高度

this is my code这是我的代码

I tried to put headerStyle: height:'100', but it doen't work我尝试输入 headerStyle: height:'100',但它不起作用

what should i do?我应该怎么办?

    const LoginNavigator = () => {
      return (
        <Stack.Navigator>
          <Stack.Screen
            name="Login"
            component={Login}
            options={{
              title: 'MOVIEAPP',
              headerTransparent: true,
              headerTintColor: '#E70915',
              headerTitleStyle: {
                fontWeight: 'bold',
              },
               headerStyle:{
                height:100,            // i tried to put height
              }
            }}
          />
        </Stack.Navigator>
      );
    };

can you update the options prop to the following and let me know if it works?您可以将 options 道具更新为以下内容并让我知道它是否有效吗?

options={{
    title: 'MOVIEAPP',
    headerTitleStyle: {
      fontWeight: 'bold',
    },
     headerStyle:{
      height:200,            // i tried to put height
      backgroundColor: 'red'
    }
}}

Check for the official documentation please请查看官方文档

Official Docs 官方文档

We see only backgroundColor here.我们在这里只看到 backgroundColor。

Set a custom header instead改为设置自定义 header

<Stack.Screen
  options={
    header: (props) =>
        (
          <View style={{ height: 100 }}>
            ... 
          </View>
        ),
  }
/>

But you have to find a way to integrate the arrow functionality但是你必须找到一种方法来集成箭头功能

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

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