【问题标题】:React Native - Unable to get Android sms-otp autofill to workReact Native - 无法让 Android sms-otp 自动填充工作
【发布时间】:2023-01-09 00:10:57
【问题描述】:

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

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

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

有没有人有什么建议?

【问题讨论】:

  • 这事有进一步更新吗 ?

标签: android react-native sms autofill android-autofill-manager


【解决方案1】:

对于 Android:Google SMS Retriever API

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

对于 iOS:

您将使用 TextInput 的道具 textContentType

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

您可以在此示例之前进行测试:

真机测试,连接苹果账号

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

已经回答 - React Native How to auto fetched the OTP in the textfield from the mobile sms,should support both ios and android?

【讨论】:

    猜你喜欢
    • 2021-04-10
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 2015-12-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多