Parameters
The action to perform during the drag gesture. Receives the current drag state.
Gesture configuration.
Adds a drag gesture recognizer to this view.
.onDragGesture(action: (state: DragGestureState) => void): Component;
.onDragGesture(props: { minimumDistance?: number }, action: (state: DragGestureState) => void): Component;
Show properties
Rectangle()
.fill(Color("blue"))
.onDragGesture((state) => {
console.log("Dragging:", state.translation)
})
Circle()
.fill(Color("red"))
.onDragGesture({ minimumDistance: 10 }, (state) => {
console.log("Drag started")
})
Text("Drag me")
.onDragGesture((state) => {
if (state.isEnded) {
console.log("Drag ended")
}
})