React Native - Unable to get Android sms-otp autofill to work
Asked Answered
L

1

7

I am using 0.66 (and also tried 0.68rc4) and am unable to get the autofill for otp to work on Android. Here is the component I have

<Input
  ...
  autoComplete="sms-otp"
  ...
/>

I tried the https://github.com/faizalshap/react-native-otp-verify library and it works, but am seeing if I can go with what RN provides if possible. The SMS is also appended with the correct app_hash, hence able to use the library above, but not with the out of box solution.

Does anyone have any suggestions?

Lundberg answered 25/3, 2022 at 17:49 Comment(1)
any update on this ?Empery
V
0

For Android : Google SMS Retriever API

https://github.com/Rajat421//react-native-sms-retriever-api#readme

For iOS :

You will use props textContentType of TextInput

<TextInput
value={this.state.codeOTP}
textContentType="oneTimeCode"
/>

You can test before with this example :

Tested on real device, and connect with the Apple account

<TextInput
value={this.state.codeOTP}
textContentType="emailAddress"
/>

already answered in - React Native How to auto fetched the OTP in the textfield from the mobile sms,should support both ios and android?

Vashtivashtia answered 8/1, 2023 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.