Deep linking in React Native: Universal Links, App Links and deferred deep links
A practical guide to deep linking in React Native — what Universal Links and App Links need, why the first open after install is the hard part, and how to handle every link in one place.
To set up deep linking in React Native, add Universal Links on iOS (an Associated Domains entitlement plus an apple-app-site-association file) and App Links on Android (an autoVerify intent filter plus assetlinks.json), so https:// links open the app. Read incoming links with Linking.getInitialURL() and the url event. Add a deferred deep linking SDK if new users should land on the same screen after they install.
Deep linking means a URL opens a specific screen in your app instead of the home screen. In React Native you'll deal with three kinds of link, and each needs something different. Using Expo? See the Expo Router deep linking guide.
The three kinds of link
| Kind | Example | What it needs |
|---|---|---|
| URI scheme | myapp://product/42 |
A scheme registered in the app. Easy, but browsers show warnings and it does nothing if the app isn't installed. |
| Universal Link / App Link | https://link.myshop.com/product/42 |
A verified domain: apple-app-site-association (iOS) and assetlinks.json (Android) hosted on it. |
| Deferred deep link | Same HTTPS link, tapped before install | A service that remembers the link through the store install and hands it to the app on first open. |
Universal Links (iOS)
- In Xcode, open Signing & Capabilities → Associated Domains and add
applinks:link.myshop.com. - Host an
apple-app-site-associationfile on that domain listing your Team ID and bundle ID. Our guide to setting up both verification files has the exact formats for this file andassetlinks.json. - Apple fetches the file through its CDN, so changes can take a while to show up — test on a real device, from Notes or Messages, not by typing the URL into Safari.
App Links (Android)
- Add an intent filter with
android:autoVerify="true"for your domain inAndroidManifest.xml. - Host
/.well-known/assetlinks.jsonwith your package name and the SHA-256 fingerprint of your signing key (Play App Signing has its own key — use that one). - Check verification with
adb shell pm get-app-links your.package.name.
Handling the link in React Native
React Native's Linking API gives you the URL that opened the app, and an event for links that arrive while it's running:
import { Linking } from "react-native";
Linking.getInitialURL().then((url) => url && open(url));
const sub = Linking.addEventListener("url", ({ url }) => open(url));
That covers installed apps. It does not cover the most valuable case: someone taps your referral or product link, doesn't have the app, installs it, and opens it. getInitialURL() returns null on that first open — the link is gone.
Deferred deep links: the first open
To keep the link through the install, a service records the click, sends the user to the store, and on first open matches the install back to that click. On Android the Play Install Referrer makes that match exact; here's how iOS matching works without the IDFA. With the CodeOnAir SDK, @codeonair/deeplink-react-native on npm, the same callback handles all three cases:
import DeepLink from "@codeonair/deeplink-react-native";
DeepLink.init(); // reads the App ID from AndroidManifest.xml / Info.plist
useEffect(
() =>
DeepLink.onLink((link) => {
// link.path, link.params, link.isDeferred
navigation.navigate(link.path, link.params);
}),
[],
);
link.isDeferred tells you it came through an install — useful for things like crediting a referral or skipping onboarding. Our refer-and-earn guide builds a full referral flow on top of it.
Testing checklist
- Tap the link with the app installed → the right screen opens.
- Uninstall, tap the link, install, open → the right screen opens on the first launch.
- Tap it on a desktop → the web fallback opens.
- Share it on WhatsApp → the preview shows the right title and image.
- Tap it inside Instagram or Facebook → you get a way into the app. In-app browsers don't fire Universal Links or App Links; here's why, and the fix.
The commands for each case (adb, simctl, cold and warm starts, deferred links) are in how to test deep links on Android and iOS. If links open the browser instead of the app, work through the iOS Universal Links checklist and the Android App Links verification guide.
Create links from the app
Share buttons need a link per product, post or invite. The SDK can make one on the spot:
import { Share } from "react-native";
import DeepLink from "@codeonair/deeplink-react-native";
async function shareProduct(product) {
const url = await DeepLink.createLink({
path: `/product/${product.id}`,
params: { ref: "share" },
ogTitle: product.name,
ogImage: product.imageUrl,
});
await Share.share({ message: `${product.name}: ${url}` });
}
createLink uses the App ID from your native config, so no secret key ships in the app. For links made on your server, such as one per user or per order, use the REST API with a secret key. Every link counts towards your plan's app links: 100 on Free, unlimited on paid plans. Reuse a link for the same product instead of creating one per tap.
FAQ
Why does getInitialURL() return null after an install?
Because the App Store and Play Store don't pass the link to the app. Only a deferred deep linking service can recover it on the first open.
Do I still need a custom URI scheme if I have Universal Links?
For most links, no. It's still worth registering one: inside Instagram or Facebook, an "Open in app" button on iOS needs a scheme to open the app.
Should I use React Navigation's linking config as well?
You can keep it for mapping URLs to screens, but navigate from one place. If both React Navigation and your onLink handler act on the same URL, the screen can open twice.
Does this work with Expo?
Yes, in a development build or a store build (not Expo Go). The SDK includes an Expo config plugin that adds Associated Domains, the intent filter and the App ID. See the Expo deep linking guide.
Get started
CodeOnAir AppLinks hosts the apple-app-site-association and assetlinks.json files for you and shows the exact Xcode and manifest lines in the dashboard. Follow the React Native SDK docs, then create a free account: the Free plan includes 100 app links, and new workspaces get 30 days of Growth free.