React Native

Follow the below guide to get started with Incode Mobile Onboarding using React Native. We currently support NPM and Expo.

Requirements

React Native SDK Documentation

Getting Started

The React Native SDK is distributed through a private NPM package. Before installing, you must have a free NPM account, then contact Incode and share your NPM username. Incode will send an invitation to join our React Native team to the email address associated with the NPM account. You must accept this invitation to access the SDK within 7 days.

Add a .npmrc file to your project

A .npmrc file is used to customize the behavior of NPM distributions and configure private package access. Within the root directory of your React Native project, create a .npmrc file using the below code as a guide. Tokens can be obtained from NPM using these instructions .

//registry.npmjs.org/:_authToken=<your-npm-token>
//registry.npmjs.org/:username=<your-npm-username>
//registry.npmjs.org/:email=<your-email-assocated-with-your-npm-account>

Install the React Native SDK

The Incode React Native SDK is distributed through a private NPM package.

npm i @incode-sdks/react-native-incode-sdk

Additional Setup for iOS

If you are using the React Native CLI as a build tool, you must link to iOS.

Requirements:

Steps:

  1. Change your Podfile so it requires deployment target 11 or higher.
-platform :ios, '10.0'
+platform :ios, '11.0'
  1. Add this line to the top of your Podfile:
    • RN >= 0.69: no changes needed
    • RN < 0.69:
 pod 'react-native-incode-sdk', :path => '../node_modules/@incode-sdks/react-native-incode-sdk/'
  1. Add an empty Swift file (e.g. Void.swift) through xCode to your native project. When prompted for a bridging header, choose Create Bridging header.

  2. Relying on React Native's auto-linking, run the following:

cd ios && pod install cd ..
  1. Add the following to Info.plist:
  • NSCameraUsageDescription: The SDK uses the camera in order to verify the identity of the customer, e.g. in ID scan, Selfie scan and so on.
  • NSLocationWhenInUseUsageDescription: The SDK uses the current user location in order to detect exact location for Geolocation step.
  • NSMicrophoneUsageDescription: The SDK uses microphone for performing a video call during Video Conference step or for doing speech recognition during Video Selfie.
  1. Go to your project's Target, Build Settings -> Other Linker Flags and add these flags:
$(inherited) -all_load -ObjC -l “stdc++” -l “iconv”

Additional setup for Android

If you are using the React Native CLI as a build tool, ensure following settings are set in your app's build.gradle file:

  1. Change your minSdkVersion to 21 or higher. Set compileSdkVersion to 33 or higher.

  2. Add this dependency:

  dependencies {
+    implementation 'com.incode.sdk:core-light:2.6.2'
  }
  1. Application has multidex support enabled:
  defaultConfig {
    ...
+   multiDexEnabled true
    ...
  }
  dependencies {
    ...
+   implementation 'com.android.support:multidex:1.0.3'
    ...
  }

Your Application class should now be able to extend MultiDexApplication:


+  import androidx.multidex.MultiDexApplication;

+  public class MyApplication extends MultiDexApplication implements ReactApplication {
  ...
 }
  1. Modify your project's build.gradle so it contains GitHub Packages username and password, provided by Incode.
⚠️

IMPORTANT

Distribution through Artifactory will no longer be supported after September 19th, 2025. If you are currently using Artifactory in your production integration, you must complete the migration to GitHub Packages before this date to ensure uninterrupted access to the SDK.

allprojects {
  repositories {
    ...
+    jcenter()
+    maven {
+      url "https://maven.pkg.github.com/Incode-Technologies-Example-Repos/android-omni-packages"
+      credentials {
+        username = "incode-customers"
+        password = "GITHUB_PACKAGE_TOKEN"
+      }
+    }
    ...
  }
}

Expo Installation

If you are using Expo as a build tool you can Install the SDK using using the Expo CLI. Ensure you have a .npmrc configured to access our private React Native SDK.

//registry.npmjs.org/:_authToken=<your-npm-token>
//registry.npmjs.org/:username=<your-npm-username>
//registry.npmjs.org/:email=<your-email-assocated-with-your-npm-account>
  1. Install the React Native SDK
npx expo install @incode-sdks/react-native-incode-sdk
  1. Install configuration plugin
npx expo install @incode-sdks/expo-incode-sdk-configuration
  1. Integrate and configure configuration plugin. Update 'plugins' field in app.json file:
{
  "expo": {
      "plugins": [
          [
              "@incode-sdks/expo-incode-sdk-configuration",
              {
                  "artifactoryUserName": "incode-customers",
                  "artifactoryPassword": "your_githubpackage_token"
              }
          ]
      ]
  }
}