Searching disables the filters (#2530)

This commit is contained in:
Mauro
2024-03-06 11:02:30 +01:00
committed by GitHub
parent 7f3451216d
commit 7754b9b8dc
18 changed files with 84 additions and 74 deletions
@@ -58,7 +58,7 @@ struct EmojiPickerScreen: View {
.navigationTitle(L10n.commonReactions)
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.modifier(IsSearching(isSearching: $isSearching))
.isSearching($isSearching)
.searchable(text: $searchString, placement: .navigationBarDrawer(displayMode: .always))
.compoundSearchField()
}
@@ -87,17 +87,6 @@ struct EmojiPickerScreen: View {
}
}
/// A view modifier to extract whether the search field is focussed from a subview.
private struct IsSearching: ViewModifier {
@Environment(\.isSearching) private var isSearchFieldFocused
@Binding var isSearching: Bool
func body(content: Content) -> some View {
content
.onChange(of: isSearchFieldFocused) { isSearching = $0 }
}
}
// MARK: - Previews
struct EmojiPickerScreen_Previews: PreviewProvider, TestablePreview {