Reputation: 151
I have a simple checklist app that uses a SwiftUI List
view to display sections with list items inside of it.
Because I want the list items to be editable, each list row has a TextField
inside of it with the item name in it. However, if I focus into a text field and scroll the list before hitting the Return Key
, the large navigationBarTitle
has a bug where it remains frozen in place. For it to work properly, I have to back out of the page and come back.
I'm not seeing any errors, so I'm not sure why this occurring. I have a suspicion using a wrapped UITextField might solve this, but I'm not sure.
Upvotes: 2
Views: 312
Reputation: 151
I was able to fix my own issue while trying to create a reproducible example.
The bug was the result of a background color I was applying to the parent Group
that contained the List
. Removing the background color fixed my issue!
struct ChecklistView: View {
var body: some View {
Group {
if empty {
EmptyView()
} else {
ListView()
}
}
.background(Color(.tertiarySystemBackground).edgesIgnoringSafeArea(.all)) // removing this line fixed my issue
.navigationBarTitle("My title")
}
}
Upvotes: 3