From b5106a8fca4516bc6247492c29217a3d2f5df2bd Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Fri, 1 Apr 2016 07:15:49 -0700 Subject: [PATCH] Implement TextInput.selectTextOnFocus for Android Summary:Uses native Android `TextView.setSelectAllOnFocus` method. Triggers TextInput's `onSelectionChanged` event on focus as expected. Closes https://github.com/facebook/react-native/pull/6654 Differential Revision: D3126354 Pulled By: mkonicek fb-gh-sync-id: faa64314c0ddc87296277ccd707f18effef8f407 fbshipit-source-id: faa64314c0ddc87296277ccd707f18effef8f407 --- 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 5da75257b..366bbce6b 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 62b766b0d..e1c51b7d1 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 class ReactTextInputManager extends BaseViewManager