mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fix search screen preview tests and add snapshots
This commit is contained in:
@@ -74,7 +74,7 @@ struct SearchScreen: View {
|
||||
}
|
||||
.frame(maxHeight: .infinity, alignment: .top)
|
||||
.background(Color.compound.bgCanvasDefault)
|
||||
.searchable(text: $context.searchQuery, placement: .toolbarPrincipal)
|
||||
.conditionalSearchable(searchQuery: $context.searchQuery)
|
||||
.searchFocused($isSearchFieldFocused)
|
||||
.autocorrectionDisabled(true)
|
||||
.background(tabShortcuts)
|
||||
@@ -213,6 +213,17 @@ struct SearchScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
/// Searchable makes the preview contents randomly appear lower
|
||||
@ViewBuilder func conditionalSearchable(searchQuery: Binding<String>) -> some View {
|
||||
if !ProcessInfo.isXcodePreview, !ProcessInfo.isRunningTests {
|
||||
searchable(text: searchQuery, placement: .toolbarPrincipal)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct SearchScreenRoomCell: View {
|
||||
let room: SearchScreenRoom
|
||||
let context: SearchScreenViewModel.Context
|
||||
|
||||
Reference in New Issue
Block a user