I have reorderable rows with an editable text views inside. To make rows reorderable I use the solution similar to this. What is important here, I add .onDrag modifier to the rows contents. The problem is, I want to disable dragging rows while keyboard is on screen and user edits the text. The solutions to this question here, like using if case, break the text editing: text loses its focus and keyboard does not appear.
if !isKeyboardVisible {
rowContent
.onDrag {
// prepare drag
return NSItemProvider()
}
} else {
rowContent
}
I would like to make something like this instead:
rowContent
.onDrag {
if !isKeyboardVisible {
// prepare drag
return NSItemProvider()
} else {
return nil
}
}
But it is not possible. If there are any solutions, I would appreciate your help.