Skip to content

Commit

Permalink
color support for TextInput secureTextEntry={true}
Browse files Browse the repository at this point in the history
Summary:Color property is ignored for TextInput with secureTextEntry={true} on Android.

This is coming  from facebook#6540 and being split into 2 PRs by suggestion of dmmiller.
As he mentioned does almost the same  except it facebook#6064 doesn't handle null case.

Working example:

![scn949wlce](https://cloud.githubusercontent.com/assets/1247834/13929873/b700d650-ef72-11e5-9d67-0a7e0385bc2a.gif)
Closes facebook#6563

Differential Revision: D3077583

Pulled By: mkonicek

fb-gh-sync-id: f0761346b77060abf17f1d4573b375adebc5c607
shipit-source-id: f0761346b77060abf17f1d4573b375adebc5c607
  • Loading branch information
brunobar79 authored and jeffchienzabinet committed Mar 21, 2016
1 parent c588766 commit bf4b26a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Examples/UIExplorer/TextInputExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,19 @@ exports.examples = [
title: 'Passwords',
render: function() {
return (
<TextInput
defaultValue="iloveturtles"
password={true}
style={styles.singleLine}
/>
<View>
<TextInput
defaultValue="iloveturtles"
secureTextEntry={true}
style={styles.singleLine}
/>
<TextInput
secureTextEntry={true}
style={[styles.singleLine, {color: 'red'}]}
placeholder="color is supported too"
placeholderTextColor="red"
/>
</View>
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ public void setSelectionColor(ReactEditText view, @Nullable Integer color) {
}
}

@ReactProp(name = ViewProps.COLOR, customType = "Color")
public void setColor(ReactEditText view, @Nullable Integer color) {
if (color == null) {
view.setTextColor(DefaultStyleValuesUtil.getDefaultTextColor(view.getContext()));
} else {
view.setTextColor(color);
}
}

@ReactProp(name = "underlineColorAndroid", customType = "Color")
public void setUnderlineColor(ReactEditText view, @Nullable Integer underlineColor) {
if (underlineColor == null) {
Expand Down

0 comments on commit bf4b26a

Please sign in to comment.