diff --git a/components/drawer/__tests__/__snapshots__/demo-extend.test.tsx.snap b/components/drawer/__tests__/__snapshots__/demo-extend.test.tsx.snap
index b85f9b50715c..e6a74dbc4bc9 100644
--- a/components/drawer/__tests__/__snapshots__/demo-extend.test.tsx.snap
+++ b/components/drawer/__tests__/__snapshots__/demo-extend.test.tsx.snap
@@ -2788,7 +2788,7 @@ Array [
type="button"
>
- Open
+ Open Drawer
,
- Open
+ Open Drawer
`;
diff --git a/components/drawer/demo/loading.tsx b/components/drawer/demo/loading.tsx
index 6e48c62756b0..1af8c2567761 100644
--- a/components/drawer/demo/loading.tsx
+++ b/components/drawer/demo/loading.tsx
@@ -1,44 +1,36 @@
import React from 'react';
-import type { DrawerProps } from 'antd';
import { Button, Drawer } from 'antd';
const App: React.FC = () => {
- const [open, setOpen] = React.useState(false);
- const [loading, setLoading] = React.useState
(true);
- const timerRef = React.useRef>();
+ const [open, setOpen] = React.useState(false);
+ const [loading, setLoading] = React.useState(true);
- const clearTimer = () => {
- if (timerRef.current) {
- clearTimeout(timerRef.current);
- }
- };
-
- const showDrawer = () => {
+ const showLoading = () => {
setOpen(true);
setLoading(true);
- timerRef.current = setTimeout(() => {
+
+ // Simple loading mock. You should add cleanup logic in real world.
+ setTimeout(() => {
setLoading(false);
}, 2000);
};
- React.useEffect(() => clearTimer, []);
-
return (
<>
-