1.0.49 • Published 4 years ago

smileidentity-react-native-wrapper v1.0.49

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

smileidentity-react-native-wrapper

React Native wrapper for smile identity Mobile SDK  

- Installation:

npm i smileidentity-react-native-wrapper OR yarn add smileidentity-react-native-wrapper

Run `react-native link` to link this library on React Native < 0.60.0

 

- Download the required Smile Identity Libraries for Android or iOS on the Smile Identity Website

 

Android Setup:

- Follow the Instructions on the Android Readme

 

iOS Setup:

- Follow the Instructions on the iOS Readme

 

- Usage:

Import Smile Identity into your JavaScript Project

import SmileIdentity from 'smileidentity-react-native-wrapper';

SmileIdentity has 3 functions

startCapturingSelfie

Capture a selfie with:

SmileIdentity.captureSelfie(options, onCompleteCallback);

Options: Key | Value --------------------------| ------------- photoQuality | Double (Value: 0 to 1) fileName | String smileRequired | Boolean captureSmileManually | Boolean cameraFacingFront | Boolean

onCompleteCallback returns a file path to the captured image

const onCompleteCallback = bitmapFilePath => {
      console.log(`${bitmapFilePath} `);
      pauseCapturingSelfie();
};

pauseCapturing

Manually pause capturing with

SmileIdentity.pauseCapturing()

stopCapturing

Manually stop capturing and remove camera overlay with

SmileIdentity.stopCapturing()

Listening to Events (Optional)

You can listen to face changed events and errors from the camera preview

Import NativeEventEmitter

import {NativeEventEmitter} from 'react-native';

Listen to FaceChanged and Error events

componentDidMount() {
    const eventEmitter = new NativeEventEmitter(SmileIdentity);
    eventEmitter.addListener('FaceChanged', faceChangedEventValue => {
      console.log(`Face changed ${faceChangedEventValue}`);
    });
    eventEmitter.addListener('Error', errorMessage => {
      console.log(errorMessage);
    });
  }

Example Project

You can check out the Sample App

Authors

1.0.49

4 years ago

1.0.48

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

1.0.39

4 years ago