ios: show clear search button when search is not empty (#3627)

This commit is contained in:
Evgeny Poberezkin 2023-12-30 14:09:07 +00:00 committed by GitHub
parent 644169b835
commit 4ab078bd18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -289,16 +289,16 @@ struct ChatListSearchBar: View {
HStack(spacing: 4) { HStack(spacing: 4) {
Image(systemName: "magnifyingglass") Image(systemName: "magnifyingglass")
TextField("Search or paste SimpleX link", text: $searchText) TextField("Search or paste SimpleX link", text: $searchText)
.foregroundColor(searchShowingSimplexLink ? .secondary : .primary)
.disabled(searchShowingSimplexLink) .disabled(searchShowingSimplexLink)
.focused($searchFocussed) .focused($searchFocussed)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
if searchFocussed || searchShowingSimplexLink { if !searchText.isEmpty {
Image(systemName: "xmark.circle.fill") Image(systemName: "xmark.circle.fill")
.opacity(searchText == "" ? 0 : 1)
.onTapGesture { .onTapGesture {
searchText = "" searchText = ""
} }
} else if searchText == "" { } else if !searchFocussed {
HStack(spacing: 24) { HStack(spacing: 24) {
if m.pasteboardHasStrings { if m.pasteboardHasStrings {
Image(systemName: "doc") Image(systemName: "doc")