_getText defaults to blank string when no default value set

Summary:
One of the potential fixes that grabbou suggested was to make _getText return an empty string in the worst case of null value and null defaultValue.
Closes https://github.com/facebook/react-native/pull/9553

Differential Revision: D3800913

fbshipit-source-id: 30d9c0a7384d39477a71947714eec3340ba5380f
This commit is contained in:
m3vaz 2016-08-31 15:58:51 -07:00 committed by Facebook Github Bot 1
parent c0de1a7011
commit 61832b4323
1 changed files with 5 additions and 1 deletions

View File

@ -575,7 +575,11 @@ const TextInput = React.createClass({
_getText: function(): ?string {
return typeof this.props.value === 'string' ?
this.props.value :
this.props.defaultValue;
(
typeof this.props.defaultValue === 'string' ?
this.props.defaultValue :
''
);
},
_setNativeRef: function(ref: any) {