From 380deaf54ceb218603e4e8fa887872278b5fa3db Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 10 Mar 2016 09:35:09 +0800 Subject: [PATCH] fix: Row's children could be null --- components/layout/row.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/layout/row.jsx b/components/layout/row.jsx index 46386d2132..1c8b86f905 100644 --- a/components/layout/row.jsx +++ b/components/layout/row.jsx @@ -29,15 +29,17 @@ const Row = React.createClass({ marginRight: gutter / -2, ...style, } : style; - const cols = Children.map(children, col => - cloneElement(col, { + const cols = Children.map(children, col => { + if (col === null) return null; + + return cloneElement(col, { style: gutter > 0 ? { paddingLeft: gutter / 2, paddingRight: gutter / 2, ...col.props.style } : col.props.style, - }) - ); + }); + }); return
{cols}
; }, });