From 2a2ba4bd6b2ea3f8fce978d9439d7208d91a5fe9 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Mon, 21 Mar 2016 13:47:23 -0700 Subject: [PATCH] color support for TextInput secureTextEntry={true} Summary:Color property is ignored for TextInput with secureTextEntry={true} on Android. This is coming from #6540 and being split into 2 PRs by suggestion of dmmiller. As he mentioned does almost the same except it #6064 doesn't handle null case. Working example: ![scn949wlce](https://cloud.githubusercontent.com/assets/1247834/13929873/b700d650-ef72-11e5-9d67-0a7e0385bc2a.gif) Closes https://github.com/facebook/react-native/pull/6563 Differential Revision: D3077583 Pulled By: mkonicek fb-gh-sync-id: f0761346b77060abf17f1d4573b375adebc5c607 shipit-source-id: f0761346b77060abf17f1d4573b375adebc5c607 --- .../UIExplorer/TextInputExample.android.js | 18 +++++++++++++----- .../views/textinput/ReactTextInputManager.java | 9 +++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Examples/UIExplorer/TextInputExample.android.js b/Examples/UIExplorer/TextInputExample.android.js index 1a436a91236d9a..a189f4f9d0b112 100644 --- a/Examples/UIExplorer/TextInputExample.android.js +++ b/Examples/UIExplorer/TextInputExample.android.js @@ -410,11 +410,19 @@ exports.examples = [ title: 'Passwords', render: function() { return ( - + + + + ); } }, diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 8376c2d6bfdb0f..62b766b0d8fba6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -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) {