- Due to API changes, this is a major release.
Breaking Changes:
- Both
<DraggableCore>and<Draggable>have had their callback types changed and unified.
type DraggableEventHandler = (e: Event, data: DraggableData) => void | false;
type DraggableData = {
node: HTMLElement,
// lastX + deltaX === x
x: number, y: number,
deltaX: number, deltaY: number,
lastX: number, lastY: number
};- The
startoption has been renamed todefaultPosition. - The
zIndexoption has been removed.
Possibly Breaking Changes:
- When determining deltas, we now use a new method that checks the delta against the Draggable's
offsetParent.
This method allows us to support arbitrary nested scrollable ancestors without scroll handlers!- This may cause issues in certain layouts. If you find one, please open an issue.
Enhancements:
<Draggable>now has apositionattribute. Its relationship todefaultPositionis much like
valuetodefaultValueon React<input>nodes. If set, the position is fixed and cannot be mutated.
If empty, the component will manage its own state. See #140
for more info & motivations.- Misc. bugfixes.