@@ -7,6 +7,20 @@ import isIterable from './isIterable';
77import parseStyleName from './parseStyleName' ;
88import generateAppendClassName from './generateAppendClassName' ;
99
10+ const mapChildrenWithoutKeyPrefix = ( children : ReactElement , mapper : Function , context : Object ) => {
11+ if ( typeof children === 'undefined' || children === null ) {
12+ return children ;
13+ }
14+
15+ const result = [ ] ;
16+
17+ React . Children . forEach ( children , ( child , index ) => {
18+ result . push ( mapper . call ( context , child , index ) ) ;
19+ } ) ;
20+
21+ return result ;
22+ } ;
23+
1024const linkElement = ( element : ReactElement , styles : Object , configuration : Object ) : ReactElement => {
1125 let appendClassName ;
1226 let elementIsFrozen ;
@@ -27,7 +41,7 @@ const linkElement = (element: ReactElement, styles: Object, configuration: Objec
2741 if ( React . isValidElement ( elementShallowCopy . props . children ) ) {
2842 elementShallowCopy . props . children = linkElement ( React . Children . only ( elementShallowCopy . props . children ) , styles , configuration ) ;
2943 } else if ( _ . isArray ( elementShallowCopy . props . children ) || isIterable ( elementShallowCopy . props . children ) ) {
30- elementShallowCopy . props . children = React . Children . map ( elementShallowCopy . props . children , ( node ) => {
44+ elementShallowCopy . props . children = mapChildrenWithoutKeyPrefix ( elementShallowCopy . props . children , ( node ) => {
3145 if ( React . isValidElement ( node ) ) {
3246 return linkElement ( node , styles , configuration ) ;
3347 } else {
0 commit comments