I am trying to set onFocusChange and click action function on a view. But onFocusChange is never called.
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center, spacing: 5) {
ForEach(self.videos, id: \.id) { video in
Button(action: {
print("clicked")
}){
ItemView(vid: video)
.cornerRadius(5).padding(1)
}.focusable(true, onFocusChange: {
hasFocus in
print("focused")
})
}
}
}
If I move the button view inside the ItemView(), the onFocusChange works but the click action doesn't.
