-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with navigation handler when navigate to a new screen #5
Comments
Yes, I too am facing the same issue. As suggested on stackoverflow, i have used below alternative but thats not working either. `const goToScreen = () => {
|
Hopefully this helps someone in the future, but I think I've found a solution. Almost zero experience with React Native so bare with me. I was able to Login and get redirected to the Home page. Seems as if since the Home Stack.Screen is in a ternary operator that when it initializes it's null? So it for some reason can't find it when it's time to redirect to the Home screen (after Logging in). I changed this: to this:
essentially you're just setting the initial route to the Login screen. Then when Login is successful, it navigates to the Home screen. |
The persistent login functionality won't work with this solution. To make your solution to work.. Change this: And in the useEffect function chage this: Initial route is resolved once loading is set to false. Edit: Here is a better way to fix this: https://reactnavigation.org/docs/auth-flow |
Does anyone have working code that uses the auth-flow code @tpssim linked in the previous comment? |
Hey @fnandoz21, just stumbled on this too and was able to successfully implement the fix; take a look at my exercise repository here. Essentially it does work, but you need to be at step 7 to correct the order of setting the user data then resolving the loading flag for persistent login. |
@mfukano yes, I kind of landed on code that is very similar to yours. I was asking if anyone had implemented code similar to what @tpssim linked at: https://reactnavigation.org/docs/auth-flow. Thanks for responding to me though. |
https://github.com/tpssim/react-native-firebase |
Awesome thanks for sharing @tpssim ! |
The action 'NAVIGATE' with payload {"name":"DetailScreen","params":{"places":"name"}} was not handled by any navigator.help |
The action 'NAVIGATE' with payload {"name":"Home","params":{"user":{"email":"xxxx","id":"xxx","fullName":"test"}}} was not handled by any navigator #3
The text was updated successfully, but these errors were encountered: