README
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
Smile Identity Website
- Download the required Smile Identity Libraries for Android or iOS on the
Android Setup:
Android Readme
- Follow the Instructions on the
iOS Setup:
iOS Readme
- Follow the Instructions on the
- 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