()
| 101 | ]; |
| 102 | |
| 103 | function ReorderableListView() { |
| 104 | let list = useListData({initialItems: listItems}); |
| 105 | let {dragAndDropHooks} = useDragAndDrop({ |
| 106 | getItems: keys => |
| 107 | [...keys].map(key => { |
| 108 | let item = list.getItem(key)!; |
| 109 | return {'text/plain': item.name}; |
| 110 | }), |
| 111 | onReorder(e) { |
| 112 | if (e.target.dropPosition === 'before') { |
| 113 | list.moveBefore(e.target.key, e.keys); |
| 114 | } else if (e.target.dropPosition === 'after') { |
| 115 | list.moveAfter(e.target.key, e.keys); |
| 116 | } |
| 117 | } |
| 118 | }); |
| 119 | return ( |
| 120 | <ListView |
| 121 | aria-label="Reorderable files" |
| 122 | selectionMode="multiple" |
| 123 | items={list.items} |
| 124 | dragAndDropHooks={dragAndDropHooks} |
| 125 | styles={style({width: 320, height: 320})}> |
| 126 | {(item: any) => ( |
| 127 | <ListViewItem textValue={item.name}> |
| 128 | <Text>{item.name}</Text> |
| 129 | </ListViewItem> |
| 130 | )} |
| 131 | </ListView> |
| 132 | ); |
| 133 | } |
| 134 | |
| 135 | function ReorderableTableView() { |
| 136 | let list = useListData({initialItems: tableItems}); |
nothing calls this directly
no test coverage detected