defaultValue of 0 now displayed

previously treated as empty string when passed to input text/textarea
This commit is contained in:
Cheng Lou
2013-08-09 22:44:42 -04:00
parent 5cbabdf4c9
commit 1b747c526c
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
getInitialState: function() {
return {
checked: this.props.defaultChecked || false,
value: this.props.defaultValue || ''
value: this.props.defaultValue != null ? this.props.defaultValue : ''
};
},
+3 -1
View File
@@ -77,7 +77,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
);
defaultValue = '' + children;
}
defaultValue = defaultValue || '';
if (defaultValue == null) {
defaultValue = '';
}
return {
// We save the initial value so that `ReactNativeComponent` doesn't update
// `textContent` (unnecessary since we update value).