My navigation structure is as follows:
const App = () => {
const prefix = 'test://';
return <AppNavigator uriPrefix={prefix} />;
};
const AppNavigator = createSwitchNavigator({
splash: SplashScreen,
auth: AuthStack,
main: HomeStack,
});
const AuthStack = createStackNavigator({
landing: LandingScreen,
login: {
screen: LoginScreen,
path: 'page/login',
},
register: {
screen: RegisterScreen,
path: 'page/signup',
},
});
const HomeStack = createStackNavigator({
home: HomeScreen,
details: {
screen: DetailsScreen,
path: 'details/:assetId',
},
upsell: {
screen: UpsellScreen,
path: 'page/upsell',
},
});
My deep linking URI are:
test://page/login
test://page/signup
test://details/12345
test://page/upsell
On linking to any one of these URIs, I am always taken to the SplashScreen
which is the first screen of my app. How do I link to nested navigators properly and link to the correct screen?
According to documentation it looks like you also need to set up Android and iOS native part to make it works correctly.
It is described here: https://reactnavigation.org/docs/en/deep-linking.html#set-up-with-react-native-init-projects
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.