Revert "MenuItem: avoid rendering Tooltip unless necessary (#9636)"

This reverts commit 0754845aff.

Conditional rendering will break the transition animation,
since React will create new DOM node when inlineCollapsed changges.

Fix https://github.com/react-component/menu/issues/139
This commit is contained in:
Wei Zhu 2018-05-02 14:44:53 +08:00
parent b5a52d26f2
commit 56e3384c6b

View File

@ -18,18 +18,14 @@ class MenuItem extends React.Component<any, any> {
render() {
const { inlineCollapsed } = this.context;
const props = this.props;
const item = <Item {...props} ref={this.saveMenuItem} />;
if (inlineCollapsed && props.level === 1) {
return <Tooltip
title={props.children}
title={inlineCollapsed && props.level === 1 ? props.children : ''}
placement="right"
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
>
{item}
<Item {...props} ref={this.saveMenuItem} />
</Tooltip>;
}
return item;
}
}
export default MenuItem;