FB17642828: Unexpected behaviour of iOS software keyboard return key in TextField with axis: .vertical which renders SwiftUI.VerticalTextView a UITextView subclass
Submission Date
2025-05-18
Status
Open
Area
SwiftUI
Operating System Version
iOS 18.5
Type
Incorrect/Unexpected Behavior
Description
I needed line wrap with TextField, not multiline input. Just when 1 long line of text is entered I want to see it all and not truncate, i.e. have the field expand vertically.
When I use TextField with axis: .vertical I have a problem with the iOS software keyboard e.g. iPhone Simulator if I press return on that then it adds a new line. However if I press return on my Mac's hardware keyboard it submits the field as expected. I would like the iPhone software keyboard to submit the field the same as the mac's keyboard thanks. If I wanted newlines to be entered then I would be using TextEditor not TextField. I am only after the line wrapping functionality so that when a long line of text is entered it will wrap and it can expand vertically.
I also tested a physical iPhone 16 pro 18.5 and has the same issue as the sim
Xcode Version 16.4 (16F6) simulator 18.5
TextField("Enter Text",
text: $text,
prompt: Text(title).foregroundStyle(isFocused ? AnyShapeStyle(.foreground) : AnyShapeStyle(.tint)),
axis: .vertical
)
.submitLabel(.done)
screen cap attached. the done button should submit not add new lines
Keywords
No response
Prerequisites
- [x] The title follows the format
FB<number>: <title> - [x] I will keep this issue updated with Apple's responses