I have two screens. Each screen contains three child class. Yes, I am using the tab of each screen.
In my first screen let say. Main-screen has -> ScreenA, ScreenB, ScreenC. And my DetailScreen has -> ScreenD, ScreenE, ScreenF
Now from my ScreenA i have push to go to ScreenD. The code is here :
  this.props.navigation.navigate('DetailScreen', {
            onNavigateBack: this.refresh.bind(this)
   })
 refresh(commentText) {
        alert('alert me')
    }
In my ScreenD i have one button to go back. And update the values in my ScreenA:
 this.props.navigation.state.params.onNavigateBack(this.state.commentText); 
 this.props.navigation.goBack();
But always i am getting error like :
Undefined is not an object (evaluating 'this.props.navigation.state')
Any help would be great. My objective is to update my screen A, when i come back from screen D
My mainScreen :
 <ScreenA navigation={this.props.navigation}  tabLabel= "ScreenA" props = {this.props} tabView={this.tabView}/>
 <ScreenB navigation={this.props.navigation}  tabLabel= "ScreenB" props = {this.props} tabView={this.tabView}/>
<ScreenC navigation={this.props.navigation}   tabLabel= "ScreenC" props = {this.props} tabView={this.tabView} goToPage={ () => this.goToPage(2) }/>
DetailScreen:
 <ScreenD navigation={this.props.navigation}  tabLabel= "ScreenD" props = {this.props} tabView={this.tabView}/>
 <ScreenE navigation={this.props.navigation}  tabLabel= "ScreenE" props = {this.props} tabView={this.tabView}/>
<ScreenF navigation={this.props.navigation}   tabLabel= "ScreenF” props = {this.props} tabView={this.tabView} goToPage={ () => this.goToPage(2) }/>
My RootStackScreen :
import React from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import ScreenA from './ScreenA';
import ScreenB from './ScreenB';
const RootStack = createStackNavigator();
const RootStackScreen = ({navigation}) => (
    <RootStack.Navigator headerMode='none'>
        <RootStack.Screen name="ScreenA" component={ScreenA}/>
        <RootStack.Screen name="ScreenB" component={ScreenB}/>
    </RootStack.Navigator>
);
export default RootStackScreen;
 
     
    