> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.withpersona.com/2020-05-18/react-native-sdk-v2-integration-guide/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server. # React Native Integration Guide ## Installation To install the Persona React Native SDK within your React Native application, if you use `yarn` to manage your project dependencies **`shell`** ```shell shell yarn add react-native-persona ``` If you use `npm` to manage your project dependencies **`Shell`** ```shell Shell npm i react-native-persona ``` ### Configure Android #### Add Android Maven repository Open your `android/build.gradle` file. Add the Persona Maven repository to the bottom of your repository list. ``` allprojects { repositories { // ... maven { url 'https://sdk.withpersona.com/android/releases' } } } ``` #### Ensure minimum compile sdk In the `app/build.gradle` file, make sure the `compileSdkVersion` is at least 33. ``` android { // ... compileSdkVersion = 33 // ... } ``` #### Ensure minimum Android Gradle Plugin version Make sure your project's Android Gradle Plugin version is at least 8.0. ### Common Android issues #### `android/build.gradle` not found If you're using Expo and can't find your `android/build.gradle` file try running `npx expo run:android` to generate the native android project for your app. If your app doesn't load our Android native module you'll receive the following runtime error: > Cannot read property 'startInquiry' of null After running this command and generating the `build.gradle` file, you can then configure it according to the instructions above. #### Maven can't resolve `com.withpersona.sdk2:inquiry` ``` Could not determine the dependencies of task ':app:processDebugResources'. > Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'. > Could not find com.withpersona.sdk2:inquiry:2.x.y. Searched in the following locations: - https://repo.maven.apache.org/maven2/com/withpersona/sdk2/inquiry/2.x.y/inquiry-2.x.y.pom ... ``` Refer to instructions above on adding our maven repo url to your project's `build.gradle` file, you can also reference our example here [https://github.com/persona-id/persona-react-native-sample/blob/main/SampleApp/android/build.gradle#L38-L40](https://github.com/persona-id/persona-react-native-sample/blob/main/SampleApp/android/build.gradle#L38-L40). ### Configure iOS #### Install iOS pods Ensure Cocoapods v1.10.x or higher is installed. ``` cd ios; pod install ``` #### iOS Permissions Modify your `Info.plist` file to add the appropriate Privacy Usage Descriptions (if not already present). Navigate to your project's settings in Xcode and click the Info tab. | Info.plist Key | Note | | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Privacy - Camera Usage Description NSCameraUsageDescription | Used to access Camera for Government Id, Selfie, and Document flows. | | Privacy - Location When In Use Usage Description NSLocationWhenInUseUsageDescription | Required. Used for GPS collections. Unfortunately, Apple does not provide tools to differentiate when the API is in use. Therefore, even if your app does not utilize the GPS functionality, we must include the usage string because our SDK includes geolocation features. | | Privacy - Photo Library Usage Description NSPhotoLibraryUsageDescription | Optional. Used on Document flows and on Government Id flows when file upload is enabled. | | Privacy - NFC Scan Usage Description NFCReaderUsageDescription | Optional. Used for Passport NFC flows. | | Privacy - Microphone Usage Description NSMicrophoneUsageDescription | Optional. Used for video flows. | #### iOS minimum deployment target Our native iOS SDK requires a minimum iOS deployment target of 13.0. In your project's `ios/Podfile`, ensure your `platform` target is set to 13.0. ``` platform :ios '13.0' ``` #### iOS Privacy Configuration This SDK collects a user’s [IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) for fraud prevention purposes. In [App Store Connect](https://appstoreconnect.apple.com/) > Your App > App Privacy, if you haven’t already add in a “Device Identifier,” and fill out the questionnaire with the following answers: * **Usage**: App Functionality (covers fraud prevention) * **Are the device IDs collected from this app linked to the user’s identity?** Yes * **Do you or your third-party partners use device IDs for tracking purposes?** No ### Common iOS issues #### `ios/` folder not found If you're using expo and can't find your `ios` folder, try running `npx expo run:ios` to generate the native iOS project for your app. Then run `pod install` from the `ios` folder. If your app doesn't load our iOS native module you'll receive the following runtime error: > Your JavaScript code tried to access a native module that doesn't exist. ## Usage The Persona Inquiry flow can be initiated with either a `template ID` or an `inquiry ID`. Please refer to the code sample below and replace `my_template_id` with your `template ID`. You can find your `template ID` on the Persona Dashboard under [Integration](https://withpersona.com/dashboard/integration). This starts the Inquiry flow and takes control of the user interface. Once the flow completes, the control of the user interface is returned to the app and the appropriate callbacks are called. **`javascript`** ```javascript javascript import {Inquiry, Environment} from 'react-native-persona'; // ...