mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:06:00 +00:00
Searching disables the filters (#2530)
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
import SwiftUI
|
||||
import SwiftUIIntrospect
|
||||
|
||||
// MARK: - Search Controller Extensions
|
||||
|
||||
extension View {
|
||||
/// A custom replacement for searchable that allows more precise configuration of the underlying search controller.
|
||||
///
|
||||
@@ -169,3 +171,21 @@ private struct SearchController: UIViewControllerRepresentable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Searchable Extensions
|
||||
|
||||
struct IsSearchingModifier: ViewModifier {
|
||||
@Environment(\.isSearching) private var isSearchingEnv
|
||||
@Binding var isSearching: Bool
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.onChange(of: isSearchingEnv) { isSearching = $0 }
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func isSearching(_ isSearching: Binding<Bool>) -> some View {
|
||||
modifier(IsSearchingModifier(isSearching: isSearching))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user