Guard against empy _inputRef in TextInput

Reviewed By: cpojer

Differential Revision: D4420532

fbshipit-source-id: 6912c11b5a6f5d8efaa07dc7a09a9bc1cda0658a
This commit is contained in:
Alex Kotliarskyi 2017-01-20 16:41:22 -08:00 коммит произвёл Facebook Github Bot
Родитель 5e9db574ee
Коммит 5a09b2861a
1 изменённых файлов: 6 добавлений и 4 удалений

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

@ -771,9 +771,11 @@ const TextInput = React.createClass({
_onChange: function(event: Event) {
// Make sure to fire the mostRecentEventCount first so it is already set on
// native when the text value is set.
if (this._inputRef) {
this._inputRef.setNativeProps({
mostRecentEventCount: event.nativeEvent.eventCount,
});
}
var text = event.nativeEvent.text;
this.props.onChange && this.props.onChange(event);
@ -824,7 +826,7 @@ const TextInput = React.createClass({
nativeProps.selection = this.props.selection;
}
if (Object.keys(nativeProps).length > 0) {
if (Object.keys(nativeProps).length > 0 && this._inputRef) {
this._inputRef.setNativeProps(nativeProps);
}