Skip to content

Commit

Permalink
fix(Dropdown): Fixed menu hidden failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Feb 9, 2018
1 parent 16fae91 commit 0a0e9f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dropdown/Dropdown.js
Expand Up @@ -64,9 +64,9 @@ export default class Dropdown extends Component {
});
}, 300);
}
onSelectMenu = (index, menuItem, menu) => {
const { onVisibleChange } = this.props;
if (this.showDropdown) {
onSelectMenu = (index, menuItem) => {
const { menu, onVisibleChange } = this.props;
if (this.showDropdown && menu) {
this.setState({ visible: false }, () => {
this.showDropdown = false;
menu && menu.props && menu.props.onSelect && menu.props.onSelect(index, menuItem, menu);
Expand Down Expand Up @@ -96,7 +96,9 @@ export default class Dropdown extends Component {
{React.Children.map(children, (child, index) => React.cloneElement(child, { key: index }))}
<Transition in={visible} sequence="fadeIn">
<div className={`${prefixCls}-menu-warpper`}>
{!disabled && menu}
{!disabled && menu && !disabled && React.cloneElement(menu, {
onSelect: this.onSelectMenu,
})}
</div>
</Transition>
</div>
Expand Down

0 comments on commit 0a0e9f4

Please sign in to comment.