Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofill not disable. textContentType='none' not work #22407

Closed
3 tasks done
fonov opened this issue Nov 25, 2018 · 15 comments
Closed
3 tasks done

Autofill not disable. textContentType='none' not work #22407

fonov opened this issue Nov 25, 2018 · 15 comments
Labels

Comments

@fonov
Copy link

fonov commented Nov 25, 2018

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 315.84 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.10.0 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 27, 28
        Build Tools: 27.0.3, 28.0.2, 28.0.3
        System Images: android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5014246
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.1 => 16.6.1 
      react-native: ^0.57.5 => 0.57.5 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

I use autofill for login form. For registration form i disable autofill.

 textContentType='none'

but autofill is work and show hint

Reproducible Demo

  1. setting associated domains
  2. make credentials
  3. test autofill

My full code

            <TextInput
              textContentType='none'
              style={{ flex: 1, height: '100%' }}
              ref={(v) => {
                this.regEmailInput = v;
              }}
              value={email}keyboardType="email-address"
              placeholderTextColor="#bbb"
              autoCapitalize="none"
              placeholder={t('Email')}
              underlineColorAndroid="transparent"
              onChangeText={this.handleEmail}
            />
            <TextInput
              secureTextEntry
              textContentType='none'
              style={{ flex: 1, height: '100%' }}
              ref={(v) => {
                this.regPasswordInput = v;
              }}
              placeholderTextColor="#bbb"
              autoCapitalize="none"
              placeholder={t('At least 8 symbols')}
              underlineColorAndroid="transparent"
              onChangeText={this.handlePassword}
            />
@bartolkaruza
Copy link

Does this also happen if you don't load the login flow at all and show sign up as the only screen? It looks to me like the autofill from the previous field may still be shown.

@fonov
Copy link
Author

fonov commented Nov 28, 2018

I not testing sing up screen as the only screen.
And also i make another test, i remove textContentType props from but autofill still work i think this is bug

@bartolkaruza
Copy link

bartolkaruza commented Dec 9, 2018

All RN does is pass that property to the native view:

self.backedTextInputView.textContentType = [type isEqualToString:@"none"] ? @"" : type;

I know there was some issues with textContentType not working as expected on various iOS versions; https://stackoverflow.com/questions/39633117/how-can-i-get-uitextfields-textcontenttype-property-to-do-anything. What version of iOS are you trying this on?

Also, I think we should probably map to the constants in RN code instead of directly passing the string:
https://developer.apple.com/documentation/uikit/uitextcontenttype?language=objc

The underlying string value could change from one version of iOS to another.

@fonov
Copy link
Author

fonov commented Dec 9, 2018

I test on latest IOS 12.1

@bartolkaruza
Copy link

@cbrevik do you know if the described behavior deviates from how it used to work or how it is intended to work? I'm unsure about the details of textContentType on iOS. There is a minimal repro here: https://snack.expo.io/@bartolkaruza/rn_22407

@cbrevik
Copy link
Contributor

cbrevik commented Dec 12, 2018

Used to work on iOS 11 for me, but I don't use that functionality any more so not sure how it is now. In your repro the autofill-button never shows up on my device at least.

But I see there has been some work in #22579. It has later been reverted, but looks like they are on it?

@bartolkaruza
Copy link

@levibuzolic @shergin is #22579 related to this issue?

@Jlexyc
Copy link

Jlexyc commented Jan 4, 2019

Trying to fix problem. I have 2 username and 2 password fields on the screen. I don't know why but it prefills corrent field but changes focus to the wrong one (to the field that is not in visible zone currently).
There no ability to disable autofill and as I see this issue related to general iOS 12 problem: https://stackoverflow.com/questions/45452170/ios-11-disable-password-autofill-accessory-view-option

Keep working to find workaround

@levibuzolic
Copy link
Contributor

levibuzolic commented Jan 7, 2019

#22611 (updated PR for #22579) could be somewhat related however if it's not working currently then I don't think it'll fix it.

textContentType is only a semantic hint to the OS, so providing a nil value will likely just make the OS use its own logic for determining an autofill option.

I'll try and test it out soon and see if I can find a value/combination that will disable the auto fill properly.

@levibuzolic
Copy link
Contributor

@fonov interesting that it's prompting for password in your email field -- the OS must be seeing "password" as a text label on the screen and inferring that the current field might be a password field.

Have you tried adding autoCorrect={false} to your TextInput? Testing in this Snack, it appears to work however obviously this Expo app doesn't have an associated domain so doesn't behave the same as your app.

@rickhanlonii
Copy link
Member

Bumping for more information, from the thread it sounds like we don't know how to repro

@cpojer
Copy link
Contributor

cpojer commented Mar 26, 2019

Closing as we don't have a repro for this, even after requesting it. Happy to reopen if you find a way to repro.

@sturmenta
Copy link

#21911 (comment) what about this?

@shamilovtim
Copy link
Contributor

This is still an issue

@mechazod
Copy link

@shamilovtim Same experience with iOS 13 update.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 26, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests