Skip to content

Commit

Permalink
[fixed] portal node will be reparented if necessary on props change
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff authored and diasbruno committed Jul 4, 2018
1 parent f715a69 commit e5a80d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ class Modal extends Component {
this.node.className = portalClassName;
}

// Stop unnecessary renders if modal is remaining closed
if (!prevProps.isOpen && !isOpen) return;

const { prevParent, nextParent } = snapshot;
if (nextParent !== prevParent) {
prevParent.removeChild(this.node);
nextParent.appendChild(this.node);
}

// Stop unnecessary renders if modal is remaining closed
if (!prevProps.isOpen && !isOpen) return;

!isReact16 && this.renderPortal(this.props);
}

Expand Down

0 comments on commit e5a80d6

Please sign in to comment.