Skip to content

Commit 7981902

Browse files
committed
fix(Drawer): Drawer 抽屉一直点按钮 报错 #386
1 parent e43d376 commit 7981902

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/core/src/Drawer/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Dimensions,
99
GestureResponderEvent,
1010
} from 'react-native';
11+
import { debounce } from 'lodash';
1112

1213
const DEVICE_WIDTH = Dimensions.get('window').width;
1314
const DEVICE_HEIGHT = Dimensions.get('window').height;
@@ -53,9 +54,10 @@ export default class Drawer extends Component<DrawerProps, DrawerState> {
5354
isOpen: !!props.isOpen,
5455
};
5556
}
56-
handleDrawer = (isOpen: boolean) => {
57+
handleDrawer = debounce((isOpen: boolean) => {
5758
isOpen ? this.openDrawer() : this.closeDrawer();
58-
};
59+
}, 100);
60+
5961
componentDidUpdate(prevProps: DrawerProps, prevState: DrawerState) {
6062
if (prevState.isOpen !== this.state.isOpen) {
6163
this.handleDrawer(this.state.isOpen);

0 commit comments

Comments
 (0)