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

setState(...): Can only update a mounted or mounting component. #565

Open
gongchuncheng opened this issue Mar 19, 2019 · 1 comment
Open

Comments

@gongchuncheng
Copy link

gongchuncheng commented Mar 19, 2019

version: 0.5.2
//Transition

didLeave() {
       const { didLeave } = this.props;
       didLeave();
}

<TransitionMotion
       willEnter={this.willEnter.bind(this)}
       willLeave={this.willLeave.bind(this)}
       didLeave={this.didLeave.bind(this)}
       defaultStyles={this.getStyles('before')}
       styles={this.getStyles('after')}>
              { this.renderDom.bind(this) }
</TransitionMotion>

//container

destroyToast() {
     const { node } = this.props;  //node: another container   render to body
     const unmountResult = ReactDOM.unmountComponentAtNode(node);
     if (unmountResult && node.parentNode) {
           node.parentNode.removeChild(node);
     }
}
<Transition
      show={show}
      isAnimate={this.isAnimate}
      type='toast'
      didLeave={this.destroyToast.bind(this)}
>
       <div className="MI_toast-container">
               <div className="MI_toast" >{ message }</div>
        </div>
</Transition>

thanks~

@fabiulous
Copy link

This seems to be related to this: #567

The code fixing this unmounting issue is not in npm package manager

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

No branches or pull requests

2 participants