react-navigation + deep linking

I am attempting to use the Deep Linking expo module in our app. I am posting here after spending 3 days trying to resolve the issue. The issue is as follows,

We have defined two paths for deep linking in our app. “Home” and a “Demo” page. If the app is closed and I open the link via mobile safari as “myapp://home” the app opens and directs to the correct page. Linking.getInitialUrl returns the correct URL.

However, if the app remains open, and I open a new link via the browser nothing happens. The view does not change and the addEventListener does not fire.

I included the RTCLinking library as per the react-native docs and added the relevant AppDelegate.m changes but at this point, it is a complete dead end.

SDK 31
react-navigation V3

I have updated the “scheme” prop as well but nothing I have tried thus far helps.

hi… are you already open the screen you want to deep linking??
my experienced when i open other screen its okay, but the problem when i open the same screen but with different parameter.

i read it before that getInitialUrl only give return when the apps in background.
So i used Linking.addEventListener(url).

  _navigate = (url) => {
    const route = url.replace(/.*?:\/\//g, '');
    const id = route.match(/\/([^\/]+)\/?$/)[1];
    this.props.navigation.replace('YOUR_ROUTE', { id });
// YOU CAN TRY THIS TOO this.props.navigation.navigate('YOUR_ROUTE', { id });
  }

async componentDidMount() {
  Linking.addEventListener('url', (url) => {
    this._navigate(url.url); // REDIRECT REPLACE SCREEN
  });
}

Hey,

Sorry for not following up here but I did not have a chance to work on this until recently. I needed to update to SDK 33 for Android 64 bit requirements. Deep linking now works without any issues. The listener is responding to all url changes including having parameters.

I do not know why I could not get it to work with SDK 31 despite trying numerous suggestions.

@brambang No. I was trying to switch to different screen. Whilst on SDK 31 I was able to open the first deep link. However, no subsequent url changes were detected.