Skip to content

React Native SDK — Overview

The @truconsent/consent-notice-react-native package provides React Native components for consent banners and the Rights Center. It is designed for Expo-managed and bare React Native workflows. All API calls are made directly from the device.

Two separate base URLs are involved:

PurposeURLUsed for
SDK runtimehttps://trukit-dev.truconsent.ioTruConsentModal and NativeRightCenter at runtime
Management APIYour management API base URLFetching assetId and bannerId during setup
Terminal window
npx expo install @truconsent/consent-notice-react-native

Or with npm/yarn:

Terminal window
npm install @truconsent/consent-notice-react-native
# or
yarn add @truconsent/consent-notice-react-native

Store your SDK config in app.json under the extra key:

{
"expo": {
"extra": {
"truConsentApiKey": "your-consent-scope-key",
"truConsentOrganizationId": "your-organization-id",
"truConsentAssetId": "your-asset-id",
"truConsentApiUrl": "https://trukit-dev.truconsent.io"
}
}
}

Read these values at runtime using Expo Constants:

import Constants from 'expo-constants';
const {
truConsentApiKey,
truConsentOrganizationId,
truConsentAssetId,
truConsentApiUrl,
} = Constants.expoConfig?.extra ?? {};
  1. Get API key and org ID — Generate credentials from the platform dashboard.

  2. Fetch asset ID — Discover your assetId via the Management API.

  3. Fetch collection point details — Discover your bannerId via the Management API.

  4. Integrate consent banner — Mount TruConsentModal with Android/iOS platform setup.

  5. Integrate Rights Center — Mount NativeRightCenter to handle DPDPA data subject rights.