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 {
7171 const { onUpdate, layout, updateContainer} = this . context ;
7272
7373 if ( visible ) {
74- let children = this . props . children ;
74+ const children = this . props . children ;
7575 let action = null ;
7676 let onAction = ( ) => { } ;
7777
@@ -87,18 +87,12 @@ export default class Panel extends Component {
8787 children . type . prototype . addAnnotation ( layout , updateContainer ) ;
8888 }
8989
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+ } ) ;
10296
10397 return (
10498 < div className = { bem ( 'panel' ) } >
@@ -109,7 +103,7 @@ export default class Panel extends Component {
109103 hasOpen = { hasOpen }
110104 onAction = { onAction }
111105 />
112- { children }
106+ { newChildren }
113107 </ div >
114108 ) ;
115109 }
You can’t perform that action at this time.
0 commit comments