fix child null bug in FormItem

This commit is contained in:
afc163 2016-03-01 17:52:07 +08:00
parent 7ce38e39b6
commit ca2fca024a

View File

@ -131,10 +131,9 @@ class FormItem extends React.Component {
renderChildren() {
const props = this.props;
const children = React.Children.map(props.children, (child) => {
if (typeof child.type === 'function' && !child.props.size) {
if (child && typeof child.type === 'function' && !child.props.size) {
return React.cloneElement(child, { size: 'large' });
}
return child;
});
return [