mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 09:35:56 -05:00
fix ReactModal bodyOpenClassName error so that it is entirely omitted, rather than passing null value (#2176)
This commit is contained in:
parent
1f8342b987
commit
d5343dfb01
1 changed files with 6 additions and 5 deletions
|
@ -23,14 +23,15 @@ class Modal extends React.Component {
|
||||||
return this.modal.portal.requestClose();
|
return this.modal.portal.requestClose();
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
|
// bodyOpenClassName prop cannot be blank string or null here; both cause
|
||||||
|
// an error, because ReactModal does not correctly handle them.
|
||||||
|
// If we're not setting it to a class name, we must omit the prop entirely.
|
||||||
|
const bodyOpenClassNameProp = this.props.useStandardSizes ?
|
||||||
|
{bodyOpenClassName: classNames('overflow-hidden')} : {};
|
||||||
return (
|
return (
|
||||||
<ReactModal
|
<ReactModal
|
||||||
appElement={document.getElementById('app')}
|
appElement={document.getElementById('app')}
|
||||||
// bodyOpenClassName can be blank string, but must not be null here; a null value causes
|
{...bodyOpenClassNameProp}
|
||||||
// an error, because ReactModal does not correctly handle the case of a null bodyOpenClassName
|
|
||||||
bodyOpenClassName={classNames({
|
|
||||||
'overflow-hidden': this.props.useStandardSizes
|
|
||||||
})}
|
|
||||||
className={{
|
className={{
|
||||||
base: classNames('modal-content', this.props.className, {
|
base: classNames('modal-content', this.props.className, {
|
||||||
'modal-sizes': this.props.useStandardSizes
|
'modal-sizes': this.props.useStandardSizes
|
||||||
|
|
Loading…
Reference in a new issue