From e38f1262534eebc8e4c9b83b9a03e054859d2e85 Mon Sep 17 00:00:00 2001 From: Roger So Date: Thu, 30 Jul 2015 00:08:23 +0800 Subject: [PATCH 1/2] Pass the form and spinner props to Col's children --- src/index.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 3ef2bdc..247705d 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -478,7 +478,12 @@ var Col = React.createClass({ render() { return
- {this.props.children} + {React.Children.map(this.props.children, (child, index) => { + return React.cloneElement(child, { + form: this.props.form + , spinner: this.props.spinner + }) + })}
} }) From 4a975fb1e95c4f6a21ee95b764a5b8f1fac651fe Mon Sep 17 00:00:00 2001 From: Roger So Date: Thu, 30 Jul 2015 16:12:40 +0800 Subject: [PATCH 2/2] Pass the form prop down from Col only if the child is a Row --- src/index.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/index.jsx b/src/index.jsx index 247705d..3970f94 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -479,10 +479,14 @@ var Col = React.createClass({ render() { return
{React.Children.map(this.props.children, (child, index) => { - return React.cloneElement(child, { - form: this.props.form - , spinner: this.props.spinner - }) + if (child.type === Row) { + return React.cloneElement(child, { + form: this.props.form + , spinner: this.props.spinner + }) + } else { + return child + } })}
}