fix(v2): fix build caused when one tab item (#1938)

* fix(v2): fix build caused when one tab item

* Use React method
This commit is contained in:
Alexey Pyltsyn 2019-11-05 04:30:44 +03:00 committed by Yangshun Tay
parent 3e58062b91
commit 3b9309fa87
2 changed files with 7 additions and 2 deletions

View file

@ -2,6 +2,7 @@
## Unreleased ## Unreleased
- **HOTFIX for 2.0.0-alpha.32** - Fix build compilation if exists only one code tab.
- Add table of contents highlighting on scroll. - Add table of contents highlighting on scroll.
## 2.0.0-alpha.32 ## 2.0.0-alpha.32

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import React, {useState} from 'react'; import React, {useState, Children} from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
@ -31,7 +31,11 @@ function Tabs(props) {
))} ))}
</ul> </ul>
<div className="margin-vert--md"> <div className="margin-vert--md">
{[...children].filter(child => child.props.value === selectedValue)[0]} {
Children.toArray(children).filter(
child => child.props.value === selectedValue,
)[0]
}
</div> </div>
</div> </div>
); );