Skip to content

Commit

Permalink
fix: remove findDOMNode usage (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Aug 25, 2022
1 parent b207f9e commit 289288b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/components/tabs/tab.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { useRef } from 'react';
import { findDOMNode } from 'react-dom';
import { useDrag, useDrop } from 'react-dnd';

import { IEditorGroup } from 'mo/model';
Expand Down Expand Up @@ -95,14 +94,7 @@ export function Tab({ tab, active, ...restEvents }: ITabComponent) {
hover(item: ITabProps, monitor) {
if (!ref.current) return;
const component = ref.current;
/**
* TODO: bad code needs to be removed
*/
/* eslint-disable */
const hoverBoundingRect = (
findDOMNode(component) as Element
)?.getBoundingClientRect();
/* eslint-enable */
const hoverBoundingRect = component?.getBoundingClientRect();
const hoverMiddleX =
(hoverBoundingRect.right - hoverBoundingRect.left) / 2;
const clientOffset = monitor.getClientOffset();
Expand Down

0 comments on commit 289288b

Please sign in to comment.