I want to use the drag and drop on tree.
I want that during mouse move I will be able to check if it's ok to drop the item or not and if it's not ok to change the cursor to 'none'.
I succeeded to check if it's ok or not to drop the item I drag but I can't change the cursor.
I tried to do the following code but it's not working, the effectAllowed stay as initialize in the onDragStart
Code: Select all
const handleDragOver = (event, node) => {
if (node.key !== selectedItem.key && lastDragOverKey != node.key) {
const isValid = isPasteValid(selectedItem, node);
event.dataTransfer.effectAllowed = isValid ? "copy" : "none"; // Set effectAllowed on the source
setLastDragOverKey(node.key);
}
};