gpt4 book ai didi

javascript - TabNavigation 中的页眉标题为空

转载 作者:行者123 更新时间:2023-11-30 14:13:53 25 4
gpt4 key购买 nike

页眉标题似乎无法按预期工作。

我已经将 react-native 和所有其他依赖项更新到最新版本,并查看了 react-navigation 文档。我还在 github 上为此项目创建了一个错误。

如果我做错了什么,你能看看吗?我在使用 TabNavigation 时需要设置标题标题

const RootNavigator = createStackNavigator({
...publicScreens,
Private: {
screen: PrivateNavigator
}
}, publicScreensConfig);

const privateScreens = {
ContactList: {
screen: ContactList
},
Settings: {
screen: Settings
}
};

.....

export default createBottomTabNavigator( privateScreens, options );
import React, { Component } from 'react'
import { Text, View } from 'react-native'
import GlobalColors from '../../config/colors';

export default class Settings extends Component {
static navigationOptions = {
title: 'Settings',
headerStyle: {
backgroundColor: GlobalColors.grayDark,
},
headerTintColor: 'white',
headerTitleStyle: {
fontWeight: 'bold',
},
gesturesEnabled: false,
}

render() {
return (
<View>
<Text> Settigs </Text>
</View>
)
}
}

但是我在页眉 Pane 中看到空的页眉标题。我想查看来自导航选项的标题文本

Empty header

最佳答案

感谢JinHoSo答案在这里

const bottomTabNavigator = createBottomTabNavigator(...)

bottomTabNavigator.navigationOptions = ({navigation, screenProps}) => {
const childOptions = getActiveChildNavigationOptions(navigation, screenProps)
return {
title : childOptions.title,
headerLeft : childOptions.headerLeft,
headerRight: childOptions.headerRight,
}
}

关于javascript - TabNavigation 中的页眉标题为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53915174/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com