Hi team,
It would be great if we could get access to and useful data from onDragUpdate
, and would also allow preventing/customizing the expansion behavior.
The use case would be to provide more nuanced visual feedback to users during drag of items over items e.g. is it or is it not possible to drop or nest here? Additionally, this would enhance logic potential for isDragEnabled
, isNestingEnabled
, etc.
Currently, I believe it’s only possible to provide this feedback onDragEnd
, which could be confusing UX i.e. “This space expanded, but I can’t drag and drop to this destination?” —sees onDragEnd
feedback e.g. toast— “Oh, I can’t drag and drop here. I need to remember these conditions.”
Hopefully I’m not missing anything.
Cheers!
edit 20210305:
In RenderItemParams
, you access DraggableStateSnapshot
i.e. snapshot.draggingOver
and snapshot.combineWith
. Use combineWith
to determine if a drop is possible when dragging over a TreeItem
and adjust render item styles.
However, this only works well when dragging over an item — not when dragging above or under i.e. combineWith
is null
. It’s likely possible to get the desired effect during this condition by tracking state of combineWith
i.e. is draggingOver
not null
but combineWith
now is?
Still testing.
More info on DraggableStateSnapshot
: Customise the Appearance of an App during a Drag using react-beautiful-dnd snapshot Values | egghead.io