> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trueorigin.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native

> Add TrueOrigin to a React Native or Expo app.

`@trueorigin/react-native` is an Expo module around the TrueOrigin iOS SDK. iOS only for
now: on Android and web every call is a no-op and the attribution status is
`unsupported`.

Requirements: Expo SDK 50 or later (any Expo app, or a bare React Native app with
[Expo Modules installed](https://docs.expo.dev/bare/installing-expo-modules/)), iOS 15.1
or later, Xcode 16 or later.

## Install

```bash theme={null}
npx expo install @trueorigin/react-native
npx expo prebuild   # or: npx expo run:ios, or an EAS build
```

<Note>
  The module needs a new native build. It is not part of Expo Go.
</Note>

## Configure

Your SDK key is shown when you create the app, and can be rotated in the dashboard under
**Settings → SDK key**. It is a public client key, like RevenueCat's: keep it in your
app's public config.

```ts theme={null}
import TrueOrigin from '@trueorigin/react-native'

// as early as possible, e.g. at the top of your root layout
TrueOrigin.configure('to_…')
```

Next: [read the attribution](/sdk/attribution) in your app.

### Options

```ts theme={null}
TrueOrigin.configure('to_…', {
  logging: __DEV__,     // unified logging, subsystem dev.trueorigin.sdk
  reportTimeout: 21600, // seconds to keep retrying the first report
})
```

## API

|                               |                                                           |
| ----------------------------- | --------------------------------------------------------- |
| `configure(apiKey, options?)` | Start the SDK. Only the first call counts.                |
| `attribution()`               | Promise of the final attribution. Never rejects.          |
| `onAttribution(handler)`      | Callback form; returns a cancel function.                 |
| `currentAttribution()`        | The stored attribution, without waiting.                  |
| `installId()`                 | The SDK's id for this install, `null` on Android and web. |
| `revenueCatAttributes()`      | Attributes for RevenueCat, see [RevenueCat](/revenuecat). |
| `isAvailable`                 | Whether the native SDK is linked.                         |
| `sdkVersion`                  | Version of the bundled iOS SDK.                           |

Types are exported: `Attribution`, `AttributionStatus`, `ConfigureOptions`.

## Universal Links

Universal Links are optional. To use them, add the associated domain in `app.json`, then
follow [Universal Links](/sdk/ios#universal-links) for the dashboard side:

```json theme={null}
{
  "expo": {
    "ios": {
      "associatedDomains": ["applinks:appdownload.link"]
    }
  }
}
```

## Privacy

The package contains the same iOS binary as the [iOS SDK](/sdk/ios#privacy), with the
same privacy manifest. It does not read the IDFA or the IDFV.
