React native 反应导航(v2)如何将道具传递给我的TabNavigator并将这些道具发送到屏幕

React native 反应导航(v2)如何将道具传递给我的TabNavigator并将这些道具发送到屏幕,react-native,react-native-android,react-navigation,React Native,React Native Android,React Navigation,我是一个新的反应和反应。我正在尝试使用React Navigation(v2)在我的移动应用程序上实现一个简单的选项卡导航 基本上有两个文件: Router.js // imports... const Tabs = TabNavigator( { Logs: { screen: Logs, // here I would like to recieve the jwt and pass it as a param to the logs screen

我是一个新的反应和反应。我正在尝试使用React Navigation(v2)在我的移动应用程序上实现一个简单的选项卡导航

基本上有两个文件:

Router.js

// imports...

const Tabs = TabNavigator(
{
  Logs: { 
      screen: Logs,
      // here I would like to recieve the jwt and pass it as a param to the logs screen
     },
  NewRide: { 
      screen: NewRide
     }
},
 {navigationOptions: ...}
} 
export default tabs;
export default class LoggedIn extends Component {
constructor(props) {
    super(props);
}

render() {
        return (
            <View>
                <Tabs jwt={this.props.jwt} /> // here I pass the jwt as a prop
            </View>
        );
}
LoggedIn.js

// imports...

const Tabs = TabNavigator(
{
  Logs: { 
      screen: Logs,
      // here I would like to recieve the jwt and pass it as a param to the logs screen
     },
  NewRide: { 
      screen: NewRide
     }
},
 {navigationOptions: ...}
} 
export default tabs;
export default class LoggedIn extends Component {
constructor(props) {
    super(props);
}

render() {
        return (
            <View>
                <Tabs jwt={this.props.jwt} /> // here I pass the jwt as a prop
            </View>
        );
}
导出默认类LoggedIn扩展组件{
建造师(道具){
超级(道具);
}
render(){
返回(
//这里我将jwt作为道具传递
);
}
我试图做的是将一个名为jwt的道具从LoggedIn.js中的LoggedIn类传递到Router.js中的Tabs。从Tabs调用中,我最终希望将作为道具接收的jwt发送到Logs屏幕


我不知道如何在Router.js文件中接收Jwt并将其传递到日志屏幕。任何关于这方面的帮助都将非常感谢,因为我在这方面已经坚持了好两天。向Matt致意。

您可以向导航传递一个全局参数,该参数可以在该导航的每个屏幕上使用

屏幕道具-将额外选项传递给子屏幕

样本

const SomeTab = TabNavigator({
  // config
});

<SomeTab
  screenProps={/* this prop will get passed to the screen components as this.props.screenProps */}
/>
const SomeTab=TabNavigator({
//配置
});

非常感谢您的回复。我对React Native仍然很陌生,我不确定如何在Router.js中最初接收jwt道具。请提供一个例子,因为我很困惑。