Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateStyle() {
const dialogNode = this._modal!.dialog;
const dialogHeight = dialogNode.scrollHeight;
const document = ownerDocument(dialogNode);
const bodyIsOverflowing = isOverflowing(
this.props.container && ReactDOM.findDOMNode(this.props.container) as HTMLElement || document.body
);
const modalIsOverflowing =
dialogHeight > document.documentElement!.clientHeight;
this.setState({
style: {
paddingRight:
bodyIsOverflowing && !modalIsOverflowing
? getScrollbarSize()
: undefined,
paddingLeft:
!bodyIsOverflowing && modalIsOverflowing
? getScrollbarSize()
: undefined
}