如何通过导航获取标题

问题描述 投票:0回答:1

要从一个或另一个屏幕浏览,我需要这个渲染器:

 if (this.state.loggedIn) {
            return <Centrale navigation={this.props.navigation} />
        } else {
            return <Accedi navigation={this.props.navigation} />
        }

在两个屏幕上我都无法获得标题

 static navigationOptions = ({ navigation }) => {
    //console.log("ELENCO " + JSON.stringify(navigation))
    return {
      title: 'ELENCO SVEGLIE',
      headerRight: <View />

    };
  };

但是如果我使用标准导航(this.props.navigate(“”)),则标题会起作用。建议?

react-native react-navigation
1个回答
0
投票

setParams是您要寻找的。 setParams操作允许屏幕更改params中的route,这对于更新header buttons and title非常有用。有关更多链接,请参见此处。here

© www.soinside.com 2019 - 2024. All rights reserved.