Skip to content

Commit

Permalink
Transition: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sam019 authored and e1emeb0t committed Oct 27, 2017
1 parent aad7e51 commit 3e18572
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libs/transition/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ export default class Transition extends Component {
element.classList.remove(action, active);
}

didEnter() {
didEnter(e) {
const childDOM = ReactDOM.findDOMNode(this.el);

if (e.target !== childDOM) return;

const { onAfterEnter } = this.props;
const { enterActive, enterTo } = this.transitionClass;
const childDOM = ReactDOM.findDOMNode(this.el);

childDOM.classList.remove(enterActive, enterTo);

Expand All @@ -120,10 +123,12 @@ export default class Transition extends Component {
onAfterEnter && onAfterEnter();
}

didLeave() {
didLeave(e) {
const childDOM = ReactDOM.findDOMNode(this.el);
if (e.target !== childDOM) return;

const { onAfterLeave, children } = this.props;
const { leaveActive, leaveTo } = this.transitionClass;
const childDOM = ReactDOM.findDOMNode(this.el);

new Promise((resolve) => {
if (this.isViewComponent(children)) {
Expand Down

0 comments on commit 3e18572

Please sign in to comment.