Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/multiple-Portal.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Dialog from '../src/DialogWrap';
import Drawer from 'rc-drawer';
import 'rc-drawer/assets/index.css';
import 'rc-dialog/assets/index.less';

const { useState } = React;

const Demo = () => {
const [showDialog, setShowDialog] = useState(false);
const [showDrawer, setShowDrawer] = useState(false);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"compile": "rc-tools run compile --babel-runtime",
"pub": "rc-tools run pub --babel-runtime",
"lint": "rc-tools run lint --no-js-lint",
"lint:ts": "tsc",
"karma": "rc-test run karma",
"saucelabs": "rc-test run saucelabs",
"test": "rc-test run test",
Expand Down
13 changes: 9 additions & 4 deletions src/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ function offset(el: any) {

// https://github.com/ant-design/ant-design/issues/19340
// https://github.com/ant-design/ant-design/issues/19332
let cacheOverflow = {};
interface ICacheOverflow {
overflowX?: string;
overflowY?: string;
}
let cacheOverflow: ICacheOverflow = {};

export interface IDialogChildProps extends IDialogPropTypes {
getOpenCount: () => number;
Expand Down Expand Up @@ -75,7 +79,6 @@ export default class Dialog extends React.Component<IDialogChildProps, any> {
private sentinelEnd: HTMLElement;
private dialogMouseDown: boolean;
private timeoutId: number;
private cacheOverflow: { overflowX: string | null; overflowY: string | null};

constructor(props: IDialogChildProps) {
super(props);
Expand Down Expand Up @@ -383,12 +386,14 @@ export default class Dialog extends React.Component<IDialogChildProps, any> {
cacheOverflow = {
overflowX: document.body.style.overflowX,
overflowY: document.body.style.overflowY,
};
} as ICacheOverflow;
document.body.style.overflow = 'hidden';
switchScrollingEffect();
} else if (!openCount) {
if (cacheOverflow.overflowX !== undefined || cacheOverflow.overflowY !== undefined) {
if (cacheOverflow.overflowX !== undefined) {
document.body.style.overflowX = cacheOverflow.overflowX;
}
if (cacheOverflow.overflowY !== undefined) {
document.body.style.overflowY = cacheOverflow.overflowY;
}
cacheOverflow = {};
Expand Down