React Navigation - How to pass data across different screens in TabNavigator?

后端 未结 5 1948
野的像风
野的像风 2021-01-14 06:17

I have a TabNavigator, and in each tab is a StackNavigator. Inside the StackNavigator, I have screens. The screens in each Tab do not call each other directly; the TabNaviga

5条回答
  •  野的像风
    2021-01-14 06:42

    It may seem that this.props.navigation.state.params is only able to old one parameter? Possibly? Try this:

        doIt = () => {
        this.props.navigation.setParams({results: 'one'});   // <--- set data when user clicks button.
      }
    
    
    console.log(this.props.navigation.state.params.results);
    

提交回复
热议问题