Add the Mati SDK Plugin to your project by command
INSTALL: npm install https://github.com/MatiFace/react-native-mati-global-id-sdk.git --save
UNINSTALL: npm uninstall react-native-mati-global-id-sdk
if you reinstall plugin, pleased dont forget sync with gradle files for Android, and pod clean && pod update for iOS.
The following is a example component.
import React, {Component} from 'react';
import {
NativeModules,
NativeEventEmitter,
Button,
View
} from 'react-native';
import {
MatiGlobalIdSdk,
} from 'react-native-mati-global-id-sdk';
export default class App extends Component {
constructor() {
super();
console.log('Constructor Called.');
}
componentDidMount() {
//set listening callbacks
const MatiVerifyResult = new NativeEventEmitter(NativeModules.MatiGlobalIdSdk)
MatiVerifyResult.addListener('verificationSuccess', (data) => console.log(data))
MatiVerifyResult.addListener('verificationCanceled', (data) => console.log(data))
}
//call showFlow when button is clicked
handleMatiClickButton = () => {
//set 3 params clientId (cant be null), flowId, metadata
var yourMetadata = { param1: "value1", param2: "value2" }
MatiGlobalIdSdk.showFlow("YOUR_CLIENT_ID", "YOUR_FLOW_ID", yourMetadata);
}
//Add button to view graph
render() {
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'powderblue',
}}>
<Button onPress={this.handleMatiClickButton} title="Click here"/>
</View>
);
}
}
#EXAMPLE Please check examples here: https://github.com/GetMati/mati-mobile-examples/tree/main/reactNativeDemoApp
In the IOS platform find the Podfile file.
Run "pod install" to fetch the project dependencies.
The following permissions are needed to capture video and access the photo gallery.
For voiceliveness feature please add NSMicrophoneUsageDescription
<key>NSCameraUsageDescription</key>
<string>Mati needs access to your Camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Mati needs access to your media library</string>
<key>NSMicrophoneUsageDescription</key>
<string>Mati needs access to your Microphone</string>
In react native Flipper doesnt have support yet
So you have to remove it from yours project. (It is adding by default)
/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler or other x86_64 issues
It's because of use_flipper in Podfile for iOS project.
use_flipper! or use_flipper!()
use_frameworks!
post_install do |installer| react_native_post_install(installer) end
post_install do |installer| react_native_post_install(installer)
installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end end
pod clean pod install
Flipper facebook/react-native#29984
0.64 FBReactNativeSpec facebook/react-native#31034
0.60+ – https://github.com/GetMati/mati-mobile-examples/blob/main/reactnative-podexamples/Podfile_063
0.64 – https://github.com/GetMati/mati-mobile-examples/blob/main/reactnative-podexamples/Podfile_064