Deeplinks

Lucra supports deep links for navigating into specific flows. There are two parts:

  1. Outgoing links: Lucra asks you to pack a Lucra deep link inside your provider.

  2. Incoming links: Your app forwards deep links back to Lucra so it can take over navigation.

Register a provider to convert Lucra deep links into your app's preferred format (short links, branded domains, etc.).

import { registerDeepLinkProvider } from '@lucra-sports/lucra-react-native-sdk';
import { linkShortener } from 'my-link-shortener';

registerDeepLinkProvider(async (lucraDeepLink) => {
  const shortenedDeepLink = await linkShortener(lucraDeepLink);
  return shortenedDeepLink;
});

Unpack your incoming link and hand it to Lucra for matching:

import { LucraSDK } from '@lucra-sports/lucra-react-native-sdk';
import { Linking } from 'react-native';
import { linkExpander } from 'my-link-shortener';

const linkingSubscription = Linking.addEventListener('url', async ({ url }) => {
  const deepLink = await linkExpander(url);
  const handled = await LucraSDK.handleLucraLink(deepLink);
  if (handled) {
    // Lucra will present the appropriate flow
    return;
  }
});

const initialLink = await Linking.getInitialURL();
if (initialLink) {
  const deepLink = await linkExpander(initialLink);
  await LucraSDK.handleLucraLink(deepLink);
}

iOS Linking Configuration

If you use React Native Linking, forward openURL to RCTLinkingManager and allow Lucra to handle Venmo callbacks if needed:

On iOS with the new architecture, dynamic links can fail when the app is closed. Work around this by resolving the initial URL via Linking and then passing to dynamicLinks().resolveLink.

Managing App State

If the app opens from background, you may want to store the link until UI is ready:

Avoid Calling Lucra Before Init

If your app processes deep links on launch, guard the handler until LucraSDK.init has completed. A simple approach is to conditionally render your deep link manager once the SDK is ready:

Last updated