Closed mkurczewski closed 1 year ago
Hi @mkurczewski that’s correct Would you like to create a PR and contribute to the repo?
this worked for me
useEffect(() => {
startOtpListener(message => {
if (message) {
const otp = /(\d{6})/g.exec(message)![1];
setOTP(otp.split(''));
}
});
return () => removeListener();
}, []);
Fixed with PR
There's a bug in
useOtpVerify
hook -numberOfDigits
parameter is in fact not used at all. Look at line62
for regex/(\d{4})/g
-4
is hardcoded while there should benumberOfDigits
variable used, so instead ofhttps://github.com/faizalshap/react-native-otp-verify/blob/aff1f30f843144e0910d2fa467028953d36ca7be/src/index.tsx#L62
it should be