Skip to content

Commit

Permalink
revert _component, add related Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
shaodahong committed Dec 2, 2019
1 parent c0a32b4 commit ad011be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/PortalWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable react/require-default-props */
/* eslint-disable no-underscore-dangle,react/require-default-props */
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -122,12 +122,14 @@ class PortalWrapper extends React.Component {
};

savePortal = c => {
this.component = c;
// Warning: don't rename _component
// https://github.com/react-component/util/pull/65#discussion_r352407916
this._component = c;
};

removeCurrentContainer = visible => {
this.container = null;
this.component = null;
this._component = null;
if (!IS_REACT_16) {
if (visible) {
this.renderComponent({
Expand Down Expand Up @@ -198,7 +200,7 @@ class PortalWrapper extends React.Component {
</ContainerRender>
);
}
if (forceRender || visible || this.component) {
if (forceRender || visible || this._component) {
portal = (
<Portal getContainer={this.getContainer} ref={this.savePortal}>
{children(childProps)}
Expand Down

0 comments on commit ad011be

Please sign in to comment.