Fix app crash caused by TextInput.

Reviewed By: zjj010104

Differential Revision: D2761644

fb-gh-sync-id: 89241de2f8c84d569ec452871f740a0d655cc95e
This commit is contained in:
Hedger Wang 2015-12-15 17:31:07 -08:00 committed by facebook-github-bot-7
parent 4e2a31685c
commit 53d18c83c8
1 changed files with 6 additions and 0 deletions

View File

@ -550,6 +550,12 @@ var TextInput = React.createClass({
this.props.onChange && this.props.onChange(event);
this.props.onChangeText && this.props.onChangeText(text);
if (!this.refs.input) {
// calling `this.props.onChange` or `this.props.onChangeText`
// may clean up the input itself. Exits here.
return;
}
// This is necessary in case native updates the text and JS decides
// that the update should be ignored and we should stick with the value
// that we have in JS.