react-native-confirmation-code-field: Unable to autofill code with sms code

Hi there, First of all - Love your work. This library saved me a lot of time 😃 I currently have an issue with it - when I try to ā€œpasteā€ a code using the SMS code autocomplete (when you receive a code via SMS, and you can press on in like other auto complete suggestions), I get the wrong code. Tried to debug it a bit, and it seems that handlerOnChangeText receives the code one char at a time, but as a whole. for example, if the code is 123456. then the text will be 1 for the first time, 12 for the second, 123 for the third etc. As a workaround, I’ve changed text = text[0]; to text = text[text.length - 1]; (and changed maxLength to code length) but this is probably not the best idea… BTW, tried canPasteCode but as you can understand it didn’t solve the issue. Any ideas?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 28 (11 by maintainers)

Most upvoted comments

savingfromsms __________________________________________________________________

Facing the same problem in IOS when copying through SMS. Could any one help me, to solve this?

@retyui : Good job, Keep it up. I was looking for the autofill SMS, I think I can use this.

Thanks for your feedback! The component got better

I didn’t find API in the docs, Someone requested this feature (see https://forums.expo.io/t/built-in-android-ios-sms-listener/19361/2)