【发布时间】:2021-01-25 13:13:12
【问题描述】:
我正在使用 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 的属性,但我仍然没有提示存储凭据,我缺少什么?
附言成功登录后肯定会提示其他本机应用程序,与大多数 Web 浏览器中的实现方式相同。问题是它是如何在 react-native 中实现的?
【问题讨论】:
标签: android react-native google-play-services