react-bootstrap
Version:
Bootstrap 3 components build with React
36 lines (29 loc) • 880 B
JavaScript
import React from './react-es6';
export default = {
componentWillUnmount: function () {
this._unrenderOverlay();
document.body.removeChild(this._overlayTarget);
this._overlayTarget = null;
},
componentDidUpdate: function () {
this._renderOverlay();
},
componentDidMount: function () {
this._renderOverlay();
},
_mountOverlayTarget: function () {
this._overlayTarget = document.createElement('div');
document.body.appendChild(this._overlayTarget);
},
_renderOverlay: function () {
if (!this._overlayTarget) {
this._mountOverlayTarget();
}
// Save reference to help testing
this._overlayInstance = React.renderComponent(this.renderOverlay(), this._overlayTarget);
},
_unrenderOverlay: function () {
React.unmountComponentAtNode(this._overlayTarget);
this._overlayInstance = null;
}
};