From ec3d94d12eb66c6a88279e060daa95ff7de72b3d Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Fri, 25 Mar 2016 13:27:20 +0200 Subject: [PATCH] Implement TextInput.selectTextOnFocus for Android --- Libraries/Components/TextInput/TextInput.js | 2 +- .../react/views/textinput/ReactTextInputManager.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 5da75257bce1..366bbce6bf6d 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -284,7 +284,6 @@ var TextInput = React.createClass({ clearTextOnFocus: PropTypes.bool, /** * If true, all text will automatically be selected on focus - * @platform ios */ selectTextOnFocus: PropTypes.bool, /** @@ -524,6 +523,7 @@ var TextInput = React.createClass({ underlineColorAndroid={this.props.underlineColorAndroid} children={children} editable={this.props.editable} + selectTextOnFocus={this.props.selectTextOnFocus} />; 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 62b766b0d8fb..e1c51b7d1f60 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,11 @@ public void setSelectionColor(ReactEditText view, @Nullable Integer color) { } } + @ReactProp(name = "selectTextOnFocus", defaultBoolean = false) + public void setSelectTextOnFocus(ReactEditText view, boolean selectTextOnFocus) { + view.setSelectAllOnFocus(selectTextOnFocus); + } + @ReactProp(name = ViewProps.COLOR, customType = "Color") public void setColor(ReactEditText view, @Nullable Integer color) { if (color == null) {