MCPcopy Create free account
hub / github.com/adobe/react-spectrum / DraggableTree

Function DraggableTree

packages/@react-spectrum/s2/test/TreeView.test.tsx:598–617  ·  view source on GitHub ↗
(props: {pointerDragSource?: 'item' | 'handle'})

Source from the content-addressed store, hash-verified

596
597 describe('pointerDragSource', () => {
598 function DraggableTree(props: {pointerDragSource?: 'item' | 'handle'}) {
599 let {dragAndDropHooks} = useDragAndDrop({
600 getItems: keys => [...keys].map(key => ({'text/plain': `${key}`})),
601 pointerDragSource: props.pointerDragSource
602 });
603 return (
604 <TreeView aria-label="Draggable tree" dragAndDropHooks={dragAndDropHooks}>
605 <TreeViewItem id="projects" textValue="Projects">
606 <TreeViewItemContent>
607 <Text>Projects</Text>
608 </TreeViewItemContent>
609 </TreeViewItem>
610 <TreeViewItem id="photos" textValue="Photos">
611 <TreeViewItemContent>
612 <Text>Photos</Text>
613 </TreeViewItemContent>
614 </TreeViewItem>
615 </TreeView>
616 );
617 }
618
619 it('should make the row draggable and visually hide the drag button by default', () => {
620 let {getAllByRole} = render(<DraggableTree />);

Callers

nothing calls this directly

Calls 1

useDragAndDropFunction · 0.90

Tested by

no test coverage detected