faizalshap / react-native-otp-verify

React native sms verification without additional permissions
MIT License
239 stars 92 forks source link

Not working for me, its showing timeout errror #99

Open vishnulanka-dataevolve opened 11 months ago

vishnulanka-dataevolve commented 11 months ago

Sometimes its showing timeout and some times its not even working. can anyone share me working example.

ankitsharma29 commented 11 months ago

same issue face

ankitsharma29 commented 11 months ago

useEffect(() => { RNOtpVetify.getHash() .then(console.log) .catch(console.log); RNOtpVetify.getOtp() .then(p => RNOtpVetify.addListener(OTPHandler)) .catch(p => console.log(p));

return () => RNOtpVetify.removeListener();

}, []);

const OTPHandler = (message) => { console.log(message);

// const otps = getNumberFromString('number', message?.body);
// if (otps && otps.length > 0 && otps[0].length === otpLength) {
//   console.log("message", message, otps);
// }
const otp = /(\d{6})/g.exec(message);
console.log("message otp", otp);
  // onFillOTPData(otp);
RNOtpVetify.removeListener();

} timeout errror

Azeem00786 commented 8 months ago

i am also facing the same error here is my code snippet

async otpRead() {
    console.log('otpRead--> ');
    getHash()
      .then(hash => {
        console.log('hash--->', hash);
        // use this hash in the message.
      })
      .catch(console.log);

    startOtpListener(message => {
      // extract the otp using regex e.g. the below regex extracts 4 digit otp from message
      console.log('message-->', message);
      const otp = /(\d{4})/g.exec(message)[1];
      console.log('otp--->', otp);
    });
  }
mariaalm20 commented 8 months ago

Any solution?

MinhThu100200 commented 8 months ago

same issue :((((

ankitch29 commented 7 months ago

Hello, we're still encountering this issue. Could someone please assist us?

elencho commented 6 months ago

same issue, any solutions?

faizalshap commented 4 months ago

Please try in latest version and use hook if possible