@@ -7,6 +7,20 @@ import isIterable from './isIterable';
7
7
import parseStyleName from './parseStyleName' ;
8
8
import generateAppendClassName from './generateAppendClassName' ;
9
9
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
+
10
24
const linkElement = ( element : ReactElement , styles : Object , configuration : Object ) : ReactElement => {
11
25
let appendClassName ;
12
26
let elementIsFrozen ;
@@ -27,7 +41,7 @@ const linkElement = (element: ReactElement, styles: Object, configuration: Objec
27
41
if ( React . isValidElement ( elementShallowCopy . props . children ) ) {
28
42
elementShallowCopy . props . children = linkElement ( React . Children . only ( elementShallowCopy . props . children ) , styles , configuration ) ;
29
43
} 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 ) => {
31
45
if ( React . isValidElement ( node ) ) {
32
46
return linkElement ( node , styles , configuration ) ;
33
47
} else {
0 commit comments