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

openURL() not respecting deep links / universal links #38266

Closed
Estevete opened this issue Jul 10, 2023 · 7 comments
Closed

openURL() not respecting deep links / universal links #38266

Estevete opened this issue Jul 10, 2023 · 7 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Estevete
Copy link

Estevete commented Jul 10, 2023

Description

I have configured deep links & Universal Linking in my app (AASA, Assetlinks...). Let's say my Universal Link is https://example.com/profile. If I tap on that link outside the app, it opens correctly the app.

The issue comes when I use Linking.openURL("https://example.com/profile") inside the app. It opens the WebBrowser instead of opening in the app (since it's a universal link).

If I try to open for example instagram openURL("https://instagram.com"), it opens the instagram app (and not the web browser)...

The reason of this is because I have implemented the redirectURL, so if I send any link through the email and the user has to be logged in in order to access to it, then I redirect the user after he logs in.

Some months ago, this used to work correctly. This is happening on Android and iOS.

The same behavior happens if I use expo-linking package instead.

React Native Version

0.71.8

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 20.96 GB / 31.93 GB
  Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 9.6.2 - ~\node_modules\.bin\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0, 10.0.22000.0, 10.0.22621.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 17.5.33627.172 (Visual Studio Community 2022)
  Languages:
    Java: 11.0.16.1
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.8 => 0.71.8
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
info React Native v0.72.1 is now available (your project is running on v0.71.8).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.72.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.71.8
info For more info, check out "https://reactnative.dev/docs/upgrading".

Steps to reproduce

  1. Configure your app to use universal links / deep links
  2. Set openURL("..") to your configured universal link
  3. It will open the webbrowser
@github-actions
Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.71.12. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@blakef blakef added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 11, 2023
@github-actions
Copy link

⚠️ Missing Reproducible Example
ℹ️ It looks like your issue is missing a reproducible example. Please provide either:

@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 5, 2023
@github-actions
Copy link

This issue was closed because the author hasn't provided the requested feedback after 7 days.

@RajithaKumara
Copy link

Hi @Estevete, do you have any solution for this? I also have the same issue.

@Estevete
Copy link
Author

Hi. Not really. A possible workaround could be checking wether you're on mobile. If you are on mobile, then parse the URL to the app scheme and check with canOpenUrl. If canOpenUrl is false, then keep using the URL, otherwise open the app scheme (since it means you have the app installed).

But TBH, I think this feature is quite commonly used and there's no info about it on the docs...

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Aug 16, 2023
@collinahn
Copy link

Facing the same problem, I managed to open a hidden webview and open the universal links inside the webview.
works in iOS when the target app is installed, and no success in android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants