TabNavigation 中的标题标题为空

编程入门 行业动态 更新时间:2024-10-27 05:29:51
本文介绍了TabNavigation 中的标题标题为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

标题似乎没有按预期工作.

Header title seems to not work as expected.

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

I already updated react-native and all other dependencies to their latest version and reviewed react-navigation documentation. Also I created a bug on github for this item.

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

Can you please take a look if I doing something wrong? I need to have header title set when i am using 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> ) } }

但我在标题窗格中看到空标题.我想查看来自导航选项的标题文本

But I see empty header title in the header pane. I want to see header text that come from navigation Options

推荐答案

感谢 JinHoSo 答案在这里

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

更多推荐

TabNavigation 中的标题标题为空

本文发布于:2023-11-06 16:18:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564191.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标题   为空   TabNavigation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!