I have a TextField
with numerical input:
TextField("Amount", text: amountRaw).keyboardType(.numberPad)
The only way I see how to dismiss this field is to move focus into a non-numeric field and then hit enter on that field. This is not ideal.
Isn’t there a way to enable a dismiss keyboard button or something?
I’ve found people suggesting solutions like implementing click-outside to dismiss keyboard, but that’s not really what I want since I want click into other text fields to work.
2
Answers
Make sure your text field is inside a
ScrollView
or aForm
or aList
, and adorn that container with.scrollDismissesKeyboard(.interactively)
. This allows a swipe or drag downward to dismiss the keyboard.You can use the power of
@FocusState