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

后端 未结 5 1950
野的像风
野的像风 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:51

    If you are using React Native Navigation Version 5.x with a DrawerNavigation, you can do this using

    in screen 1:

     

    in screen 2:

      ............
         render() {
        
        if(this.props.route.params!=undefined){
                if(this.props.route.params.your_json_Data!=null){
                 //    Use this.props.route.params.your_json_Data. It is your json data.
     }
              
        }
          
              
                return (
        ..............
    

提交回复
热议问题