Create an Authentication Flow with React Navigation

Share this video with your friends

Send Tweet

In this lesson you will learn how to structure an auth flow in an application using React Navigation. In the process you will learn how to use a navigator’s screenProps to access parent functions and React Native’s AsyncStorage to persistent auth state between sessions.

David Moore
David Moore
~ 6 years ago

Cool video. I noticed you are using the deprecated componentWillMount. Is there a plan to update the video or code?

Spencer Carli
Spencer Carli(instructor)
~ 6 years ago

@David you could use componentDidMount for the same thing. No plans to update the video as it doesn't change much from what is the focus of the lesson.

Michael Cavallaro
Michael Cavallaro
~ 6 years ago

Great stuff! I was just curious, can you pass the signIn/signOut functions through regular props? Or do these callbacks have to be through screenProps?

Spencer Carli
Spencer Carli(instructor)
~ 6 years ago

@Michael - good question! You'll need to pass them through screenProps otherwise React Navigation won't pass them down the screens. They'll just never get exposed anywhere.

Michael Cavallaro
Michael Cavallaro
~ 6 years ago

@Spencer, thanks so much for the quick response, that makes perfect sense! I've been comparing it to react-router usage.