Post

Replies

Boosts

Views

Activity

How to prevent TextField from disappearing in SwiftUI List?
There's a nasty SwiftUI bug in which a TextField disappears if placed in a HStack within a List.List { ForEach(0...200, id: \.self) { index in HStack { Text("Text \(index)") TextField("Test", text: .constant("TextField \(index)")) } }}- Screenshot: https://i.stack.imgur.com/HARDF.png- Video: https://recordit.co/X12uGct7gDThis happens when TextField is placed within a HStack / VStack / ZStack / .overlay() / .background(). It does not happen when TextField is the only child of ForEach. I have filed a bug (FB7500885) but I'm looking for ideas from the community to work around it. Here is what I've tried so far:Setting an explicit .frame() on TextFieldSetting .fixedSized() on TextFieldUsing a UITextField wrapped in a UIViewConvertible, with or without layout constraintsIs there anything else I could try?
4
0
2.3k
Dec ’19