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({
62
62
const popupPlacement = popupPlacementMap [ mode ] ;
63
63
64
64
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
+ }
65
74
66
75
const mergedMotion : CSSMotionProps = {
67
- ...targetMotion ,
76
+ ...targetMotionRef . current ,
68
77
leavedClassName : `${ prefixCls } -hidden` ,
69
78
removeOnLeave : false ,
70
79
motionAppear : true ,
Original file line number Diff line number Diff line change @@ -574,6 +574,22 @@ describe('Menu', () => {
574
574
rerender ( genMenu ( { mode : 'vertical' } ) ) ;
575
575
expect ( global . triggerProps . popupMotion . motionName ) . toEqual ( 'bambooLight' ) ;
576
576
} ) ;
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
+ } ) ;
577
593
} ) ;
578
594
579
595
it ( 'onMouseEnter should work' , ( ) => {
You can’t perform that action at this time.
0 commit comments