GithubHelp home page GithubHelp logo

innovatrics / dot-react-native-samples Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 2.94 MB

A collection of quickstart samples demonstrating the DOT Android/iOS SDK in React Native project.

Home Page: https://developers.innovatrics.com/digital-onboarding/

JavaScript 0.79% Ruby 1.81% Objective-C 3.43% Swift 45.92% TypeScript 9.47% Kotlin 37.77% Objective-C++ 0.81%
digital-onboarding document-detection face-detection machine-readable-zone remote-identity-verification

dot-react-native-samples's Introduction

Native DOT SDK in React Native

This repository contains a basic example on how to use DOT SDK (iOS/Android) in React Native (typescript).

Getting Started

Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding. This project was developed and tested using Node.js v22.2.0.

Step 1: Set up project

To obtain a license file, please contact [email protected].

Android

  1. Copy the license file to android/app/src/main/res/raw/dot_license.lic.

iOS

  1. Copy the license file to ios/Assets/dot_license.lic.
  2. Run pod install --repo-update from ios directory.
  3. Open DotReactNativeSamples.xcworkspace and update app signing configuration using your certificates and profiles.

Step 2: Start the Metro Server

You will need to start Metro, the JavaScript bundler that ships with React Native. First, make sure you have all dependencies. Run:

npm install

To start Metro, run the following command from the root of your this repository:

# using npm
npm start

# OR using Yarn
yarn start

Step 3: Start Application

Let Metro Bundler run in its own terminal. Open a new terminal from the root of this repository. Run the following command to start your Android or iOS app:

For Android

# using npm
npm run android

# OR using Yarn
yarn android

For iOS

# using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see DOT SDK React Native Samples App running in your Android Emulator or iOS Simulator shortly provided you have set up your emulator/simulator correctly.

This is one way to run your app โ€” you can also run it directly from within Android Studio and Xcode respectively.

Technical details

Android

Code responsible for bridge between the Kotlin and Typescript code can be found in:

  • DotSdkReactModule.kt - A native module is a Kotlin class that extends the ReactContextBaseJavaModule class and implements the functionality required by the TypeScript. Most methods (annotated by @ReactModule) are callable from TypeScript and are responsible for starting activities and retrieving data from them.
  • DotSdkReactPackage.kt - Apps package that extends ReactPackage and uses createNativeModules to register a native module.
  • MainApplication.kt - We have to provide the package to getPackages method of the MainApplication - this is pre-existing file/class created by react-native

More information about native modules here: https://facebook.github.io/react-native/docs/native-modules-android.

iOS

Code responsible for bridge between the Swift and Typescript code can be found in:

  • DotSdkReactModuleBridge.m - A native module bridge which registers required information with React Native.
  • DotSdkReactModule.swift - A native module Swift class which implements the functionality required by the TypeScript.

More information about native modules here: https://reactnative.dev/docs/native-modules-ios.

ReactNative

We can use DotSdk class found in NativeModules exported from react-native. It will call native code for the corresponding platform (iOS/Android).

Code can be found in App.tsx (root of the repo).

Example:

import { NativeModules } from 'react-native';

const dotSdk = NativeModules.DotSdk

// Initialize DOT SDK
dotSdk.initialize()
   .then(...)
   .catch(...);

...
...

// Start Document Auto Capture component

dotSdk.startDocumentAutoCapture(null)
   .then(...)
   .catch(...);

dot-react-native-samples's People

Contributors

dependabot[bot] avatar soson avatar tvojtatk0 avatar inno-juraj-haluska avatar paulooze avatar

Watchers

Theredsunrise (Branislav Lavicka) avatar  avatar Peter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.