react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Warning: Failed prop type: Invalid prop `autoComplete` of value `password-new`

Open TheWirv opened this issue 4 years ago • 8 comments

Description

I am getting this warning when supplying the value 'password-new' to TextInput's autoComplete prop, although this is supported, as per the latest docs. This is the full warning:

Warning: Failed prop type: Invalid prop `autoComplete` of value `password-new` supplied to `ForwardRef(TextInput)`, expected one of 
["cc-csc","cc-exp","cc-exp-month","cc-exp-year","cc-number","email","name","password","postal-code","street-address","tel","username","off"].
[...Stack trace]

I am guessing this is because of the type discrepancies between the JS and native component files.

Version

0.66.2

Output of react-native info

System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 13.70 GB / 31.68 GB
  Binaries:
    Node: 16.12.0 - ~\AppData\Local\Temp\yarn--1636384436565-0.4897942578758505\node.CMD 
    Yarn: 1.22.15 - ~\AppData\Local\Temp\yarn--1636384436565-0.4897942578758505\yarn.CMD 
    npm: 8.1.1 - C:\Program Files\nodejs\npm.CMD
    Watchman: 20210110.135312.0 - C:\Users\mlasaj\AppData\Local\Watchman\bin\watchman.EXE
  SDKs:
    Android SDK:
      API Levels: 30
      Build Tools: 30.0.2, 30.0.3, 32.0.0
      System Images: android-30 | Google APIs Intel x86 Atom_64
      Android NDK: Not Found
    Windows SDK:
      AllowAllTrustedApps: Disabled
      Versions: 10.0.14393.0, 10.0.19041.0
  IDEs:
    Android Studio: Version     2020.3.0.0 AI-203.7717.56.2031.7784292
    Visual Studio: 16.11.31624.102 (Visual Studio Enterprise 2019)
  Languages:
    Java: 13.0.2
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Install RN v0.66.2 on Android
  2. Create TextInput component
  3. Add autoComplete prop with value 'password-new'

Snack, code example, screenshot, or link to a repository

Screenshot_1636384608

TheWirv avatar Nov 08 '21 15:11 TheWirv

My assumption that the culprit was the difference between TextInput and AndroidTextInputNativeComponent was wrong. It was actually DeprecatedTextInputPropTypes, and I fixed it and created a PR #32575 for it.

TheWirv avatar Nov 10 '21 18:11 TheWirv

@TheWirv I still see this error with 'sms-otp' value in 0.67.1 🤔

ghost avatar Jan 24 '22 12:01 ghost

@TheWirv I still see this error with 'sms-otp' value in 0.67.1 🤔

The warning seems to be fixed with 0.68 with https://github.com/facebook/react-native/commit/9eb0881c8fecd0e974b1cb9f479bad3075854340

With that said, is anyone able to get the sms-opt prop to work? I am unable to have it populate the text field with a SMS with the app hash on the sim

itsjaychang avatar Mar 25 '22 17:03 itsjaychang

@itsjaychang Yeah we got it working. Make sure you set importantForAutofill to true :) and double check the spelling it is otp not opt - just in case you never now

ghost avatar Mar 28 '22 07:03 ghost

@itsjaychang Yeah we got it working. Make sure you set importantForAutofill to true :) and double check the spelling it is otp not opt - just in case you never now

Hello, How to use it ? i create new RN project with 0.68 version. and i dont how to try this sms-otp ? i open emulator and try sms similator ?

canerd7u avatar Apr 05 '22 11:04 canerd7u

@canerd7u

To test it out on simulator make sure you are signed in with your google account in simulator, then navigate to settings / privacy settings and there you should see autofill, make sure it is enabled... Another way should be to install some other 3rd party service on your phone which will manage autofill stuff and to test it out with that...

ghost avatar Apr 05 '22 12:04 ghost

@itsjaychang Yeah we got it working. Make sure you set importantForAutofill to true :) and double check the spelling it is otp not opt - just in case you never now

than you very much but actually it is not set to true but :

importantForAutofill="yes"

dusan-ygii avatar Oct 19 '22 12:10 dusan-ygii

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 02 '24 05:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 10 '24 05:04 github-actions[bot]