From 51985862ea596a07e7d1408671bc3d83ad3a8b45 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 19 May 2020 17:07:30 +0800 Subject: [PATCH] fix: Drawer cover other elements when closed close #24287 --- .../__snapshots__/Drawer.test.js.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- components/drawer/demo/basic-right.md | 68 ++++++++----------- components/drawer/index.tsx | 5 +- 4 files changed, 37 insertions(+), 42 deletions(-) diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index 99c1b1859eb8..e731b69d6e21 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -13,7 +13,7 @@ exports[`Drawer className is test_drawer 1`] = ` />
{ - this.setState({ - visible: true, - }); +const App: React.FC = () => { + const [visible, setVisible] = useState(false); + const showDrawer = () => { + setVisible(true); }; - - onClose = () => { - this.setState({ - visible: false, - }); + const onClose = () => { + setVisible(false); }; - - render() { - return ( - <> - - -

Some contents...

-

Some contents...

-

Some contents...

-
- - ); - } -} + return ( + <> + + +

Some contents...

+

Some contents...

+

Some contents...

+
+ + ); +}; ReactDOM.render(, mountNode); ``` -```css + diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index a4fd42226efc..a2fc39a48c53 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -137,7 +137,10 @@ class Drawer extends React.Component