mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Fix room list search bar focus glitches (#2112)
* Fixes #2112 - Room list search bar focus glitches * Address PR comments
This commit is contained in:
@@ -22,10 +22,20 @@ struct HomeScreenRoomList: View {
|
||||
@ObservedObject var context: HomeScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
content
|
||||
filteredContent
|
||||
.onChange(of: isSearchFieldFocused) { context.isSearchFieldFocused = $0 }
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var filteredContent: some View {
|
||||
// Hide the room list when the search bar is focused but the query is empty
|
||||
// This works hand in hand with the room list service layer filtering and
|
||||
// avoids glitches when focusing the search bar
|
||||
if !context.viewState.shouldHideRoomList {
|
||||
content
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
ForEach(context.viewState.visibleRooms) { room in
|
||||
|
||||
Reference in New Issue
Block a user