Skip to content

Commit b3e47e4

Browse files
author
刘欢
committed
feat: omit scrollLock prop from Dialog component in DialogWrap
1 parent dcca31a commit b3e47e4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/DialogWrap.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Portal, { type PortalProps } from '@rc-component/portal';
2+
import { omit } from '@rc-component/util';
23
import * as React from 'react';
34
import { RefContext } from './context';
45
import Dialog from './Dialog';
@@ -59,7 +60,7 @@ const DialogWrap: React.FC<IDialogPropTypes> = (props) => {
5960
autoLock={scrollLock && (visible || animatedVisible)}
6061
>
6162
<Dialog
62-
{...props}
63+
{...omit(props, ['scrollLock'])}
6364
destroyOnHidden={destroyOnHidden}
6465
afterClose={() => {
6566
const closableObj = closable && typeof closable === 'object' ? closable : {};

tests/scroll.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('Dialog.Scroll', () => {
8080
});
8181

8282
it('should not lock body scroll when scrollLock is false', () => {
83-
const { unmount, rerender } = render(<Dialog visible scrollLock={false} />);
83+
const { unmount } = render(<Dialog visible scrollLock={false} />);
8484

8585
// body should not have overflow:hidden when scrollLock is false
8686
expect(document.body).not.toHaveStyle({
@@ -91,7 +91,7 @@ describe('Dialog.Scroll', () => {
9191
});
9292

9393
it('should lock body scroll when scrollLock is true (default)', () => {
94-
const { unmount, rerender } = render(<Dialog visible scrollLock={true} />);
94+
const { unmount } = render(<Dialog visible scrollLock={true} />);
9595
expect(document.body).toHaveStyle({
9696
overflowY: 'hidden',
9797
});

0 commit comments

Comments
 (0)