Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate to URI/Deep Link #73

Closed
markflorisson opened this issue Jan 29, 2017 · 7 comments
Closed

Navigate to URI/Deep Link #73

markflorisson opened this issue Jan 29, 2017 · 7 comments

Comments

@markflorisson
Copy link

Can we manually navigate to a deep link/URI, or should we use Linking.openURL(...)?

@mkonicek
Copy link

mkonicek commented Jan 30, 2017

Hey, can you please explain 'manually navigate'? Can you share a code example? Have you checked the linking example here?
https://github.com/react-community/react-navigation/tree/master/examples

@markflorisson
Copy link
Author

Yes, I mean can we open a deeplink from within the app without having to parse it? I realize this is not a common usecase (we can always represent dynamic links within the app in a more convenient format than a deep link), so we can probably close this.

@marlonoso
Copy link

I'm wondering how can we open a link from a navigator entry. Like:

const Home = DrawerNavigator(
  {
    Account: { screen: Account },
    Availability: { screen: Availability },
    Favorites: { screen: Favorites },
    Website: { screen: Linking.openURL('http://www.example.com') },
  }, 

@ericvicenti
Copy link
Contributor

@marlonoso, With the current API, you'd be best off by implementing your own drawer content component.

There are a bunch of hacks you could do, like using a dummy component and then overriding the router getStateForAction behavior to intercept the navigate request and do something different, but you might run into some issues with that.

But there are certainly a few ways we could improve this. If you'd like to propose a better API, feel free to open up a detailed RFC issue.

@ericvicenti
Copy link
Contributor

@markflorisson For now, you'd be best off using Linking.openURL in your app, but I might be in support of a OpenURI navigation action, if that is something you'd want to propose and push forward.

@helixbass
Copy link

@ericvicenti I was attempting to use your suggested solution of using Linking.openURL() (use case is navigating to a specific screen when a push notification is opened) but seem to have run into the issue that when using Linking.openURL() with a universal link (as opposed to a custom-protocol deeplink URI), iOS doesn't allow the app itself to handle the universal link (so Linking.openURL() opens Safari)

So for now am going to just manually recreate the existing uriPrefix/path navigation logic by parsing the universal link URL, but am curious how hard it'd likely be to add an OpenURI action, as it may be worth investing in that option as the number of universal link types on this project grows?

@netgfx
Copy link

netgfx commented Oct 12, 2019

Is there a solution to this then? Can we add a Linking.openURL directly on the drawer screen property? Because right now it crashes my App

ShyJuno pushed a commit to ShyJuno/react-navigation that referenced this issue Apr 19, 2024
ShyJuno pushed a commit to ShyJuno/react-navigation that referenced this issue Apr 19, 2024
…avigation#73)"

This reverts commit 115bc778e85ec4e128d32d57fd01784c121e4bfc.

Will come to it later when I have more time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants