@sendtoapp/react-native-referrer
v0.1.14
Published
Expo-independent React Native deep links with Android Play Install Referrer recovery
Maintainers
Readme
@sendtoapp/react-native-referrer
Deep links for bare React Native, with Google Play install recovery.
npm install @sendtoapp/react-native-referrerUse this when someone taps your link, does not have the app, installs it from Play, and should still land on the page the link pointed at. Android carries a referrer through that trip; this package reads it and redeems it for the route.
For an Expo project use @sendtoapp/expo
instead, which does the same thing through the Expo module system.
import { Linking } from 'react-native';
import { createNativeDeepLinkClient } from '@sendtoapp/react-native-referrer';
const client = createNativeDeepLinkClient({ host: 'acme.sendtoapp.com' });
const stop = client.subscribe(Linking, route => {
// a link tapped with the app already installed
});
// On first launch, ask whether this install came from a link.
const deferred = await client.getDeferredLink();
if (deferred) {
navigate(deferred.route);
await deferred.acknowledge(); // so it is not delivered again on the next launch
}getDeferredLink returns null when the install did not come from one of your links, so it is
safe to call on every launch. Everything @sendtoapp/react-native exports is re-exported here,
so this package replaces it rather than sitting beside it.
The route only survives an install on Android. iOS has no equivalent of the install referrer, so an iPhone without the app goes to your App Store page and opens at your normal starting screen.
Autolinking picks up the native module; rebuild after installing. MIT licensed. Full documentation at sendtoapp.com/docs.
Documentation
Full documentation is at sendtoapp.com/docs, and sendtoapp.com is what the platform does in one page.
Quick start · Expo and React Native · Install recovery · Knowing when a link failed · Troubleshooting · HTTP API
The rest of SendToApp
- @sendtoapp/react-native — Expo and React Native, with the config plugin that writes the native declarations
- @sendtoapp/expo — Expo, with Google Play install recovery through the Expo module system
- @sendtoapp/core — Link resolution with no UI framework attached
- @sendtoapp/mcp — An MCP server, so an agent can register apps and mint links
- @sendtoapp/protocol — The wire format the other packages share
MIT licensed. Built by SendToApp.
