Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount () {
// If this component is being rendered server-side, getScrollbarSize() will return undefined.
// We handle this case in componentDidMount()
this._scrollbarSize = getScrollbarSize()
if (this._scrollbarSize === undefined) {
this._scrollbarSizeMeasured = false
this._scrollbarSize = 0
} else {
this._scrollbarSizeMeasured = true
}
this._calculateChildrenToRender()
}
({ offset, rowHeight }) => ({
posStyle: {
top: offset,
height: rowHeight,
paddingRight: scrollbarSize(), // memoized in lib
},
})
),
const dialogNode = this._modal.getDialogElement();
const dialogHeight = dialogNode.scrollHeight;
const document = ownerDocument(dialogNode);
const bodyIsOverflowing = isOverflowing(
ReactDOM.findDOMNode(this.props.container || document.body)
);
const modalIsOverflowing =
dialogHeight > document.documentElement.clientHeight;
this.setState({
style: {
paddingRight:
bodyIsOverflowing && !modalIsOverflowing
? getScrollbarSize()
: undefined,
paddingLeft:
!bodyIsOverflowing && modalIsOverflowing
? getScrollbarSize()
: undefined
}
});
}
_getStyles() {
if (!canUseDOM)
return {}
let node = findDOMNode(this.dialog)
, doc = ownerDocument(node)
, scrollHt = node.scrollHeight
, bodyIsOverflowing = isOverflowing(this.props.container || doc.body)
, modalIsOverflowing = scrollHt > doc.documentElement.clientHeight
return {
dialog: {
zIndex: getZIndex('modal'),
paddingRight: bodyIsOverflowing && !modalIsOverflowing ? scrollbarWidth() : void 0,
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? scrollbarWidth() : void 0
},
backdrop: {
zIndex: getZIndex('backdrop')
}
}
}
const document = ownerDocument(dialogNode);
const bodyIsOverflowing = isOverflowing(
ReactDOM.findDOMNode(this.props.container || document.body)
);
const modalIsOverflowing =
dialogHeight > document.documentElement.clientHeight;
this.setState({
style: {
paddingRight:
bodyIsOverflowing && !modalIsOverflowing
? getScrollbarSize()
: undefined,
paddingLeft:
!bodyIsOverflowing && modalIsOverflowing
? getScrollbarSize()
: undefined
}
});
}
_getStyles() {
if (!canUseDOM)
return {}
let node = findDOMNode(this.dialog)
, doc = ownerDocument(node)
, scrollHt = node.scrollHeight
, bodyIsOverflowing = isOverflowing(this.props.container || doc.body)
, modalIsOverflowing = scrollHt > doc.documentElement.clientHeight
return {
dialog: {
zIndex: getZIndex('modal'),
paddingRight: bodyIsOverflowing && !modalIsOverflowing ? scrollbarWidth() : void 0,
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? scrollbarWidth() : void 0
},
backdrop: {
zIndex: getZIndex('backdrop')
}
}
}
const document = ownerDocument(dialogNode);
let bodyIsOverflowing=false;
if(this.props.container){
bodyIsOverflowing = isOverflowing(
ReactDOM.findDOMNode(this.props.container)
);
}
const modalIsOverflowing =
dialogHeight > document.documentElement.clientHeight;
this.setState({
style: {
paddingRight: bodyIsOverflowing && !modalIsOverflowing ?
getScrollbarSize() : undefined,
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ?
getScrollbarSize() : undefined
}
});
}
//ResizeStart 时,若模态框设置了 `centered` ,需要把居中属性移除,并通过 offsetTop 制造垂直居中的假象
const dialogHeight = dialogNode.scrollHeight;
const document = ownerDocument(dialogNode);
let bodyIsOverflowing=false;
if(this.props.container){
bodyIsOverflowing = isOverflowing(
ReactDOM.findDOMNode(this.props.container)
);
}
const modalIsOverflowing =
dialogHeight > document.documentElement.clientHeight;
this.setState({
style: {
paddingRight: bodyIsOverflowing && !modalIsOverflowing ?
getScrollbarSize() : undefined,
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ?
getScrollbarSize() : undefined
}
});
}
//ResizeStart 时,若模态框设置了 `centered` ,需要把居中属性移除,并通过 offsetTop 制造垂直居中的假象