mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
defaultValue of 0 now displayed
previously treated as empty string when passed to input text/textarea
This commit is contained in:
@@ -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 : ''
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user