I am still new to react navigation. I wish to reset the route information after login successfully. However there is some parameters like login information I wish to pass to the main page.
import { NavigationActions } from 'react-navigation'
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Profile',
params:{user:this.state.username}})
]
})
this.props.navigation.dispatch(resetAction)
In the Profile page, I want to get access to the params, so I use this:
constructor(props){
super(props)
this.state = { username: this.props.navigation.state.params.user,
}
but I received: undefined is not an object (evaluating '_this.props.navigation.state.params.user') in the Console log. May I know how should I get the parameters? Thank you