tttstudios / react-native-otp-input

Tiny Javascript library which provides an elegant UI for user to input one time passcode.
MIT License
528 stars 239 forks source link

On Ios it s work but on Android => TypeError: Cannot read properties of undefined (reading 'getString') #161

Open BenjaminGuelle opened 2 years ago

BenjaminGuelle commented 2 years ago

Hello

when arrived on screen pincode on Android, i'm stopped with this message :

Promise Rejection (id: 3):
TypeError: Cannot read properties of undefined (reading 'getString')
TypeError: Cannot read properties of undefined (reading 'getString')

i think this problem come to clipboard maybe, not sure

however, it works on ios

hirbod commented 2 years ago

I can confirm this. And it is only happening on Android. Its the Clipboard thats not working... I will investigate

hirbod commented 2 years ago

I created a fork which works: https://github.com/hirbod/react-native-otp-input

Check the readme, because the clipboard library is not at -community but -clipboard now.

ShashankEd commented 2 years ago

Hi @hirbod, I've tried your alternative library, and it is giving me the same issue on Android "TypeError: Cannot read properties of undefined (reading 'getString')"

My react native version is 0.64.2.

Screenshot 2022-04-12 at 8 13 43 PM

Can you please help me, as this is blocking my current project and it's delivery!

hirbod commented 2 years ago

@ShashankEd at the end I ditched this repo and used a way more reliable library: https://github.com/retyui/react-native-confirmation-code-field

Together with https://github.com/akvelon/react-native-sms-user-consent I managed to get a perfect autofill solution as well for android with the userConsentApi and autofill on iOS

ShashankEd commented 2 years ago

Hey @hirbod thank you for reverting back on my query, I will try your suggestion and let you know how it goes.

ShashankEd commented 2 years ago

Hi @hirbod

@ShashankEd at the end I ditched this repo and used a way more reliable library: https://github.com/retyui/react-native-confirmation-code-field

Together with https://github.com/akvelon/react-native-sms-user-consent I managed to get a perfect autofill solution as well for android with the userConsentApi and autofill on iOS

@ShashankEd at the end I ditched this repo and used a way more reliable library: https://github.com/retyui/react-native-confirmation-code-field

Together with https://github.com/akvelon/react-native-sms-user-consent I managed to get a perfect autofill solution as well for android with the userConsentApi and autofill on iOS

Thank you @hirbod it helped me to implement my app's functionality!😀

ghost commented 1 year ago

Hi just install npm i @react-native-community/clipboard and it will works!!

Olyno commented 1 year ago

Hi @ShashankEd, i'm still having this error after installing @react-native-community/clipboard. I changed to the alternative above.

ghost commented 1 year ago

Hi @Olyno can you share error

Olyno commented 1 year ago

It's literally the same error that @ShashankEd has above.

lylysunshinee commented 1 year ago

Thank @ShashankOodles1 work for me!

XeonCodes commented 8 months ago

Don't use the recommended module for Clipboard.

Use => https://www.npmjs.com/package/@react-native-clipboard/clipboard

Then, the go to => node_modules/@twotalltotems/react-native-otp-input/dist/index.js in your project

Remove the default clipboard the library is using. Change it to the one you installed. That's all. The package is using the deprecated Clipboard from react-native that is why it can't getString().

I hope you get this. It should work.