dnd-kit
dnd-kit copied to clipboard
shouldCancelStart?
I'm trying to migrate a project from react-sortable-hoc. What's the equivalent of shouldCancelStart? How can I prevent the drag to start on runtime? Thanks! 🙏
I resolved with a custom Sensor:
class CustomPointerSensor extends PointerSensor {
static activators = [
{
eventName: 'onPointerDown' as const,
handler: ({ nativeEvent: event }: PointerEvent): boolean => {
if (document.querySelector(...)) {
return false;
}
return true;
}
}
];
}