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

Changing TextInput keyboardType from visible-password does not unset the underlying flags (Android) #17248

Closed
BrandonWilliamsCS opened this issue Dec 17, 2017 · 2 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@BrandonWilliamsCS
Copy link
Contributor

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

Environment:
OS: macOS High Sierra 10.13.2
Node: 9.2.0
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: facebook/react-native#master => 1000.0.0
(react-native built from master branch on 2017-12-17)

Target Platform: Android 8.x
Tested specifically on Nexus 5x, api level 27

Steps to Reproduce

  1. Create a TextInput with secureTextEntry set and a keyboardType of null, undefined, or 'default'
  2. Change the keyboardType to 'visible-password'
  3. Change the keyboardType back to 'default'

Expected Behavior

The field would initially be an obscured password field, then become unobscured, then become obscured again when no longer of type 'visible-password'.
Additionally, the soft keyboard variant stays in "password" mode (e.g., no suggestions) in each case due to secureTextEntry.

Actual Behavior

After set to 'visible-password', the field remains unobscured even after switching to a different type.
However, when not obscured, the soft keyboard falls returns to a plain text keyboard with suggestions instead of numbers on the top row (may vary by device).

Reproducible Demo

I believe this branch should exhibit the bug out-of-the-box (after installing packages and building):
https://github.com/BrandonWilliamsCS/react-native-test-harness/tree/fix/android-textfield-keyboardtype-flags

Once running on an Android device or emulator, tap the field so that the soft keyboard appears and enter text into the field. This will trigger a state change that toggles between 'visible-password' and 'default'.

facebook-github-bot pushed a commit that referenced this issue Jan 12, 2018
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Attempted fix for issue #17248

Added unit tests that cover the affected function and manually repeated the reproduction steps found in the issue.

Note: I had to apply the attached patch file to actually *run* the tests because they were not enabled. I didn't include this in the PR because it seemed like a secondary problem with possible ramifications (see comment near patched line) beyond this issue. For example, other, unrelated tests break when that line is uncommented.
[textInputTestEnable.patch.txt](https://github.com/facebook/react-native/files/1565807/textInputTestEnable.patch.txt)

If I should apply the patch to this PR or re-enable the tests in some other fashion, please let me know and I can do so.

(none)

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[ANDROID] [BUGFIX] [TextInput] - Fix an issue when swapping to and from the `'visible-password'` or `'phone-pad'` keyboard types.
Closes #17249

Differential Revision: D6713008

Pulled By: hramos

fbshipit-source-id: 85eeb5398748d48e59d33eb86d851fd02d587a31
@stale
Copy link

stale bot commented Feb 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 15, 2018
@stale stale bot closed this as completed Feb 22, 2018
@hanspoo
Copy link

hanspoo commented Apr 9, 2018

Same problem here with:

"react": "16.3.0-alpha.1",
"react-native": "0.54.0"

The use of a keyboardType email-address disables secureTextEntry.

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants