I use context Api for login and logout , but I faced a situation where when login from login page it got page A but when user login direct after registration go to page B , using react navigation please help me, I am new to react native, I think it should change the Initial Route Name depending upon certain condition and how? please help.
Does the user need to enter his credentials to login after registration?
If yes: then you can provide a param to the route indicating that it's a new user and use that param to navigate to a different screen.
If not: then the function that does the login can be reused by both login and registration screen. But it can receive a param indicating the source where that function is being called. Based on the source you can conditionally navigate to one screen or the other.
If you provide code I can translate the above to code.