2
  componentDidMount() {
    Linking.addEventListener('url', event => 
    this.handleOpenURL(event.url));
    Linking.getInitialURL().then(url => {
     console.log('url===',url);
     if(url)
      this.handleOpenURL(url);
   });
  }

如果应用程序已经打开并且我尝试更改深层链接 Url,则永远不会调用 handleOpenUrl。如果应用程序尚未打开,则它会打开应用程序并获取 URL。

4

2 回答 2

3

实际上这是 FBSDK 覆盖该方法的问题。

这个解决方案对我有用。 https://github.com/react-navigation/react-navigation/issues/798#issuecomment-290363058

于 2018-01-10T14:15:54.060 回答
1

我在处理一个独立的 Expo 项目时遇到了这个问题,因为我已经将https://facebook.github.io/react-native/docs/linking.html中的建议代码添加到了,*AppDelegate.m但是 Expo 已经提供了稍微不同的处理 URL 的函数事件。从 React Native 文档中删除代码使它对我有用。

于 2018-06-29T18:09:57.730 回答