React Native - 无法让 Android sms-otp 自动填充工作

发布于 2025-01-17 01:38:31 字数 400 浏览 2 评论 0原文

我正在使用 0.66(也尝试过 0.68rc4),但无法让 otp 自动填充在 Android 上运行。这是我

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

尝试过的组件 https://github.com/faizalshap/react- native-otp-verify 库并且它可以工作,但我正在看看我是否可以使用 RN 提供的内容(如果可能的话)。 SMS 还附加了正确的 app_hash,因此能够使用上面的库,但不能使用开箱即用的解决方案。

有人有什么建议吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2025-01-24 01:38:31

对于 Android:Google SMS 检索器 API

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

对于 iOS:

您将使用 TextInput 的 props textContentType

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

您可以使用此示例进行测试:

Apple 帐户

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

在真实设备上进行测试,并连接已在 - React Native 如何从移动短信中自动获取文本字段中的 OTP,应该同时支持 ios 和 android?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文