Skip to main content
Version: 2.0.0

SDK Installation (React Native)

Detour provides a React Native SDK (@swmansion/react-native-detour) compatible with Expo and bare React Native projects.

Before installation, make sure your app is created in the Detour Dashboard and you have:

  • appID from API configuration
  • publishable apiKey from API configuration
  • platform integration snippets from App configuration

Install package

npm install @swmansion/react-native-detour

Install peer dependencies (Expo projects)

For Expo projects (including prebuild), install peer dependencies with Expo CLI so versions are matched to your Expo SDK:

npx expo install expo-application expo-clipboard expo-constants expo-device expo-localization @react-native-async-storage/async-storage

Bare React Native projects

If you are not using Expo CLI, install peer dependencies with your package manager and pin versions compatible with your React Native/Expo Modules setup.

npm install expo-application expo-clipboard expo-constants expo-device expo-localization @react-native-async-storage/async-storage

@react-native-async-storage/async-storage is optional if you provide a custom storage adapter in config. See Custom Storage.

Credentials in app config

import { type Config } from '@swmansion/react-native-detour';

export const detourConfig: Config = {
apiKey: process.env.EXPO_PUBLIC_DETOUR_API_KEY!,
appID: process.env.EXPO_PUBLIC_DETOUR_APP_ID!,
shouldUseClipboard: true,
};

Keep apiKey and appID in environment variables or another secure configuration layer.

Next steps

  1. Implement the provider and link handling in SDK Usage.
  2. Pick a runnable app pattern in Examples.
  3. If upgrading existing code, follow Migration to v2 and start from From 0.x or From 1.0.1.