I am unable to fire a method on the parent component when I click a button from a child component.
This is my code:
constructor(props) {
super(props);
this.state = {
text: '',
};
}
nav = DrawerNavigator({
Child: {
screen: Child,
navigationOptions: {
title: 'Child Component'
}
},
Profile: {
screen: Profile
},
}, {
screen: Profile,
contentComponent: DrawerContent
});
const DrawerContent = (props) => (
<View> {this.state.text}</View>
})
const
nav2= DrawerNavigator({
Child: {
screen: Child,
navigationOptions: {
title: 'Child cmp'
}
},
Profile: {
screen: Profile
},
screen: Manager
}
}, {
screen: Profile,
contentComponent: DrawerContent
});
const Layout = createRootNavigator(signedIn);
return (
<View>
<Layout/>
</View>
);
I want so when a button on Child cmp is clicked i am calling a function within the Child cmp which does some backend call after that call finishes, I want the Parent state to update. I tried different ways, but I couldnt succeed!