React Native Masterpass Turkey Package
npm install @macellan/react-native-masterpass-trMasterpass Turkey Package for React Native
``sh`
npm install @macellan/react-native-masterpass-tr --save
or
`sh`
yarn add @macellan/react-native-masterpass-tr
Please, install dependencies for using this package.
`sh`
yarn add react-native-webview react-native-event-listeners
- React Native WebView Installation
- React Native Event Listener Installation
Wrap your parent component in Provider from react-native-masterpass-tr.
`tsx
import * as React from 'react';
import { MasterPassProvider, IConfig } from 'react-native-masterpass-tr';
const ParentComponent: React.FC = () => {
/ MasterPass Config Object /
const config: IConfig = {
token: '',
serviceUrl: '',
clientId: '',
userId: '',
sendSmsLanguage: '',
sendSms: '',
referenceNo: '',
clientIp: '',
};
return (
{/ Other Child Components /}
);
}
export default ParentComponent;
`
Add MasterPassTurkey to the component you want to use.
`tsx
import * as React from 'react';
import {
MasterPassTurkey,
IMasterPassTurkeyRefs,
} from 'react-native-masterpass-tr';
const ChildComponent: React.FC = () => {
const masterpass = React.useRef
const onRegistrationCheck = React.useCallback(() => {
masterpass.current
?.registrationCheck()
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error);
});
}, []);
return
};
export default ChildComponent;
``
MIT