Can anyone explain to me the wrong of the word navigate in the below instances please
userByEmail(this.state.Email, navigate) // we call userByEmail ans pass email, but what does navigate do?
here I understand that we are kind of importing/(destructuring this.props) the method createUser from auth which is inside screenProps?? what does navigation: {navigate}} is it just the navigation props?
const {screenProps: {auth: {createUser}}, navigation: {navigate}} = this.props
lastly what is the difference between these two
this.props.navigation.navigate('Calendar')
navigate('Calendar')
I can't do exactly with just some of your code. But if navigate
is not a variable, this is wrong.
this.props.navigation
route
is set, navigation props
are automatically passed to the connected screen. HOC
provided by the react-navigation
. configuring navigation props
navigate : go to another screen, figures out the action it needs to take to do it
goBack - close active screen and move back in the stack
addListener - subscribe to updates to navigation lifecycle
isFocused - function that returns true if the screen is focused and false otherwise.
state - current state/routes
setParams - make changes to route's params
getParam - get a specific param with fallback
dispatch - send an action to router
The 'navigate'
you want to use is a prop of navigation
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.