Skip to content

Commit 0cab822

Browse files
authored
fix: Motion End disappear should work (#192)
* fix: not hide css motion * fix lint
1 parent d1f244d commit 0cab822

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

examples/simple.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class Test extends React.Component {
6969
offsetX: undefined,
7070
offsetY: undefined,
7171
stretch: '',
72+
transitionName: 'rc-trigger-popup-zoom',
7273
};
7374

7475
onPlacementChange = e => {

src/Popup.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ class Popup extends Component<PopupProps, PopupState> {
362362
removeOnLeave={false}
363363
onEnterEnd={this.onMotionEnd}
364364
onLeaveEnd={this.onMotionEnd}
365+
leavedClassName={hiddenClassName}
365366
>
366367
{({ style: motionStyle, className: motionClassName }, motionRef) => (
367368
<Align
@@ -375,8 +376,6 @@ class Popup extends Component<PopupProps, PopupState> {
375376
>
376377
<PopupInner
377378
prefixCls={prefixCls}
378-
visible={mergedPopupVisible}
379-
hiddenClassName={hiddenClassName}
380379
className={classNames(mergedClassName, motionClassName)}
381380
ref={composeRef(motionRef, this.popupRef)}
382381
onMouseEnter={onMouseEnter}

src/PopupInner.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import React from 'react';
2-
import classNames from 'classnames';
32

43
interface PopupInnerProps {
54
prefixCls: string;
65
className: string;
7-
hiddenClassName?: string;
8-
visible?: boolean;
96
style?: React.CSSProperties;
107
children?: React.ReactNode;
118

@@ -15,11 +12,13 @@ interface PopupInnerProps {
1512
onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
1613
}
1714

18-
const PopupInner: React.RefForwardingComponent<HTMLDivElement, PopupInnerProps> = (props, ref) => {
15+
const PopupInner: React.RefForwardingComponent<
16+
HTMLDivElement,
17+
PopupInnerProps
18+
> = (props, ref) => {
1919
const {
2020
prefixCls,
2121
className,
22-
visible,
2322
style,
2423
children,
2524
onMouseEnter,
@@ -37,7 +36,7 @@ const PopupInner: React.RefForwardingComponent<HTMLDivElement, PopupInnerProps>
3736
return (
3837
<div
3938
ref={ref}
40-
className={classNames(className, !visible && `${props.hiddenClassName}`)}
39+
className={className}
4140
onMouseEnter={onMouseEnter}
4241
onMouseLeave={onMouseLeave}
4342
onMouseDown={onMouseDown}
@@ -49,7 +48,9 @@ const PopupInner: React.RefForwardingComponent<HTMLDivElement, PopupInnerProps>
4948
);
5049
};
5150

52-
const RefPopupInner = React.forwardRef<HTMLDivElement, PopupInnerProps>(PopupInner);
51+
const RefPopupInner = React.forwardRef<HTMLDivElement, PopupInnerProps>(
52+
PopupInner,
53+
);
5354
RefPopupInner.displayName = 'PopupInner';
5455

5556
export default RefPopupInner;

0 commit comments

Comments
 (0)