React Navigation 5.0深度链接不解析

问题描述 投票:0回答:1

我正在使用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,
          }
      }
    },
  };
react-native react-native-navigation
1个回答
0
投票

由于某些原因,我必须使用初始状态。然后它的工作。

  const { getInitialState } = useLinking(ref, {
    prefixes: [prefix],
    config
  });

<NavigationContainer initialState={initialState} ref={ref}>
© www.soinside.com 2019 - 2024. All rights reserved.