diff --git a/components/input/index.jsx b/components/input/index.jsx
index b4ed4d4eedf5734bfaaa84f86890693eb88ededa..44b05fb048d8525ac36acae804c92baf6c3121bc 100644
--- a/components/input/index.jsx
+++ b/components/input/index.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import assign from 'object-assign';
function prefixClsFn(prefixCls, ...args) {
return args.map((s)=> {
@@ -14,6 +15,13 @@ function ieGT9() {
return documentMode > 9;
}
+function fixControlledValue(value) {
+ if (typeof value === 'undefined' || value === null) {
+ return '';
+ }
+ return value;
+}
+
class Group extends React.Component {
render() {
const className = 'ant-input-group ' + (this.props.className || '');
@@ -57,7 +65,7 @@ class Input extends React.Component {
}
renderInput() {
- const props = this.props;
+ const props = assign({}, this.props);
const prefixCls = props.prefixCls;
let inputClassName = prefixClsFn(prefixCls, 'input');
if (!props.type) {
@@ -73,9 +81,12 @@ class Input extends React.Component {
if(placeholder && ieGT9()){
placeholder = null;
}
+ if ('value' in props) {
+ props.value = fixControlledValue(props.value);
+ }
switch (props.type) {
case 'textarea':
- return ;
+ return ;
default:
inputClassName = props.className ? props.className : inputClassName;
return ;