TextInput should call blur and focus methods of selectionState

DocumentSelectionState returns anchor and focus offsets only in focused state. So TextInput should set proper state to selectionState when blur and focus.
This commit is contained in:
Aleksei Androsov 2016-01-16 14:49:40 +03:00
parent 5ac848cd7f
commit 5ea4d397a9
1 changed files with 8 additions and 0 deletions

View File

@ -549,6 +549,10 @@ var TextInput = React.createClass({
if (this.props.onFocus) { if (this.props.onFocus) {
this.props.onFocus(event); this.props.onFocus(event);
} }
if (this.props.selectionState) {
this.props.selectionState.focus();
}
}, },
_onPress: function(event: Event) { _onPress: function(event: Event) {
@ -589,6 +593,10 @@ var TextInput = React.createClass({
if (this.props.onBlur) { if (this.props.onBlur) {
this.props.onBlur(event); this.props.onBlur(event);
} }
if (this.props.selectionState) {
this.props.selectionState.blur();
}
}, },
_onTextInput: function(event: Event) { _onTextInput: function(event: Event) {