You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/auth-flow.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -938,3 +938,65 @@ By specifying a condition for our screens, we can implement auth flow in a simpl
938
938
## Don't manually navigate when conditionally rendering screens
939
939
940
940
It's important to note that when using such a setup, you **don't manually navigate** to the `Home` screen by calling `navigation.navigate('Home')` or any other method. **React Navigation will automatically navigate to the correct screen** when `isSignedIn` changes - `Home` screen when `isSignedIn` becomes `true`, and to `SignIn` screen when `isSignedIn` becomes `false`. You'll get an error if you attempt to navigate manually.
941
+
942
+
## Handling deep links after auth
943
+
944
+
When using deep links, you may want to handle the case where the user opens a deep link that requires authentication.
945
+
946
+
Example scenario:
947
+
948
+
- User opens a deep link to `myapp://profile` but is not signed in.
949
+
- The app shows the `SignIn` screen.
950
+
- After the user signs in, you want to navigate them to the `Profile` screen.
951
+
952
+
To achieve this, you can pass `UNSTABLE_routeNamesChangeBehavior="lastUnhandled"`:
953
+
954
+
:::warning
955
+
956
+
This option is experimental and may change in a minor release.
The `UNSTABLE_routeNamesChangeBehavior` option allows you to control how React Navigation handles navigation when the available screens change because of conditions such as authentication state. When `lastUnhandled` is specified, React Navigation will remember the last screen that couldn't be handled, and after the condition changes, it'll automatically navigate to that screen if it's now available.
0 commit comments