-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
24 lines (19 loc) · 793 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { DeviceEventEmitter, NativeModules } from 'react-native';
const RNOtpVerify = NativeModules.RNOtpVerify;
interface OtpVerify {
getOtp: () => Promise<boolean>;
getHash: () => Promise<string[]>;
requestHint: () => Promise<string>;
addListener: (handler: (value: string) => any) => import("react-native").EmitterSubscription;
removeListener: () => void;
}
const OtpVerify: OtpVerify = {
getOtp: RNOtpVerify?.getOtp,
getHash: RNOtpVerify?.getHash,
requestHint: RNOtpVerify?.requestHint,
addListener: (handler) =>
DeviceEventEmitter
.addListener('com.faizalshap.otpVerify:otpReceived', handler),
removeListener: () => DeviceEventEmitter.removeAllListeners('com.faizalshap.otpVerify:otpReceived'),
}
export default OtpVerify;