@complycube/react-native
Version:
ComplyCube's React Native Mobile SDK library for Identity Verification, KYC, and AML
33 lines • 1.12 kB
JavaScript
import React from 'react';
import ComplyCubeRN from './ComplyCubeSDK';
import ComplyCubeAndroid from './ComplyCubeComponentAndroid';
import { Platform, View } from 'react-native';
export default function ComplyCube(_ref) {
let {
settings,
onSuccess,
onCancel,
onError
} = _ref;
const [isIOS, setIOS] = React.useState(Platform.OS === 'ios');
// Check device on loading of component
React.useEffect(() => {
const complycube = new ComplyCubeRN();
// We add handlers in Both case
complycube.addHandlers(onSuccess, onError, onCancel);
// We put it here too so we validate the settings both ways
complycube.setSettings(settings);
// Check if is iPhone
if (Platform.OS === 'ios') {
setIOS(true);
complycube.mount();
} else {
setIOS(false);
}
}, []);
// console.log('ComplyCube: ', isIOS);
return /*#__PURE__*/React.createElement(React.Fragment, null, isIOS ? /*#__PURE__*/React.createElement(View, null) : /*#__PURE__*/React.createElement(ComplyCubeAndroid, {
settings: settings
}));
}
//# sourceMappingURL=ComplyCubeComponent.js.map