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:
parent
41b0160b60
commit
b5106a8fca
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue