我的导航结构如下:
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',
},
});
我的深层链接URI是:
test://page/login
test://page/signup
test://details/12345
test://page/upsell
在链接到任何这些URI时,我总是被带到SplashScreen
,这是我应用程序的第一个屏幕。如何正确链接到嵌套导航器并链接到正确的屏幕?
答案 0 :(得分:0)
根据文档,您似乎还需要设置Android和iOS本机部分以使其正常工作。
此处描述:https://reactnavigation.org/docs/en/deep-linking.html#set-up-with-react-native-init-projects