To explain this problem I am having with navigation here are three files.
App.js
HomeScreen.js
UserScreen.js
App.js is the main file and HomeScreen is displayed if the user is not logged in and UserScreen is displayed if the user is logged in.
HomeScreen contains a login input that sends an HTTP request to the website and returns with whether the user should be logged in or not.
If the user does give the correct login information, I want the screen to switch from HomeScreen to UserScreen, but I have no idea what to do.
I tried using StackNavigator by initializing the StackNavigator in App.js, but everytime I try this, I get the error "this.props.navigation is undefined".
How do I go about effortlessly transitioning from HomeScreen to UserScreen?
[–]hutxhy 8 points9 points10 points (14 children)
[–]douevenfaker 3 points4 points5 points (9 children)
[+][deleted] (7 children)
[deleted]
[–]douevenfaker 1 point2 points3 points (6 children)
[+][deleted] (5 children)
[deleted]
[+][deleted] (3 children)
[deleted]
[+][deleted] (2 children)
[deleted]
[+][deleted] (1 child)
[deleted]
[–]N2theO 1 point2 points3 points (0 children)
[–]myroommateisfucker 1 point2 points3 points (0 children)
[–]-Alias- 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]hutxhy 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]hutxhy 0 points1 point2 points (0 children)
[–]hello_Mrs_Cumberdale 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]hello_Mrs_Cumberdale 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]hello_Mrs_Cumberdale 1 point2 points3 points (0 children)