Deep Linking
Handle incoming deep links in your React Native app with the Grovs SDK
Listening for deep links
Register a listener with onDeeplinkReceived. It is called with the link that opened the app and its custom payload:
import Grovs from 'react-native-grovs-wrapper';
const listener = Grovs.onDeeplinkReceived((response) => {
console.log('Link:', response.link);
console.log('Data:', response.data);
// Route the user based on payload
if (response.data?.screen === 'product') {
navigation.navigate('Product', { id: response.data.productId });
}
});
// When you no longer need the listener
listener.remove();The listener fires for links the app was opened with, for links delivered while it is running, and for deferred links matched after a fresh install, whether by fingerprint or from the clipboard. response.data holds the data you passed when generating the link. On both platforms the native bridge also includes the link's tracking metadata in the event, though it is not part of the DeeplinkResponse type.
When to register
Register once, in your root component or app entry point. You do not have to beat the link: on both platforms the link the app was opened with is held natively and delivered as soon as the first listener registers. On iOS only the most recent link is held. On Android each new registration restarts the native subscription, which re-delivers the most recent link to every listener, so registering in several components can navigate twice.
For the native side to receive links at all, your app needs the URL scheme, intent filters, Associated Domains, and the AppDelegate and MainActivity forwarding from the Quick Start.
When the lookup fails
If the link lookup fails because the phone is offline or the backend is unavailable, the native SDK keeps the link and retries on its own: after a widening wait, when the app returns to the foreground, and when the network comes back. The listener fires once the lookup succeeds.
While the SDK is disabled
Links are not resolved while setSDK(false) is in effect. On Android the wrapper forwards onStart again when you call setSDK(true), so a launch link is delivered then; on iOS it is not replayed. See Privacy & Consent.
Clipboard-assisted deferred deep linking
When a link with copy-to-clipboard enabled is opened in a browser, the preview page copies it to the visitor's clipboard before sending them to the store. On the first launch after install, if fingerprint matching found nothing, the native SDK reads the clipboard and attributes the install deterministically. The deferred link arrives through the same onDeeplinkReceived listener as a fingerprint match, and can arrive several seconds after launch.
This works with no JavaScript integration. The check is skipped when the backend reports no recent clicks on clipboard-enabled links for your project, and only links on Grovs hosts or the domains you configure are sent. The platform specifics, including the system paste notice on iOS and the "pasted from your clipboard" toast on Android 12 and later, are covered on the iOS and Android pages.
If your project serves links from a custom domain, list it so the SDK recognizes your links. With the Expo config plugin, set clipboardDomains:
["react-native-grovs-wrapper", {
"apiKey": "your-api-key",
"scheme": "your_app_scheme",
"clipboardDomains": ["links.yourdomain.com"]
}]In a bare project, pass clipboardDomains to the native configure calls:
Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, autoTrackScreenViews: false, clipboardDomains: ["links.yourdomain.com"], enabled: GrovsWrapperSwift.isSDKEnabled(), delegate: nil)Grovs.configure(this, "your-api-key", useTestEnvironment = false, baseURL = null, autoTrackScreenViews = false, clipboardDomains = listOf("links.yourdomain.com"), enabled = GrovsConsent.isEnabled(this))Enable copy-to-clipboard per link with copyToClipboardIos and copyToClipboardAndroid, or set the default for the whole project in the dashboard. The end-to-end flow, settings, and limits are described in Copy to Clipboard.
What the wrapper does not expose
The native linkDetails API, which fetches the details of a previously generated link by its path, is not available from JavaScript. Use the REST API from your backend if you need it.