- Integration of custom URL schemes and universal links for seamless app navigation.
- Native configuration requirements for both iOS and Android platforms.
- Advanced routing strategies using React Navigation to map URLs to specific screens.
- Security best practices for validating incoming data from external links.
Ever wondered how some apps just magically open to the exact product or profile you were looking at from an email or a web page? That’s the power of deep linking. It’s essentially a way to bypass the home screen and drop your users directly into a specific piece of content, which is a total game-changer for user retention and marketing campaigns. If you’ve ever used a “Magic Link” to log into a service, you’ve experienced this firsthand.
Setting this up in React Native can feel like a bit of a rabbit hole because you’re dealing with three different layers: the native OS settings, the navigation logic within your JS code, and the actual server-side verification for secure links. Whether you’re using a bare CLI project or the Expo ecosystem, getting these layers to talk to each other is the secret sauce to a seamless one-click experience between the web and your mobile app.
Understanding the Different Types of Links

Before diving into the code, it’s crucial to distinguish between outgoing and incoming linking. Outgoing linking is straightforward; it’s when your app tells the OS to open something else, like a website, a phone dialer, or a map. You simply use the Linking.openURL() method. On the flip side, incoming linking—the real deep linking—is when an external source triggers your app to open.
There are two main ways to handle these incoming triggers. First, you have Custom URL Schemes (like my-app://). These are easy to set up but have a few downsides: they aren’t unique, meaning another app could potentially hijack them, and they don’t provide a fallback if the app isn’t installed. The second, more professional route is using Universal Links (iOS) and App Links (Android). These use standard HTTPS URLs, which means they are secure, verified via your domain, and will simply open your website in a browser if the app isn’t on the device.
Configuring iOS for Deep Links

To get your iOS app to recognize a custom scheme, you’ll need to head over to Xcode. In the Info tab of your target settings, you can add a new URL Type and specify your desired scheme. If you’re going the Universal Links route, you’ll need a paid Apple Developer account to enable the Associated Domains capability, using the applinks: prefix for your domain.
On the code side, your AppDelegate needs to be modified to handle these incoming events. You must implement the openURL method for custom schemes and the continueUserActivity method for Universal Links, passing the data along to the RCTLinkingManager. For those using the modern SceneDelegate architecture, remember that you must forward these links from the SceneDelegate instead, otherwise, the initial URL might return as null during a cold start.
For Universal Links to actually work, you can’t forget the server side. You need to host a JSON file called apple-app-site-association (without a .json extension!) in the .well-known folder of your HTTPS-secured domain. This file acts as a handshake, telling iOS exactly which paths in your website should trigger the app.
Setting Up Android App Links

Android handles things through Intents. To enable deep linking, you’ll need to modify your AndroidManifest.xml file. You add an intent-filter to your MainActivity with an action set to android.intent.action.VIEW. It’s vital to include the DEFAULT and BROWSABLE categories; without these, the OS won’t allow a web browser to launch your application.
To upgrade from a simple custom scheme to a verified App Link, add android:autoVerify=\"true\" to your filter. Similar to iOS, Android requires a verification file called assetlinks.json hosted in the .well-known directory. This file contains your SHA256 certificate fingerprint, ensuring that only your signed app can handle those specific URLs.

While the native side handles the “opening” of the app, React Navigation handles the “where to go.” Instead of manually managing listeners, the best practice is to use the linking prop in your NavigationContainer. You define a prefixes array containing your custom schemes and domains, and a config object that maps URL paths to specific screen names.
If your app has a complex structure with nested navigators (like tabs inside a stack), your linking configuration must mirror that hierarchy. For instance, a path like /settings/profile would map to the RootStack, then the SettingsStack, and finally the Profile screen. React Navigation automatically parses URL parameters, so a link like /product/123 can pass the ID 123 directly into the screen’s route params.
Expo-Specific Implementations
If you’re in the Expo ecosystem, a lot of the heavy lifting is automated. You can simply define your scheme in the app.json file. To make your prefixes dynamic across development and production, it’s highly recommended to use expo-linking. The Linking.createURL('/') method is a lifesaver here because it generates the correct prefix regardless of whether you’re using Expo Go or a standalone build.
Testing and Security Considerations
Testing is where most developers get stuck. You should always test both cold starts (app is closed) and warm starts (app is in the background). On Android, the adb shell am start command is your best friend for simulating links. On iOS, you can use xcrun simctl openurl or simply type the URI into the Safari address bar.
A huge warning: never trust a deep link for authorization. A URL is just a navigation hint, not a security token. Your app must still perform authentication and authorization checks before displaying sensitive data. If a user hits a deep link to a private order but isn’t logged in, your logic should redirect them to the login screen and then route them back to the intended content after they’ve authenticated.
Implementing a robust linking strategy involves a careful dance between native OS configurations, server-side JSON files, and a well-mapped navigation tree in JavaScript. By combining custom schemes for internal triggers and Universal/App Links for a professional web-to-app transition, you create a frictionless journey for the user. Once the native registration and the navigation mapping are synced, your application becomes significantly more accessible, driving higher engagement through targeted entry points.