反应导航在选项卡之间传递参数

时间:2018-12-09 06:38:43

标签: javascript react-native react-navigation

嘿,我有这样的代码

    render() {
        const { navigation } = this.props;
        let title = navigation.getParam('title');
        let TabTaskDetail = createMaterialTopTabNavigator({
            'Detail': {
                navigationOptions: {
                    tabBarLabel: 'Detail',
                },
                screen: Detail
            })

        return (
            <SafeAreaView flex={1}>

                <TabTaskDetail />
            </SafeAreaView>
        );
    } }

class Detail extends Component {
    render() {
      return (
     <Text>
         {this.props.data}
     </Text>

      )
    }   

}

从我的代码如何获取标题(navigation.getParam('title'))到我的Detail类?

谢谢

0 个答案:

没有答案