defaultValue of 0 now displayed
previously treated as empty string when passed to input text/textarea
Cheng Lou committed
Aug 9, 2013 at 22:44 UTC
1b747c526c501bc167a02f4dd7cfc8cee34f870f
2 files changed
+4
-2
src/dom/components/ReactDOMInput.js
+1
-1
@@ -48,7 +48,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
48
getInitialState: function() {
49
return {
50
checked: this.props.defaultChecked || false,
51
- value: this.props.defaultValue || ''
51
+ value: this.props.defaultValue != null ? this.props.defaultValue : ''
52
};
53
},
54
src/dom/components/ReactDOMTextarea.js
+3
-1
@@ -77,7 +77,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
77
);
78
defaultValue = '' + children;
79
}
80
- defaultValue = defaultValue || '';
80
+ if (defaultValue == null) {
81
+ defaultValue = '';
82
+ }
83
return {
84
// We save the initial value so that `ReactNativeComponent` doesn't update
85
// `textContent` (unnecessary since we update value).