File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,8 +41,12 @@ class Fade extends React.Component {
4141
4242 this . onLeave = this . onLeave . bind ( this ) ;
4343 this . onEnter = this . onEnter . bind ( this ) ;
44+ this . timers = [ ] ;
4445 }
4546
47+ componentWillUnmount ( ) {
48+ this . timers . forEach ( timer => clearTimeout ( timer ) ) ;
49+ }
4650 onEnter ( cb ) {
4751 return ( ) => {
4852 cb ( ) ;
@@ -51,7 +55,6 @@ class Fade extends React.Component {
5155 }
5256 } ;
5357 }
54-
5558 onLeave ( cb ) {
5659 return ( ) => {
5760 cb ( ) ;
@@ -66,7 +69,7 @@ class Fade extends React.Component {
6669 this . onEnter ( cb ) ( ) ;
6770 }
6871
69- setTimeout ( this . onEnter ( cb ) , this . props . transitionAppearTimeout ) ;
72+ this . timers . push ( setTimeout ( this . onEnter ( cb ) , this . props . transitionAppearTimeout ) ) ;
7073 }
7174
7275 componentDidAppear ( ) {
@@ -80,7 +83,7 @@ class Fade extends React.Component {
8083 this . onEnter ( cb ) ( ) ;
8184 }
8285
83- setTimeout ( this . onEnter ( cb ) , this . props . transitionEnterTimeout ) ;
86+ this . timers . push ( setTimeout ( this . onEnter ( cb ) , this . props . transitionEnterTimeout ) ) ;
8487 }
8588
8689 componentDidEnter ( ) {
@@ -98,9 +101,8 @@ class Fade extends React.Component {
98101 this . onLeave ( cb ) ( ) ;
99102 }
100103
101- setTimeout ( this . onLeave ( cb ) , this . props . transitionLeaveTimeout ) ;
104+ this . timers . push ( setTimeout ( this . onLeave ( cb ) , this . props . transitionLeaveTimeout ) ) ;
102105 }
103-
104106 render ( ) {
105107 const {
106108 baseClass,
You can’t perform that action at this time.
0 commit comments