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