React Native SDK v1 Integration
Looking for v2?
If your Template starts with tmpl_, you’re on v1.
We will stop making updates to v1 on December 31, 2022. You will still be able to create inquiries, but no new features or fixes will be available. We recommend moving to v2 for access to the latest product improvements- please see migration to v2 section or contact us.
Cocoapods 1.9.3 is incompatible
Cocoapods 1.9.3 has a bug that prevents builds from selecting the correct architecture. See more details here: https://github.com/CocoaPods/CocoaPods/pull/9790.
To install, please downgrade to 1.8.x or upgrade to 1.10.x
Installation
To install the Persona React Native SDK within your React Native application, if you use
yarn to manage your project dependencies
If you use npm to manage your project dependencies
Configure Android
Add Maven repository
Open your android/build.gradle file. Add the Persona Maven repository to the bottom of your repository list.
Make sure minimum compile is over 30
In the app/build.gradle file, make sure the compileSdkVersion is at least 31.
If you change the targetSdkVersion to be above 30 as well, you’ll need to set android:exported="true" on your Activity in the AndroidManifest.xml file.
Configure iOS
Install iOS pods
Enable iOS Permissions
Ensure access to the Camera within your iOS app.
Modify your Info.plist:
Navigate to your project’s settings in Xcode and click the Info tab Add a new Privacy - Camera Usage Description entry (if not already present) to enable camera access.
Set iOS minimum deployment target
Our native iOS SDK requires a minimum iOS deployment target of 11.0.
In your project’s ios/Podfile, ensure your platform target is set to 11.0.
iOS frameworks support
Recent versions of React Native project generators should have this included by default. If you have been incrementally updating your React Native project from older versions, however, you may need to add this.
Without use_frameworks! the SDK will fail to compile due to problems importing Lottie, which is a dependency of the SDK.
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.
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.
Inquiry Attributes
The onSuccess callback returns attributes, which is an object containing information extracted during the inquiry. The attributes object includes birthdate, name, and address.
Configuration options
Some different configuration example can be found below
Theming
In order to theme the experience, use the persona-tool to customize the colors of Persona Inquiry flow. The tool itself acts as a guide to walk you through theming your experience.
Follow the instructions provided by the theming tool to set up the proper configuration. Themes will need to be configured separately for iOS and Android.
For more information on theming, view React Native SDK Theming
Replacing strings
You can replace title, body, or button text by overwriting string resource files.
Replacing strings on Android
React Native strings files are typically located in android/app/src/main/res/values/strings.xml or android/app/src/main/res/values-<LANGUAGE>/strings.xml. Any strings you write will replaces those used by the Persona SDK.
Example:
Available Android String Keys
persona_contact_support_bodypersona_contact_support_buttonpersona_contact_support_titlepersona_countryselect_bodypersona_countryselect_buttonpersona_countryselect_titlepersona_governmentid_failed_titlepersona_governmentid_start_bodypersona_governmentid_start_titlepersona_governmentid_submitting_bodypersona_governmentid_submitting_titlepersona_inquiry_complete_bodypersona_inquiry_complete_buttonpersona_inquiry_complete_titlepersona_inquiry_failed_bodypersona_inquiry_failed_buttonpersona_inquiry_failed_titlepersona_inquiry_start_bodypersona_inquiry_start_buttonpersona_inquiry_start_titlepersona_selfie_failed_bodypersona_selfie_failed_buttonpersona_selfie_failed_titlepersona_selfie_start_bodypersona_selfie_start_buttonpersona_selfie_start_titlepersona_selfie_submitting_bodypersona_selfie_submitting_title
Replacing strings on iOS
Provide a Persona.strings file that replaces strings used by the Persona SDK.
Example:

