try 了不同的东西但都不管用,文档也没用

<MainFlowStack.Navigator
      screenOptions={{headerTitleAlign: 'left', shadowColor: 'transparent', headerStyle: {height: 200}}}
    >
      <MainFlowStack.Screen name="RoutinesList" component={RoutinesListScreen} option={{headerStyle: {height: 600}}} options={{
        headerTitle: (props) =>
          (<View style={{width: '100%'}}>
            <Text style={styles.header1}>
              Your Workouts
            </Text>
          </View>),
        headerShadowVisible: false,
        headerStyle: {height: 100}
      }} />
      <MainFlowStack.Screen name="RoutineScreen" component={RoutineScreen} options={({ route }) => ({ title: route.params.name })} />
    </MainFlowStack.Navigator>

推荐答案

Stack.NavigatorheaderStyleprops 不支持设置自定义高度.从official documentation人中:

headerStyle​

标题的样式对象.支持的属性:

  • 背景色

就我而言,与v5相比,这已经发生了变化.

然而,我们可以提供一个自定义标题组件,并通过这种方式设置特定的高度.

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

React-native相关问答推荐

错误:HostBody::get for prop NativeUnimoduleProxy中出现异常- Android虚拟设备(AVD)使用Expo测试React Native App时崩溃

NativeWind边框 colored颜色 在Reaction Native应用程序中未按预期工作

收到错误Constants.platform.ios.model已被弃用,以支持 expo-device

无法读取 @react-native-async-storage/async-storage 的未定义属性setItem

React Native 无法下载模板

我们应该在 react-native 移动应用程序中使用哪个图标库

react-native-fs 改变 toUrl 本身

找不到变量:firebase/react native(expo)上的 IDBIndex

错误:HostFunction 中的异常: Malformed calls from JS: field sizes are different. In an Animated View

React-Native:无法从我的 android 应用程序打开设备设置

React Navigation 5 隐藏Drawer抽屉元素

React-Native:显示加载屏幕直到加载 webview

Xcode 12 问题:Build input file cannot be found

React Native:自定义字体在 Android 和 iOS 上呈现不同

react-native run-android 构建错误':app:generateDebugBuildConfig'

当数据为空时,React-Native FlatList 呈现零状态

在 React Native Navigator 中的组件之间传递值

xcode 10错误:multiple commands produce

如何将样式传递给 React-Native 中的容器组件

zoom 到指定的标记 react-native-maps