Я попробовал эти три решения, и ни одно из них мне не помогло. Я по-прежнему не могу коснуться TextField, если коснусь любого места добавленного мною дополнительного заполнения.
Решение 1:
Код: Выделить всё
TextField("Email address", text: $emailAddress)
.padding(.vertical, 16) // increases tap area
.padding(.horizontal, 12)
.background(
RoundedRectangle(cornerRadius: 12)
.fill(Color(.secondarySystemBackground))
)
Код: Выделить всё
HStack {
TextField("Email address", text: $emailAddress)
.textInputAutocapitalization(.never)
.keyboardType(.emailAddress)
}
.padding()
.frame(height: 56) // sets height of wrapper, not TextField
.background(Color(.secondarySystemBackground))
.cornerRadius(12)
Код: Выделить всё
TextField("Email", text: $emailAddress)
.padding()
.frame(height: 56)
.background(Color(.secondarySystemBackground))
.cornerRadius(10)
.contentShape(Rectangle()) // ensures the whole area is tappable
Подробнее здесь: https://stackoverflow.com/questions/798 ... -textfield
Мобильная версия