@@ -31,11 +31,11 @@ class ScrollOverPack extends ScrollElement {
31
31
componentProps : { } ,
32
32
}
33
33
34
- static getDerivedStateFromProps ( props , { prevProps, $self } ) {
34
+ static getDerivedStateFromProps ( props , { prevProps } ) {
35
35
const nextState = {
36
36
prevProps : props ,
37
37
} ;
38
- if ( prevProps && ! $self . isInsideRender ) {
38
+ if ( prevProps && props !== prevProps ) {
39
39
nextState . children = toArrayChildren ( props . children ) ;
40
40
}
41
41
return nextState ;
@@ -48,13 +48,12 @@ class ScrollOverPack extends ScrollElement {
48
48
this . enter = false ;
49
49
this . state = {
50
50
show : false ,
51
- $self : this ,
52
51
children : toArrayChildren ( props . children ) ,
53
52
} ;
54
53
}
55
54
56
- componentDidUpdate ( ) {
57
- if ( this . isInsideRender ) {
55
+ componentDidUpdate ( prevProps ) {
56
+ if ( prevProps !== this . props ) {
58
57
const { always } = this . props ;
59
58
const { show } = this . state ;
60
59
const inListener = EventListener . _listeners . scroll &&
@@ -65,7 +64,6 @@ class ScrollOverPack extends ScrollElement {
65
64
this . scrollEventListener ( ) ;
66
65
}
67
66
}
68
- this . isInsideRender = false ;
69
67
}
70
68
71
69
scrollEventListener = ( e ) => {
@@ -75,7 +73,6 @@ class ScrollOverPack extends ScrollElement {
75
73
const isTop = this . elementShowHeight > this . clientHeight + this . leavePlayHeight ;
76
74
if ( this . enter || ! replay && isTop ) {
77
75
if ( ! show ) {
78
- this . isInsideRender = true ;
79
76
this . setState ( {
80
77
show : true ,
81
78
} ) ;
@@ -89,7 +86,6 @@ class ScrollOverPack extends ScrollElement {
89
86
const topLeave = replay ? isTop : null ;
90
87
if ( topLeave || bottomLeave ) {
91
88
if ( show ) {
92
- this . isInsideRender = true ;
93
89
this . setState ( {
94
90
show : false ,
95
91
} ) ;
0 commit comments