我正在使用react native navigation 5.0进行深度链接。
我正在用这个来测试。它进入应用程序,但它不路由到正确的页面.我认为我的用例是相当简单的直接 - 我可能做一些愚蠢的wrong?
谢谢
xcrun simctl openurl booted xx:Chat1234
<NavigationContainer linking={linking} ref={navigationRef}>
<Stack.Navigator headerMode='none'>
<Stack.Screen name="Home" component={HomeContainer} />
<Stack.Screen name="Chat" component={ChatContainer} />
...
</NavigationContainer>
const linking = {
prefixes: ['https://xx.com', 'xx://'],
config: {
Chat: {
path: 'Chat/:groupId',
params:{
groupId: null,
}
}
},
};
由于某些原因,我必须使用初始状态。然后它的工作。
const { getInitialState } = useLinking(ref, {
prefixes: [prefix],
config
});
<NavigationContainer initialState={initialState} ref={ref}>