MCPcopy Create free account
hub / github.com/reactjs/react-modal / componentWillUnmount

Method componentWillUnmount

src/components/Modal.js:171–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169 }
170
171 componentWillUnmount() {
172 if (!canUseDOM || !this.node || !this.portal) return;
173
174 const state = this.portal.state;
175 const now = Date.now();
176 const closesAt =
177 state.isOpen &&
178 this.props.closeTimeoutMS &&
179 (state.closesAt || now + this.props.closeTimeoutMS);
180
181 if (closesAt) {
182 if (!state.beforeClose) {
183 this.portal.closeWithTimeout();
184 }
185
186 setTimeout(this.removePortal, closesAt - now);
187 } else {
188 this.removePortal();
189 }
190 }
191
192 removePortal = () => {
193 !isReact16 && ReactDOM.unmountComponentAtNode(this.node);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected