mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
#1098 - Various changes following code review.
This commit is contained in:
@@ -51,6 +51,7 @@ struct UserSuggestionList: View {
|
||||
.listStyle(PlainListStyle())
|
||||
.environment(\.defaultMinListRowHeight, rowHeight)
|
||||
.frame(height: min(maxHeight, rowHeight * CGFloat(viewModel.viewState.items.count)))
|
||||
// .frame(maxHeight: maxHeight)
|
||||
.id(UUID()) // Rebuild the whole list on item changes. Fixes performance issues.
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ private struct BackgroundView<Content: View>: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(content: content)
|
||||
content()
|
||||
.background(theme.colors.background)
|
||||
.clipShape(RoundedCornerShape(radius: shadowRadius, corners: [.topLeft, .topRight]))
|
||||
.shadow(color: .black.opacity(0.20), radius: 20.0, x: 0.0, y: 3.0)
|
||||
|
||||
@@ -36,7 +36,7 @@ struct UserSuggestionListItem: View {
|
||||
if let avatar = avatar {
|
||||
AvatarImage(avatarData: avatar, size: .medium)
|
||||
}
|
||||
VStack(alignment:.leading) {
|
||||
VStack(alignment: .leading) {
|
||||
Text(displayName ?? "")
|
||||
.font(theme.fonts.body)
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
|
||||
@@ -33,20 +33,18 @@ struct UserSuggestionListWithInput: View {
|
||||
|
||||
var viewModel: UserSuggestionListWithInputViewModel
|
||||
@State private var inputText: String = ""
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0.0) {
|
||||
UserSuggestionList(viewModel: viewModel.listViewModel.context)
|
||||
TextField("Search for user", text: $inputText)
|
||||
.background(Color.white)
|
||||
.onChange(of: inputText, perform: { value in
|
||||
viewModel.callback(value)
|
||||
})
|
||||
.border(Color.black)
|
||||
.onChange(of: inputText, perform:viewModel.callback)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.padding([.leading, .trailing])
|
||||
.onAppear(perform: {
|
||||
.onAppear {
|
||||
inputText = "@-" // Make the list show all available mock results
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user