# React Native Module

# Latest Release

Version 1.10.5

# Installation

yarn add @sumsub/react-native-mobilesdk-module

# Android

Add the following repository to your android/build.gradle file:

allprojects {
  repositories {
      // ...
      maven { url  "https://maven.sumsub.com/repository/maven-public/" }
      // ...
  }
}

# iOS

  1. Add as follows at the top of ios/Podfile:
source 'https://cdn.cocoapods.org/'
source 'https://github.com/SumSubstance/Specs.git'

Then run:

npx pod-install
  1. Update Info.plist to have description for the camera and microphone usage
plutil -insert "NSCameraUsageDescription" -string "Let us take a photo" ios/{YOUR-APP-NAME}/Info.plist
plutil -insert "NSMicrophoneUsageDescription" -string "Time to record a video" ios/{YOUR-APP-NAME}/Info.plist

# Launching SDK

Before launching make sure you did the Backend routines

import SNSMobileSDK from '@sumsub/react-native-mobilesdk-module';

// ...

let launchSNSMobileSDK = () => {
    let apiUrl = 'https://test-api.sumsub.com'
    // generate one on the backend
    let accessToken = '_act-d0829687-f53a-45cb-b442-50a9da8f0550'
    let snsMobileSDK = SNSMobileSDK.Builder(apiUrl)
            .withAccessToken(accessToken, () => {
              // this is a token expiration handler, will be called if the provided token is invalid or got expired
              // call your backend to fetch a new access token (this is just an example)
              return fetch('http://example.org/', {
                method: 'GET',
              }).then(resp => {
                // return a fresh token from here
                return '_act-5f8f4104-074e-45fd-949a-dd68e2bd986a'
              })
            })
            .build();
    snsMobileSDK.launch().then(result => {
      console.log("SumSub SDK State: " + JSON.stringify(result))
    }).catch(err => {
      console.log("SumSub SDK Error: " + JSON.stringify(err))
    });
}

  <Button
      onPress={launchSNSMobileSDK}
      title="Launch SumSub SDK"
  />

# iOS

You can customize or localize the texts used within the SDK through standard Xcode means. In order to do so you will need to open your ios project in the Xcode xed ios/${PWD##*/}.xcworkspace, then download and add the IdensicMobileSDK.strings file, that comes along with SDK into Xcode project and localize it by adding the languages that you desire.

Last Updated: 6/16/2020, 10:27:02 PM