Skip to content

dragAndDrop ​

Press an element or point and drag it to another element or point.

The dragAndDrop command presses on a source, holds, and drags to a destination. Use it to reorder list items or move a draggable item onto a drop zone.

Parameters ​

ParameterTypeDescription
fromMapRequired. What to pick up: a selector, a point, or a selector plus a point inside it.
toMapRequired. Where to drop it, in the same form.
holdDurationIntegerMilliseconds to press before moving. Defaults to 1000. Reorder UIs lift the item only after a long press.
durationIntegerMilliseconds the movement takes. Defaults to 1000. Moving too fast can skip drop zones.

A point is "x, y" in absolute pixels or percent. Without a selector it is relative to the screen. With a selector it is relative to the element.

Usage examples ​

Drag one element onto another:

yaml
- dragAndDrop:
    from:
      text: "Item A"
    to:
      text: "Item C"

Drag between two screen points:

yaml
- dragAndDrop:
    from:
      point: "50%, 30%"
    to:
      point: "50%, 70%"
    duration: 1500

Platform behavior ​

  • iOS: uses holdDuration for the long press. duration is not used.
  • Android: runs the system input draganddrop command, which needs Android 12 or later. The long press time is fixed by the system, so a longer holdDuration has no effect. duration sets the movement time.