Skip to content

Commit e94acc1

Browse files
committed
fix(tabs): add dragAndDrop HOC
1 parent 06fb348 commit e94acc1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/components/tabs/dragAndDrop.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as React from 'react';
2+
import { DndProvider, createDndContext } from 'react-dnd';
3+
import HTML5Backend from 'react-dnd-html5-backend';
4+
import { PropsWithChildren, useRef } from 'react';
5+
6+
const RNDContext = createDndContext(HTML5Backend);
7+
8+
function DragAndDrop({ children }: PropsWithChildren<{}>): JSX.Element {
9+
const manager = useRef(RNDContext);
10+
return (
11+
<DndProvider manager={manager.current.dragDropManager}>
12+
{children}
13+
</DndProvider>
14+
);
15+
}
16+
17+
export default DragAndDrop;

0 commit comments

Comments
 (0)