File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
src/components/containers Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export default class Panel extends Component {
71
71
const { onUpdate, layout, updateContainer} = this . context ;
72
72
73
73
if ( visible ) {
74
- let children = this . props . children ;
74
+ const children = this . props . children ;
75
75
let action = null ;
76
76
let onAction = ( ) => { } ;
77
77
@@ -87,18 +87,12 @@ export default class Panel extends Component {
87
87
children . type . prototype . addAnnotation ( layout , updateContainer ) ;
88
88
}
89
89
90
- if ( Array . isArray ( children ) ) {
91
- children = children . map ( ( child , index ) => {
92
- if ( child . type . displayName . indexOf ( 'Fold' ) >= 0 ) {
93
- return cloneElement ( child , {
94
- ...child . props ,
95
- foldIndex : index ,
96
- key : index ,
97
- } ) ;
98
- }
99
- return child ;
100
- } ) ;
101
- }
90
+ const newChildren = React . Children . map ( children , ( child , index ) => {
91
+ if ( child . type . displayName . indexOf ( 'Fold' ) >= 0 ) {
92
+ return cloneElement ( child , { foldIndex : index , key : index } ) ;
93
+ }
94
+ return child ;
95
+ } ) ;
102
96
103
97
return (
104
98
< div className = { bem ( 'panel' ) } >
@@ -109,7 +103,7 @@ export default class Panel extends Component {
109
103
hasOpen = { hasOpen }
110
104
onAction = { onAction }
111
105
/>
112
- { children }
106
+ { newChildren }
113
107
</ div >
114
108
) ;
115
109
}
You can’t perform that action at this time.
0 commit comments