Pavan
Pavan

Reputation: 1015

React Native Deep Link Event Listener Not firing

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

handleOpenUrl is never called if the app is already open and I try to change the deep link Url. If the app is already not open then it opens the app and gets the URL.

Upvotes: 2

Views: 7081

Answers (2)

Jeff
Jeff

Reputation: 21

I was having this issue working on a detached Expo project because I had added the suggested code from https://facebook.github.io/react-native/docs/linking.html to the *AppDelegate.m but Expo already provides slightly different functions for handling URL events. Removing the code from the React Native docs made it work for me.

Upvotes: 1

Pavan
Pavan

Reputation: 1015

Actually it was the issue with FBSDK overriding the method.

This solution worked for me. https://github.com/react-navigation/react-navigation/issues/798#issuecomment-290363058

Upvotes: 4

Related Questions