File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,18 @@ export default function PopupTrigger({
6262 const popupPlacement = popupPlacementMap [ mode ] ;
6363
6464 const targetMotion = getMotion ( mode , motion , defaultMotions ) ;
65+ const targetMotionRef = React . useRef ( targetMotion ) ;
66+
67+ if ( mode !== 'inline' ) {
68+ /**
69+ * PopupTrigger is only used for vertical and horizontal types.
70+ * When collapsed is unfolded, the inline animation will destroy the vertical animation.
71+ */
72+ targetMotionRef . current = targetMotion ;
73+ }
6574
6675 const mergedMotion : CSSMotionProps = {
67- ...targetMotion ,
76+ ...targetMotionRef . current ,
6877 leavedClassName : `${ prefixCls } -hidden` ,
6978 removeOnLeave : false ,
7079 motionAppear : true ,
Original file line number Diff line number Diff line change @@ -574,6 +574,22 @@ describe('Menu', () => {
574574 rerender ( genMenu ( { mode : 'vertical' } ) ) ;
575575 expect ( global . triggerProps . popupMotion . motionName ) . toEqual ( 'bambooLight' ) ;
576576 } ) ;
577+
578+ it ( 'inline does not affect vertical motion' , ( ) => {
579+ const genMenu = props => (
580+ < Menu defaultMotions = { defaultMotions } { ...props } >
581+ < SubMenu key = "bamboo" >
582+ < MenuItem key = "light" />
583+ </ SubMenu >
584+ </ Menu >
585+ ) ;
586+
587+ const { rerender } = render ( genMenu ( { mode : 'vertical' } ) ) ;
588+ rerender ( genMenu ( { mode : 'inline' } ) ) ;
589+ expect ( global . triggerProps . popupMotion . motionName ) . toEqual (
590+ 'defaultMotion' ,
591+ ) ;
592+ } ) ;
577593 } ) ;
578594
579595 it ( 'onMouseEnter should work' , ( ) => {
You can’t perform that action at this time.
0 commit comments