2

Based on the docs, if we set textContentType to username and password, the keyboard should have an option to autofill. But somehow It is not working for me.

              <TextInput
                textContentType='username'
                style={{ width: 300, height: 50, borderWidth: 1 }}
                value={this.state.currentEmail}
                onChangeText={this.handleChangeTextEmail}
              />
              <TextInput
                textContentType='password'
                value={this.state.currentPassword}
                textContentType="password"
                style={{ width: 300, height: 50, borderWidth: 1, marginTop: 10 }}
                onChangeText={this.handleChangeTextPassword}
                secureTextEntry
              />

Is there anyone facing the same problem or is there anyway to fix this?
EDIT:
I'm using Iphone X (real device) Iphone 11(Simulator) both ios version is 11+
5
  • what kind of device and OS version (iOS/Android) and RN do you use? Commented Oct 6, 2021 at 8:00
  • According to the docs, you need to add autoComplete={true} for Android. For IOS, it should suffice to only add the textContentType. Commented Oct 6, 2021 at 8:08
  • @kosiakMD I'm using RN 0.63 and the device I edited the post Commented Oct 6, 2021 at 8:44
  • does that feature work with others Apps? m.b it's turned off? will update my asnwer iCloud Keychain is used: Settings → Apple ID → iCloud → Keychain → toggle "On" the iCloud Keychain. Commented Oct 7, 2021 at 9:08
  • its already toggle on, and i just init new react native project and try the text input but does not work Commented Oct 7, 2021 at 9:31

2 Answers 2

1
  1. What kind of device faces this issue?
  2. what kind of OS iOS/Android version?
  3. I think to propose autofill form the password chain it should contain password and username instead of emailAddress

https://reactnative.dev/docs/next/textinput#textcontenttype-ios

For iOS 11+ you can set textContentType to username or password to enable autofill of login details from the device keychain.

if v11+

<TextInput
    value={this.state.username}
    textContentType="username"
/>
<TextInput
    value={this.state.password}
    secureTextEntry={true}
    textContentType="password"
/>

if v12+

<TextInput
    value={this.state.username}
    textContentType="username"
/>
<TextInput
    value={this.state.password}
    secureTextEntry={true}
    textContentType={"password" | "newPassword"} // newPassword if suggest & save into cahins
/>

UPD: 07.10.2021

  1. ensure that Keychain autofill is turned ON

iCloud Keychain is used: Settings → Apple ID → iCloud → Keychain → toggle "On" the iCloud Keychain.

as here https://reactnative.dev/docs/next/textinput#passwordrules-ios

Sign up to request clarification or add additional context in comments.

1 Comment

Hello @kosiak, thanks for answering. But I've try username and password before switch to content address but not work. The device version I've just updated in the post
0

Fixed it by following the way

  1. Add autocorrect true in the email field and give the margin for iOS
  2. Add extra dummy text input between email and password for only the iOS platform with the wrapping of parent View pointer none for avoiding focus

final code

  <TextInput
        autoCompleteType="email"
        autoCorrect={true}
        clearTextOnFocus={false}
        containerStyle={{marginTop: 5, marginBottom: isIos() ? -20 : 0}}
        keyboard="email-address"
        textContentType="emailAddress"
        value={username}
        onChangeText={(value): void => onInputChange('username', value)}
      />

      {isIos() ? (
        <View pointerEvents="none">
          <TextInput
            focusable={false}
            style={{color: '#00000000'}}
            onChangeText={(value): void => onInputChange('username', value)}
          />
        </View>
      ) : null}

      <TextInput
        autoCorrect={false}
        clearTextOnFocus={false}
        containerStyle={{marginTop: 5}}
        keyboard={isIos() ? 'ascii-capable' : 'default'}
        secureTextEntry={true}
        value={password}
        onChangeText={(value): void => onInputChange('password', value)}
      />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.