Skip to content

Commit

Permalink
Fix inlineCollpased Menu remains inline mode instead of vertical
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored and ardok committed Nov 8, 2018
1 parent d01c506 commit 8d080f9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,21 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
this.inlineOpenKeys = [];
}
}
restoreModeVerticalFromInline() {
if (this.switchingModeFromInline) {
this.switchingModeFromInline = false;
this.setState({});
}
}
handleTransitionEnd = (e: TransitionEvent) => {
// when inlineCollapsed menu width animation finished
// https://github.com/ant-design/ant-design/issues/12864
if (e.propertyName === 'width' &&
e.target === e.currentTarget &&
this.switchingModeFromInline) {
this.switchingModeFromInline = false;
this.setState({});
const widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget;
// Fix for <Menu style={{ width: '100%' }} />, the width transition won't trigger when menu is collapsed
// https://github.com/ant-design/ant-design-pro/issues/2783
const iconScaled = e.propertyName === 'font-size' && (e.target as HTMLElement).className.indexOf('anticon') >= 0;
if (widthCollapsed || iconScaled) {
this.restoreModeVerticalFromInline();
}
}
handleClick = (e: ClickParam) => {
Expand Down

0 comments on commit 8d080f9

Please sign in to comment.