iOS 17 密码建议不适用于 React Native TextInput

问题描述 投票:0回答:1

我正在开发一个 React Native 应用程序,并且有一个注册屏幕,要求用户输入新密码并确认。我正在尝试利用 iOS 17 密码建议功能来获得更人性化的体验。

然而,它似乎并没有达到预期的效果。这是相关的代码片段:

<TextInput
    style={styles.input}
    placeholderTextColor='rgba(60, 60, 67, 0.30)'
    secureTextEntry
    placeholder={t('Registration.passwordplaceholder')}
    onChangeText={(text) => setPassword(text)}
    value={password}
    underlineColorAndroid="transparent"
    autoCapitalize="none"
    textContentType="newPassword"
    autoComplete='new-password'
    enablesReturnKeyAutomatically={true}
    returnKeyType='next'
/>
<TextInput
    style={styles.input}
    placeholderTextColor='rgba(60, 60, 67, 0.30)'
    secureTextEntry
    placeholder={t('Registration.againpasswordplaceholder')}
    onChangeText={(text) => setConfirmPassword(text)}
    value={confirmPassword}
    underlineColorAndroid="transparent"
    autoCapitalize="none"
    textContentType="newPassword"
    autoComplete='new-password'
    enablesReturnKeyAutomatically={true}
/>

通过上面的代码,我希望 iOS 17 在用户填写这些字段时建议使用强密码,但它没有发生。我在这里错过了什么吗?我需要申请密码建议才能在这种情况下使用特定的配置或设置吗?

任何帮助或见解将不胜感激!谢谢。

ios react-native passwords textinput
1个回答
0
投票

iOS 使用启发式建议自动填充。并且它需要有特定顺序的特定输入。我想说你需要在输入上方添加不可见的 textInput 和用户名。

我没有在文档中看到这些规则,但在媒体上找到了一些。 我现在可以提供至少两个可用的来源:

https://medium.com/@wanxiao1994/experience-in-adapting-ios-password-autofill-8ba8f5c544de https://medium.com/mobilepeople/ios-password-autofill-how-and-why-b8414e6ada96

© www.soinside.com 2019 - 2024. All rights reserved.