@@ -14,6 +14,7 @@ import useTargetState from './useTargetState';
1414import { isDOM } from '@rc-component/util/lib/Dom/findDOMNode' ;
1515import FloatBg from './FloatBg' ;
1616import classNames from 'classnames' ;
17+ import MotionContent from './MotionContent' ;
1718
1819export interface UniqueProviderProps {
1920 children : React . ReactNode ;
@@ -41,13 +42,18 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
4142 } ) ;
4243
4344 // ========================== Register ==========================
45+ const [ popupId , setPopupId ] = React . useState ( 0 ) ;
46+
4447 const delayInvoke = useDelay ( ) ;
4548
46- const show = ( showOptions : UniqueShowOptions ) => {
49+ const show = useEvent ( ( showOptions : UniqueShowOptions ) => {
4750 delayInvoke ( ( ) => {
51+ if ( showOptions . id !== options ?. id ) {
52+ setPopupId ( ( i ) => i + 1 ) ;
53+ }
4854 trigger ( showOptions ) ;
4955 } , showOptions . delay ) ;
50- } ;
56+ } ) ;
5157
5258 const hide = ( delay : number ) => {
5359 delayInvoke ( ( ) => {
@@ -60,11 +66,6 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
6066 const onVisibleChanged = useEvent ( ( visible : boolean ) => {
6167 // Call useTargetState callback to handle animation state
6268 onTargetVisibleChanged ( visible ) ;
63- // if (!visible) {
64- // setTarget(null);
65- // setCurrentNode(null);
66- // setOptions(null);
67- // }
6869 } ) ;
6970
7071 // =========================== Align ============================
@@ -133,7 +134,11 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => {
133134 ref = { setPopupRef }
134135 portal = { Portal }
135136 prefixCls = { prefixCls }
136- popup = { options . popup }
137+ popup = {
138+ < MotionContent prefixCls = { prefixCls } key = { popupId } >
139+ { options . popup }
140+ </ MotionContent >
141+ }
137142 className = { classNames (
138143 options . popupClassName ,
139144 `${ prefixCls } -unique-controlled` ,
0 commit comments