Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: We have password components which allow visibility to be toggled by setting both the keyboardType and secureTextEntry props. The order in which those updates are executed is determined by iterating a NativeMap of props, and the iteration order of a NativeMap is implementation dependent. With libc++ as our STL, we observe that setSecureTextEntry is called before setKeyboardType. This results in the following sequence of input type flag settings when toggling the component to visible and then back to hidden: * The field starts out with TYPE_TEXT_VARIATION_PASSWORD (0x80). * When we toggle to visible, setSecureTextEntry is called with password being false, which clears TYPE_TEXT_VARIATION_PASSWORD. setKeyboardType is then called with the visible-password keyboard type, which sets TYPE_TEXT_VARIATION_VISIBLE_PASSWORD (0x90). * When we toggle back to hidden, setSecureTextEntry is called with password being true, which sets TYPE_TEXT_VARIATION_PASSWORD but doesn't clear TYPE_TEXT_VARIATION_VISIBLE_PASSWORD. setKeyboardType is then called with the default keyboard type and additionally sets TYPE_CLASS_TEXT, but TYPE_TEXT_VARIATION_VISIBLE_PASSWORD remains and the password field remains visible. The fix is to clear TYPE_TEXT_VARIATION_VISIBLE_PASSWORD when setSecureTextEntry is called with password being true, to ensure the password gets hidden. Changelog: [Android][Fixed] - Fix secure text entry setting to always hide text Reviewed By: shergin Differential Revision: D23399174 fbshipit-source-id: a81deec702e768672e2103b76ab50ec728dac229
- Loading branch information