QuickStart for React Native

Get sample projects up and running quickly using TypeScript and native digi.me SDKs. The React-Native demo is pre-configured and ready to be compiled and run with little configuration required. Please contact us first to obtain credentials for your application.

Min Requirements

• ImageMagicK
• Node JS
• Yarn package manager

For Android development

• Android Studio 3.2.0+
• Any Android device with Android 5.0 and above
• Development environment to support Android API 21+
• JDK 1.8.181+
• digi.me and a library installed on the Android device

For iOS development

• Cocoapods
• iOS 11+
• iPhone 5, iPad (4th generation), or iPad mini (2nd generation)
• Registered Apple developer account
• Swift 4 or higher
• XCode 9 or higher
• digi.me and a library installed on the iOS device

New to TypeScript?

Please see the TypeScript quick start documentation for help on building a web application and other resources.

Get started

1. Clone the demo app

The React-Native demo code repository is stored under GitHub. Clone the repository to your machine to get the demo app. Run the following command in the terminal;

git clone https://github.com/digime/digime-react-native-demo.git

2. Install dependencies

For first run, run the following command to install the required dependencies;

yarn install

If developing for iOS, please ensure that the following command to is run next. This pulls down the required Cocoapod dependencies, installs any required React-Native dependencies, and also attempts to fix various issues that may occur during the iOS build process;

yarn install-ios

3. Configure the app

A demo contract ID and p12 file have already been embedded in for ease of use. The contract selects both Social and Finance data from a digi.me library for a given time period (please contact us if you would like to use a different contract). Set your application ID and p12 password in /constants/Constants.ts as shown from the placeholders below:

export class Constants {
    public static readonly APPLICATION_NAME: string = "[YOUR APPLICATION_NAME]";
    public static readonly APPLICATION_ID: string = 
"[YOUR APPLICATION_ID]"
; public static readonly CONTRACT_ID: string = "gzqYsbQ1V1XROWjmqiFLcH2AF1jvcKcg"; public static readonly P12_PASSPHRASE: string =
"[YOUR P12_PASSWORD]"
; public static readonly P12_FILENAME: string = "CA_RSA_PRIVATE_KEY"; public static readonly P12_EXTENSION: string = ".p12"; public static readonly ARGON_URL: string = "https://api.digi.me"; }

4. Build and set native project variables

The React-Native demo embeds both the Android and iOS native digi.me SDKs. In order to set the variables to the native projects, the TypeScript must first be compiled to JavaScript using command below. Please note that this needs to be run each time there are any TypeScript changes.

yarn compile

Then, the following command is required in order to create the native Android and iOS images and assets, but also to set the variables from Constants.js. Please note that `configure native` only needs to be run when there are changes to Constants.ts or any additions to the ./assets directory.

yarn configure-native

5. Run on your device

Run the app then create a digi.me library to use with CA. Connect your device, then run the following command (platform dependent);

Android:

yarn run-android

iOS:

yarn run-ios

6. Make it your own

Explore the code! Use the demo app as a base or start a new project. For more information about the React-Native demo please check out our GitHub React-Native Demo documentation.