Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChangeRequest: rc-collapse does not unmount children. #43

Closed
stavenko opened this issue Nov 16, 2016 · 0 comments · Fixed by #61
Closed

ChangeRequest: rc-collapse does not unmount children. #43

stavenko opened this issue Nov 16, 2016 · 0 comments · Fixed by #61

Comments

@stavenko
Copy link

There is a need do determine, if current PanelContent visible or active in it's children.
There are three methods to perform this:

  1. Give PanelContent children isActive property.
  2. Put active panel in modern react context.
  3. Simply remove rendering of component and make user rely on componentWillMount, componentDidUnmount functions to track panels state.

Here is code snippet: render function of PanelContent:

 render() {
    this._isActived = this._isActived || this.props.isActive;
    if (!this._isActived) {
      return null;
    }
    const { prefixCls, isActive, children } = this.props;
    const contentCls = classnames({
      [`${prefixCls}-content`]: true,
      [`${prefixCls}-content-active`]: isActive,
      [`${prefixCls}-content-inactive`]: !isActive,
    });

    return (
      <div
        className={contentCls}
        role="tabpanel"
      >
        {isActive?<div className={`${prefixCls}-content-box`}>{children}</div>: null}

      </div>
    );
  },

In my humble opinion this change is trivial, does not breaks functionality or rc-collapse, and does not breaks user expectations about componentWillMount, componentDidUnmount behaviour.

@stavenko stavenko changed the title ChecngerRequest: rc-collapse does not unmount children. ChangeRequest: rc-collapse does not unmount children. Nov 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant