【问题标题】:Activating google password manager prompt @ React-Native app激活 google 密码管理器提示 @ React-Native app
【发布时间】: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>

&lt;Input /&gt;&lt;PasswordInput /&gt; 都继承自 React-Native 的 &lt;TextInput /&gt; 元素,并将 {...props} 作为 ">" 之前的最后一行转发。

设置了 textContentType 和 autoCompleteType 的属性,但我仍然没有提示存储凭据,我缺少什么?

附言成功登录后肯定会提示其他本机应用程序,与大多数 Web 浏览器中的实现方式相同。问题是它是如何在 react-native 中实现的?

【问题讨论】:

    标签: android react-native google-play-services


    【解决方案1】:

    根据您的代码,您尚未将 autoCompleteType 添加到 &lt;PasswordInput/&gt;
    尝试将autoCompleteType="password" 添加到您的&lt;PasswordInput/&gt;

    【讨论】:

      猜你喜欢
      • 2018-06-19
      • 2022-08-20
      • 1970-01-01
      • 1970-01-01
      • 2019-07-14
      • 2022-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多