I am using the new React-navigation from react-native. I have the navigation as follows:
StackNavigator:
So the problem was (I think), inside the navigationOptions
instead of using navigations
I had to use navigate
, and pass it as a props to the child (i.e. the SearchNotification).
So the final code looks like this:
HomeNavigation.navigationOptions = {
title: 'Home',
header: ({navigate}) => ({
right: (
),
}),
};
And within the SearchNotification component:
export default class SearchNotification extends React.Component {
goToNotification = () => {
this.props.navigate('Notification');
};
render() {
return (
this.props.navigate('Notification')}>
3
)
}
}