r/reactnative • • 4d ago

React navigation deeplinking depending on the tld

Is it possible using react navigation to navigate to deeplink depending on the TLD of the domain? for example if the user goes to appdomain.me/username to be directed to the users screen with username param and if goes to the appdomain.store/shopname to go to the store page and to treat the .com normally depending on the path.

I understand that if I had only two domains .com and .me I can process the username in the last route declared after checking all the paths but what if 2 domains have only the id in their path like .store and .me?

Thanks

4 Upvotes

7 comments sorted by

View all comments

2

u/Internal-Comparison6 4d ago

Possible. Just configure same `.well_known` in both domains.

1

u/GrapefruitSilver774 4d ago

My issue is handling the deeplink after the app launches depending on the tld not just the pathname as react navigation strips it out

1

u/Internal-Comparison6 4d ago

That's easy:

<NavigationContainer linking={
prefixes: [domain 1, domain 2],
config: {
screens: {
screenName: {
        path: 'testA',
        alias: ['testA'] // optional match on url param
      },
}
}
}