Skip to content

Commit 6573696

Browse files
committed
fix(useDoubleClick): logging
1 parent 8bd8d2b commit 6573696

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.storybook/stories/Features/select.story.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ storiesOf('Features/Select', module)
6767

6868
<Body>
6969
{tableList.map((item) => (
70-
<Row item={item} key={item.id}>
70+
<Row
71+
item={item}
72+
key={item.id}
73+
onClick={() => console.log('single')}
74+
onDoubleClick={() => console.log('double')}
75+
>
7176
<Cell>{item.name}</Cell>
7277
<Cell>
7378
{item.deadline.toLocaleDateString('en-US', {

src/table/Row/useDoubleClick.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ const useDoubleClickBase = ({
2121

2222
const handleDoubleClick = (event: any) => {
2323
if (onDoubleClick) {
24+
console.log(clickCount.current);
25+
2426
if (clickCount.current === 0) {
2527
onSingleClick(event);
2628
}
2729

2830
clickCount.current += 1;
2931

3032
setTimeout(() => {
33+
console.log('timeout', clickCount.current);
3134
if (clickCount.current === 2) onDoubleClick(event);
3235

3336
clickCount.current = 0;

0 commit comments

Comments
 (0)