@@ -78,9 +78,6 @@ interface PopupState {
78
78
status : PopupStatus ;
79
79
prevVisible : boolean ;
80
80
alignClassName : string ;
81
-
82
- /** Record for CSSMotion is working or not */
83
- inMotion : boolean ;
84
81
}
85
82
86
83
interface AlignRefType {
@@ -99,8 +96,6 @@ class Popup extends Component<PopupProps, PopupState> {
99
96
status : null ,
100
97
prevVisible : null , // eslint-disable-line react/no-unused-state
101
98
alignClassName : null ,
102
-
103
- inMotion : false ,
104
99
} ;
105
100
106
101
public popupRef = React . createRef < HTMLDivElement > ( ) ;
@@ -113,7 +108,7 @@ class Popup extends Component<PopupProps, PopupState> {
113
108
114
109
static getDerivedStateFromProps (
115
110
{ visible, ...props } : PopupProps ,
116
- { prevVisible, status, inMotion } : PopupState ,
111
+ { prevVisible, status } : PopupState ,
117
112
) {
118
113
const newState : Partial < PopupState > = { prevVisible : visible , status } ;
119
114
@@ -122,11 +117,12 @@ class Popup extends Component<PopupProps, PopupState> {
122
117
if ( prevVisible === null && visible === false ) {
123
118
// Init render should always be stable
124
119
newState . status = 'stable' ;
125
- newState . inMotion = false ;
126
120
} 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
+ ) {
130
126
newState . status = null ;
131
127
} else {
132
128
newState . status = 'stable' ;
@@ -326,14 +322,6 @@ class Popup extends Component<PopupProps, PopupState> {
326
322
mergedMotionVisible = false ;
327
323
}
328
324
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
-
337
325
// ================== Align ==================
338
326
const mergedAlignDisabled =
339
327
! visible ||
0 commit comments