React Navigation RedirectUrl implementation

Viewed 43

I am using React Navigation in a React Native app. I manage the login step with the auth flow they say. This is, if I have a token stored then user is logged in, otherwise it is not.

I provide several Universal links to my app and some of them needs the user to be logged in.

The problem is that if I click on the universal link and the user is not logged in, when he logs in, the next screen is the main screen (let's call it HomeScreen).

Let's suppose I have the next navigation structure:

- Auth: {
    - Login
    - Register
}

- Main: {
    - Home
    - Profile: {
        - Advanced: {
            - Settings
        }
        - Profile
    }
    - Settings

Imagine I have a Universal link which points to https://example.com/profile/advanced/settings. If I'm logged in, I navigate to the screen without any problems, if not, I get the login screen and once I log in, I stay in the Home screen.

How can I manage a redirectUrl for the login? This redirectUrl in this case would be https://example.com/profile/advanced/settings

1 Answers
Related