React Native setup
Install @invitebase/react-native, set up the Expo config plugin, and wire the provider and deep links
@invitebase/react-native wraps the native iOS and Android SDKs behind a hooks-first TypeScript API. Attribution runs natively on each platform — clipboard handoff on iOS, Play Install Referrer on Android — so a React Native app gets exactly the same attribution quality as a fully native one. Expo is supported first-class via a config plugin, with no ejecting.
This page covers installation and wiring. The hooks API is documented in the React Native hooks reference; the shared method surface in the SDK reference. For a guided first integration, see the React Native quickstart.
Install
npx expo install @invitebase/react-nativeAdd the config plugin to handle native module linking, the URL scheme, and Associated Domains / App Links in the managed workflow:
{
"expo": {
"plugins": [
[
"@invitebase/react-native",
{
"linkDomain": "mycompany.refr.link"
}
]
]
}
}Then rebuild the dev client: npx expo prebuild && npx expo run:ios (or run:android).
npm install @invitebase/react-native
npx pod-installAutolinking handles both platforms. Complete the platform deep-link setup by hand: the Associated Domains entitlement on iOS and the verified intent filter on Android, both pointing at your {app}.refr.link subdomain.
In both cases, register your Apple Team ID + bundle ID and Android package name + signing fingerprints in the dashboard under Settings → Attribution — Invitebase serves the AASA and assetlinks.json files for your subdomain.
Provider setup
Wrap your app in InvitebaseProvider. It calls configure natively, starts deferred attribution, and makes the hooks work anywhere below it.
import { InvitebaseProvider } from '@invitebase/react-native';
export default function App() {
return (
<InvitebaseProvider publishableKey="pk_test_51Hq2jK">
<RootNavigator />
</InvitebaseProvider>
);
}| Prop | Type | Description |
|---|---|---|
publishableKey | string | Required. pk_test_… or pk_live_… — the prefix determines test vs live mode. |
autoResolve | boolean | Run deferred attribution automatically on first launch. Default true. |
debug | boolean | Log SDK activity. Default false. |
Deep-link handling
Deferred attribution (fresh installs) is fully automatic — the native layers run the clipboard handoff (iOS) and Install Referrer (Android) with no JavaScript involvement.
For the already-installed path (Universal Links / App Links), the provider listens for incoming URLs automatically on both Expo (expo-linking) and bare RN (Linking). If you manage URL subscriptions yourself — for example inside a navigation library's linking config — forward URLs explicitly:
import * as Linking from 'expo-linking';
import { useInvitebase } from '@invitebase/react-native';
function useInvitebaseLinks() {
const invitebase = useInvitebase();
React.useEffect(() => {
const sub = Linking.addEventListener('url', ({ url }) => {
invitebase.handleInbound(url);
});
Linking.getInitialURL().then((url) => url && invitebase.handleInbound(url));
return () => sub.remove();
}, [invitebase]);
}handleInbound ignores URLs that are not referral links, so it is safe to forward everything.
Drop-in components
The package exports the cross-platform UI components as React Native components, themeable via your per-campaign configuration and fully replaceable with custom UI over the hooks:
import {
InviteScreen, // offer, link/code with copy, native share sheet, tier strip
ReferrerStatusView, // invitees, referral states, tier ladder, earnings
CodeEntrySheet, // manual entry with validation, strong/soft variants
} from '@invitebase/react-native';Push notifications
If you use Invitebase-managed referral push notifications — the default delivery mode — forward the native device token — APNs on iOS, FCM on Android — after registering for remote notifications:
import * as Notifications from 'expo-notifications';
import { useInvitebase } from '@invitebase/react-native';
const invitebase = useInvitebase();
const { data: token } = await Notifications.getDevicePushTokenAsync();
await invitebase.setPushToken(token);Any push library works as long as it exposes the native token (an Expo push token is not one). The SDK attaches the token to the current user and keeps it current across rotations. Details in setPushToken.
Bringing your own push provider instead? Skip this — device tokens stay on your side, and Invitebase will hand each notification to your backend as a notification.due webhook (bring-your-own-push is planned, not yet available).