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
This commit is contained in:
Dmitry Gladkov 2016-04-01 07:15:49 -07:00 коммит произвёл Facebook Github Bot 2
Родитель 41b0160b60
Коммит b5106a8fca
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -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 (

Просмотреть файл

@ -209,6 +209,11 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
}
}
@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) {