Hide the search mode picker until there's a query

The chats/messages picker has nothing to switch between before a query is
entered, so it only shows once the user starts searching.
This commit is contained in:
Stefan Ceriu
2026-09-10 17:24:03 +03:00
parent af202f3466
commit 9bff070648
5 changed files with 17 additions and 14 deletions
@@ -40,14 +40,17 @@ struct SearchScreen: View {
.padding(.horizontal, 16)
.padding(.vertical, 8)
Picker(L10n.actionSearch, selection: $context.searchMode) {
ForEach(SearchScreenMode.allCases) { mode in
Text(mode.title).tag(mode)
// There's nothing to switch between until the user searches for something.
if context.viewState.isSearching {
Picker(L10n.actionSearch, selection: $context.searchMode) {
ForEach(SearchScreenMode.allCases) { mode in
Text(mode.title).tag(mode)
}
}
.pickerStyle(.segmented)
.padding(.horizontal, 16)
.padding(.bottom, 8)
}
.pickerStyle(.segmented)
.padding(.horizontal, 16)
.padding(.bottom, 8)
switch context.viewState.bindings.searchMode {
case .rooms: