From 32556094717b86b1618dc3f2046503b7b3da9652 Mon Sep 17 00:00:00 2001 From: Karl Wills Date: Tue, 25 Feb 2020 08:26:59 +0000 Subject: [PATCH 1/2] Remove classes based on disabled config --- src/CSSTransition.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CSSTransition.js b/src/CSSTransition.js index 4f0a2317..0486f63c 100644 --- a/src/CSSTransition.js +++ b/src/CSSTransition.js @@ -4,6 +4,8 @@ import addOneClass from 'dom-helpers/addClass'; import removeOneClass from 'dom-helpers/removeClass'; import React from 'react'; +import config from './config'; + import Transition from './Transition'; import { classNamesShape } from './utils/PropTypes'; @@ -108,6 +110,10 @@ class CSSTransition extends React.Component { this.removeClasses(node, type); this.addClass(node, type, 'done'); + if(this.config.disabled) { + this.removeClasses(node, 'exit'); + } + if (this.props.onEntered) { this.props.onEntered(node, appearing) } @@ -135,6 +141,10 @@ class CSSTransition extends React.Component { this.removeClasses(node, 'exit'); this.addClass(node, 'exit', 'done'); + if(this.config.disabled) { + this.removeClasses(node, 'enter'); + } + if (this.props.onExited) { this.props.onExited(node) } From 46e9beb0f6e6fa371786657a375d8b8f17b60500 Mon Sep 17 00:00:00 2001 From: Karl Wills Date: Tue, 25 Feb 2020 08:32:49 +0000 Subject: [PATCH 2/2] Remove 'this' reference and tidy formatting --- src/CSSTransition.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CSSTransition.js b/src/CSSTransition.js index 0486f63c..20023c73 100644 --- a/src/CSSTransition.js +++ b/src/CSSTransition.js @@ -110,7 +110,7 @@ class CSSTransition extends React.Component { this.removeClasses(node, type); this.addClass(node, type, 'done'); - if(this.config.disabled) { + if (config.disabled) { this.removeClasses(node, 'exit'); } @@ -141,7 +141,7 @@ class CSSTransition extends React.Component { this.removeClasses(node, 'exit'); this.addClass(node, 'exit', 'done'); - if(this.config.disabled) { + if (config.disabled) { this.removeClasses(node, 'enter'); }