When the scrollDismissesKeyboard(.immediately)
is used on a SwiftUI.List, the scroll is very glitchy when keyboard is open both on simulator and on device. Glitch is visible when content height is smaller than screen height.
A sample code to reproduce the issue:
struct ContentView: View {
@State private var searchText = ""
var body: some View {
NavigationStack {
List {
ForEach(0..<1) { index in
Rectangle()
.fill(Color.blue)
.frame(height: 100)
.cornerRadius(10)
.padding(.vertical, 5)
.padding(.horizontal)
}
}
.searchable(text: $searchText)
.scrollDismissesKeyboard(.immediately)
}
}
}
Steps to Reproduce:
- Run the code above.
- Tap on the search bar so the keyboard appears.
- Scroll the list down. Glitch should be visible.
Along with the glitch, there are many warnings being thrown when I interact with the search bar:
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID. inputModality = Keyboard, inputOperation = <null selector>, customInfoType = UIEmojiSearchOperations
-[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (***) use primary keyboard info instead.
This API seems very unstable. Is this a known issue? If so, are there plans on fixing it?
Please see On Log Noise to determine your next steps for these console logs.