React Native SDK
Native module for deferred deep linking and programmatic link creation.
Installation
bash
npm install flinku-react-nativeSetup
Configure once at app startup with your project baseUrl. Complete iOS Associated Domains and Android App Links as in the Quick Start .
typescript
import { Flinku } from 'flinku-react-native';
const flinku = new Flinku({
baseUrl: 'https://yourapp.flku.dev',
userId: 'unique-device-id', // use react-native-device-info or your own
// apiKey: 'flk_live_xxx', // required for createLink
});match()
typescript
const result = await flinku.match();
if (result && result.deepLink) {
// Navigate using your router
}createLink()
typescript
const created = await Flinku.createLink({
apiKey: 'flk_live_your_api_key',
title: 'Summer Campaign',
deepLink: 'yourapp://promo',
params: { ref: 'instagram' },
});
console.log(created.shortUrl);Full TypeScript example
typescript
import React, { useEffect, useState } from 'react';
export function FlinkuBootstrap() {
const [pending, setPending] = useState(null);
useEffect(() => {
const flinku = new Flinku({
baseUrl: 'https://yourapp.flku.dev',
userId: 'unique-device-id', // use react-native-device-info or your own
// apiKey: 'flk_live_xxx', // required for createLink
});
void (async () => {
const m = await flinku.match();
if (m) setPending(m);
})();
}, []);
const shareCampaignLink = async () => {
const link = await Flinku.createLink({
apiKey: process.env.FLINKU_API_KEY!,
title: 'Partner promo',
deepLink: 'yourapp://promo',
params: { ref: 'instagram' },
});
console.log('Short URL:', link.shortUrl);
};
return (
{pending?.deepLink ? (
Deferred link: {pending.deepLink}
) : (
No pending Flinku link
)}
);
}