react-native native library as a wrappper aroud private / paid MiSnap & Misnap Liveness Android/iOS libraries.
$ react-native link react-native-misnap
Due the issue with pod & asset catalogs CocoaPods/CocoaPods#8122, you need to add graphical resources into iOS project. Simply drag: =Include-resources_in_mainproject=/ios_drag_to_xcode/react-native-misnap
folder into your xcode project root folder. All resources are graphical resources that will be bundled directy in app bundle.
- Open ios/Podfile and insert :
pod 'RNMisnap', :path => '../node_modules/react-native-misnap'
- Due the issue with pod & asset catalogs CocoaPods/CocoaPods#8122, you need to add graphical resources into iOS project. Simply drag:
=Include-resources_in_mainproject=/ios_drag_to_xcode/react-native-misnap
folder into your xcode project root folder. All resources are graphical resources that will be bundled directy in app bundle.
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.omni.misnap.RNMisnapPackage;
to the imports at the top of the file - Add
new RNMisnapPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-misnap' project(':react-native-misnap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-misnap/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-misnap')
import MiSnapManager, { MiSnapConfig, MiSnapResult } from 'react-native-misnap';
const config: MiSnapConfig = {
captureType: 'idFront',
autocapture: true,
};
MiSnapManager.capture(config)
.then((result: MiSnapResult) => {
const capturedImage = result.base64encodedImage;
const { metadata = {} } = result;
// Do something with base64 encoded image string and optional metaData
})
.catch((error: Error) => {
// Do something with error
});