I would like to see some highlight when the button is pressed, but is not there. I need to press for minimum 1 second to see the highlight on the button. What's wrong here ?
This is ContactsView:
ZStack {
Color.backgroundColor.ignoresSafeArea()
VStack(spacing: .zero) {
HStack {
Image(uiImage: UIImage(data: contactImage ?? Data()) ?? UIImage())
.resizable()
.scaledToFill()
.frame(width: 50, height: 50)
.clipShape(Circle())
.overlay(Circle().stroke(Color.white, lineWidth: 4)) //
.padding(.leading, .large)
Text(contactName ?? "")
.foregroundStyle(.white)
.fontWeight(.heavy)
Spacer()
Button {
print("Share code")
} label: {
Text("Add friend")
.padding(.medium)
.background(Color.white)
.cornerRadius(16)
.padding(.horizontal, .large)
.foregroundColor(.black)
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}
This is how is used:
ScrollView {
ForEach(viewModel.getContacts, id: \.id) { contact in
VStack(spacing: .zero) {
ContactsView(contactImage: contact.thumbnail ?? Data() , contactName: contact.fullName ?? "")
}
.padding(.vertical, .large)
}
}