From c2233ef7e6cb24d673d494a37085c67ddb79c944 Mon Sep 17 00:00:00 2001 From: joranz Date: Wed, 3 Feb 2016 00:21:30 -0800 Subject: [PATCH] Add iOS tintColor prop to TextInput Summary: In response to https://github.com/facebook/react-native/issues/5595 Adds tintColor property to TextInput component for iOS: screen shot 2016-01-28 at 1 39 35 pm Usage: screen shot 2016-01-28 at 1 42 37 pm Closes https://github.com/facebook/react-native/pull/5678 Reviewed By: svcscm Differential Revision: D2895115 Pulled By: nicklockwood fb-gh-sync-id: bfb52b992d5e02754fe47f409f6e8df426514718 --- Examples/UIExplorer/TextInputExample.ios.js | 19 +++++++++++++++++++ Libraries/Components/TextInput/TextInput.js | 5 +++++ Libraries/Text/RCTTextFieldManager.m | 1 + Libraries/Text/RCTTextViewManager.m | 1 + 4 files changed, 26 insertions(+) diff --git a/Examples/UIExplorer/TextInputExample.ios.js b/Examples/UIExplorer/TextInputExample.ios.js index 49079ff8b..905328f60 100644 --- a/Examples/UIExplorer/TextInputExample.ios.js +++ b/Examples/UIExplorer/TextInputExample.ios.js @@ -536,6 +536,25 @@ exports.examples = [ ); } }, + { + title: 'Colored highlight/cursor for text input', + render: function() { + return ( + + + + + ); + } + }, { title: 'Clear button mode', render: function () { diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 1f1aebf8b..128f7aaa8 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -226,6 +226,11 @@ var TextInput = React.createClass({ * The text color of the placeholder string */ placeholderTextColor: PropTypes.string, + /** + * The highlight and cursor color of the text input + * @platform ios + */ + tintColor: PropTypes.string, /** * If true, the text input obscures the text entered so that sensitive text * like passwords stay secure. The default value is false. diff --git a/Libraries/Text/RCTTextFieldManager.m b/Libraries/Text/RCTTextFieldManager.m index f2ccf07f4..b2dd5d77c 100644 --- a/Libraries/Text/RCTTextFieldManager.m +++ b/Libraries/Text/RCTTextFieldManager.m @@ -78,6 +78,7 @@ RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL) RCT_REMAP_VIEW_PROPERTY(editable, enabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString) RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, UIColor) +RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(text, NSString) RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber) RCT_EXPORT_VIEW_PROPERTY(clearButtonMode, UITextFieldViewMode) diff --git a/Libraries/Text/RCTTextViewManager.m b/Libraries/Text/RCTTextViewManager.m index f32369c4a..8c0247d13 100644 --- a/Libraries/Text/RCTTextViewManager.m +++ b/Libraries/Text/RCTTextViewManager.m @@ -28,6 +28,7 @@ RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL) RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL) RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL) RCT_REMAP_VIEW_PROPERTY(color, textView.textColor, UIColor) +RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) RCT_REMAP_VIEW_PROPERTY(editable, textView.editable, BOOL) RCT_REMAP_VIEW_PROPERTY(enablesReturnKeyAutomatically, textView.enablesReturnKeyAutomatically, BOOL) RCT_REMAP_VIEW_PROPERTY(keyboardType, textView.keyboardType, UIKeyboardType)