Skip to content

Commit 4b5341f

Browse files
feegoismaelga
authored andcommitted
sectionWrapper and fieldWrapper props can now receive React Elements.
1 parent 61d4fd0 commit 4b5341f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/fields/utils/wrapped.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,18 @@ var propsForWrapper = function(props, section) {
114114
};
115115

116116
exports.section = function(props, fields) {
117+
if (React.isValidElement(props.sectionWrapper)) {
118+
return React.cloneElement(props.sectionWrapper, propsForWrapper(props, true), fields);
119+
}
117120
return React.createElement(props.sectionWrapper || SectionWrapper,
118121
propsForWrapper(props, true),
119122
fields);
120123
};
121124

122125
exports.field = function(props, field) {
126+
if (React.isValidElement(props.fieldWrapper)) {
127+
return React.cloneElement(props.fieldWrapper, propsForWrapper(props), field);
128+
}
123129
return React.createElement(props.fieldWrapper || FieldWrapper,
124130
propsForWrapper(props),
125131
field);

0 commit comments

Comments
 (0)