I am encountering a problem with my authentication and React-Navigation's way of deeplinking.
I have the following navigation structure:
Authenticated Stack
//screens including TrackListScreen
Unauthenticated Stack
//login screen
I deeplink to the TrackListScreen via the /playlist/${id} path, which is in the Authenticated Stack.
How can I make it so, if the user isn't authenticated, basically he's in the Unathenticated stack redirect to the login first? Or check if the user is logged somehow and if not I can navigate there. The docs do not mention anything about this.
My deeplinking structure is:
const linking = {
prefixes: ['appName://', 'appName.com://', APP_WEB_DOMAIN],
config: {
screens: {
SignInScreen: 'login',
UnauthenticatedStack: '',
TrackListScreen: 'playlist/:id/' //:id gets parsed as a string, you have to specify it if you want a number.
}
}
};
Thanks in advance!