@@ -78,9 +78,6 @@ interface PopupState {
7878 status : PopupStatus ;
7979 prevVisible : boolean ;
8080 alignClassName : string ;
81-
82- /** Record for CSSMotion is working or not */
83- inMotion : boolean ;
8481}
8582
8683interface AlignRefType {
@@ -99,8 +96,6 @@ class Popup extends Component<PopupProps, PopupState> {
9996 status : null ,
10097 prevVisible : null , // eslint-disable-line react/no-unused-state
10198 alignClassName : null ,
102-
103- inMotion : false ,
10499 } ;
105100
106101 public popupRef = React . createRef < HTMLDivElement > ( ) ;
@@ -113,7 +108,7 @@ class Popup extends Component<PopupProps, PopupState> {
113108
114109 static getDerivedStateFromProps (
115110 { visible, ...props } : PopupProps ,
116- { prevVisible, status, inMotion } : PopupState ,
111+ { prevVisible, status } : PopupState ,
117112 ) {
118113 const newState : Partial < PopupState > = { prevVisible : visible , status } ;
119114
@@ -122,11 +117,12 @@ class Popup extends Component<PopupProps, PopupState> {
122117 if ( prevVisible === null && visible === false ) {
123118 // Init render should always be stable
124119 newState . status = 'stable' ;
125- newState . inMotion = false ;
126120 } else if ( visible !== prevVisible ) {
127- newState . inMotion = false ;
128-
129- if ( visible || ( supportMotion ( mergedMotion ) && inMotion ) ) {
121+ if (
122+ visible ||
123+ ( supportMotion ( mergedMotion ) &&
124+ [ 'motion' , 'AfterMotion' , 'stable' ] . includes ( status ) )
125+ ) {
130126 newState . status = null ;
131127 } else {
132128 newState . status = 'stable' ;
@@ -326,14 +322,6 @@ class Popup extends Component<PopupProps, PopupState> {
326322 mergedMotionVisible = false ;
327323 }
328324
329- // Update trigger to tell if is in motion
330- [ 'onEnterStart' , 'onAppearStart' , 'onLeaveStart' ] . forEach ( event => {
331- mergedMotion [ event ] = ( ...args ) => {
332- mergedMotion ?. [ event ] ?.( ...args ) ;
333- this . setState ( { inMotion : true } ) ;
334- } ;
335- } ) ;
336-
337325 // ================== Align ==================
338326 const mergedAlignDisabled =
339327 ! visible ||
0 commit comments