Skip to content
Permalink
Browse files

Remove support for password property and only use secureTextEntry

Summary:
Reduce the public surface area of TextInput.  It only exposes a secureTextEntry property, but on Android was also accepting password as a prop.
This removes that.

Reviewed By: javache

Differential Revision: D3392223

fbshipit-source-id: 67c36fbe16fe493e2841d5d9deb78e3be2209ebd
  • Loading branch information
Dave Miller Facebook Github Bot 8
Dave Miller authored and Facebook Github Bot 8 committed Jun 6, 2016
1 parent 61046c3 commit f3507f99f18f8a26d67289fbad4d52e1f15a294c
@@ -557,9 +557,9 @@ var TextInput = React.createClass({
onSubmitEditing={this.props.onSubmitEditing}
blurOnSubmit={this.props.blurOnSubmit}
onLayout={this.props.onLayout}
password={this.props.password || this.props.secureTextEntry}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
secureTextEntry={this.props.secureTextEntry}
selectionColor={this.props.selectionColor}
text={this._getText()}
underlineColorAndroid={this.props.underlineColorAndroid}
@@ -90,7 +90,7 @@ var TextInputTestApp = React.createClass({
autoFocus={true}
keyboardType='numeric'
multiline={true}
password={true}
secureTextEntry={true}
defaultValue="This is text"
testID="textInput1"
/>
@@ -101,7 +101,7 @@ var TextInputTestApp = React.createClass({
autoFocus={false}
keyboardType='default'
multiline={false}
password={false}
secureTextEntry={false}
placeholder='1234'
testID="textInput2"
/>
@@ -394,8 +394,8 @@ public void setMultiline(ReactEditText view, boolean multiline) {
multiline ? InputType.TYPE_TEXT_FLAG_MULTI_LINE : 0);
}

@ReactProp(name = "password", defaultBoolean = false)
public void setPassword(ReactEditText view, boolean password) {
@ReactProp(name = "secureTextEntry", defaultBoolean = false)
public void setSecureTextEntry(ReactEditText view, boolean password) {
updateStagedInputTypeFlag(
view,
password ? 0 :
@@ -242,13 +242,13 @@ public void testPasswordInput() {
mManager.updateProperties(view, buildStyles());
assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();

mManager.updateProperties(view, buildStyles("password", false));
mManager.updateProperties(view, buildStyles("secureTextEntry", false));
assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();

mManager.updateProperties(view, buildStyles("password", true));
mManager.updateProperties(view, buildStyles("secureTextEntry", true));
assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isNotZero();

mManager.updateProperties(view, buildStyles("password", null));
mManager.updateProperties(view, buildStyles("secureTextEntry", null));
assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();
}

0 comments on commit f3507f9

Please sign in to comment.
You can’t perform that action at this time.