Skip to content

Commit

Permalink
Fix trigger repeat animation (#297)
Browse files Browse the repository at this point in the history
* fix: submenu use rc-trigger repeat animation

* fix popupClassName judgement
  • Loading branch information
shaodahong authored and zombieJ committed Nov 6, 2019
1 parent 2f6c3c6 commit 836d24c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/SubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,13 @@ export class SubMenu extends React.Component<SubMenuProps> {
</div>
);

// [Legacy] `getMotion` should call before `renderChildren`
const baseProps = this.getBaseProps();
const motion = this.getMotion(baseProps.mode, baseProps.visible);

const children = this.renderChildren(props.children);

const getPopupContainer = props.parentMenu.isRootMenu
? props.parentMenu.props.getPopupContainer
: (triggerNode: HTMLElement) => triggerNode.parentNode;
const popupPlacement = popupPlacementMap[props.mode];
const popupAlign = props.popupOffset ? { offset: props.popupOffset } : {};
const popupClassName = props.mode === 'inline' ? '' : props.popupClassName;
const {
disabled,
triggerSubMenuAction,
Expand All @@ -597,7 +592,10 @@ export class SubMenu extends React.Component<SubMenuProps> {
{!isInlineMode && (
<Trigger
prefixCls={prefixCls}
popupClassName={`${prefixCls}-popup ${popupClassName}`}
popupClassName={classNames(`${prefixCls}-popup`, {
[props.popupClassName]:
props.mode !== 'inline' && props.popupClassName,
})}
getPopupContainer={getPopupContainer}
builtinPlacements={Object.assign({}, placements, builtinPlacements)}
popupPlacement={popupPlacement}
Expand All @@ -609,7 +607,6 @@ export class SubMenu extends React.Component<SubMenuProps> {
mouseLeaveDelay={subMenuCloseDelay}
onPopupVisibleChange={this.onPopupVisibleChange}
forceRender={forceSubMenuRender}
popupMotion={motion}
>
{title}
</Trigger>
Expand Down

1 comment on commit 836d24c

@vercel
Copy link

@vercel vercel bot commented on 836d24c Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.