Skip to content

Commit 289288b

Browse files
authored
fix: remove findDOMNode usage (#790)
1 parent b207f9e commit 289288b

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/components/tabs/tab.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { useRef } from 'react';
3-
import { findDOMNode } from 'react-dom';
43
import { useDrag, useDrop } from 'react-dnd';
54

65
import { IEditorGroup } from 'mo/model';
@@ -95,14 +94,7 @@ export function Tab({ tab, active, ...restEvents }: ITabComponent) {
9594
hover(item: ITabProps, monitor) {
9695
if (!ref.current) return;
9796
const component = ref.current;
98-
/**
99-
* TODO: bad code needs to be removed
100-
*/
101-
/* eslint-disable */
102-
const hoverBoundingRect = (
103-
findDOMNode(component) as Element
104-
)?.getBoundingClientRect();
105-
/* eslint-enable */
97+
const hoverBoundingRect = component?.getBoundingClientRect();
10698
const hoverMiddleX =
10799
(hoverBoundingRect.right - hoverBoundingRect.left) / 2;
108100
const clientOffset = monitor.getClientOffset();

0 commit comments

Comments
 (0)