android - 激活 google 密码管理器提示 @ React-Native app
问题描述
我正在使用 React-Native 0.63.4 为 android 开发一个新应用程序,我希望谷歌服务提示使用谷歌密码管理器存储用户凭据。我正在使用 Formik 来管理我的表单操作。
这是代码:
<View style={styles.formContainer}>
<Input
onChangeText={handleChange('email')}
onBlur={(e) => {
handleBlur('email')(e);
}}
placeholder={emailPlaceholder}
autoCompleteType="email"
autoCapitalize="none"
keyboardType="email-address"
textContentType="emailAddress"
value={values.email}
isError={Boolean(errors.email && touched.email)}
errorMessage={errors.email}
/>
<PasswordInput
placeholder={passwordPlaceholder}
notFocusedText={continueToResetPassword}
textContentType="password"
onChangeText={handleChange('password')}
onBlur={(e) => {
handleBlur('password')(e);
}}
value={values.password}
isError={Boolean(errors.password && touched.password)}
errorMessage={errors.password}
notFocusedTextOnPress={() =>
navigation.navigate('EnterEmail', {
email: values.email,
})
}
/>
<Button text={isSubmitting ? '' : button} onPress={handleSubmit}>
{isSubmitting ? <ActivityIndicator color="black" /> : null}
</Button>
</View>
两者都<Input />
继承<PasswordInput />
自 React-Native 的<TextInput />
元素,并将 {...props} 作为“>”之前的最后一行转发。
设置了 textContentType 和 autoCompleteType 的道具,但我仍然没有提示存储凭据,我错过了什么?
ps 其他本机应用程序在成功登录后肯定会提示,与在大多数 Web 浏览器中实现的方式相同。问题是它是如何在 react-native 中实现的?
解决方案
从您的代码中,您尚未添加autoCompleteType
到<PasswordInput/>
.
尝试添加autoCompleteType="password"
到您的<PasswordInput/>
.
推荐阅读
- python - 如何在 python apache Beam 中展平多个 Pcollections
- android - 无法从 EXIF 获取图像方向
- java - Thorntail JMS 到远程 ActiveMQ 服务器?
- spring-boot - 如何在 Spring Boot 中使用多个数据库修复“ORA-00942:表或视图不存在”?
- sqlite - 优化图像哈希搜索查询
- css - 如何防止 flex-box 中的图像每次根据它们的大小相互移动?
- javascript - 隐藏“下拉”选择
- canvas - P5 画布宽度或高度偏移
- swift - 当用户按下“添加”按钮时,如何向我的 UITableView 添加下拉选择?
- ios - 在 Firebase 中存储下载的 Gif