visionOS: Button Frame modifier bugged?

Hello! When trying to modify a Button's frame with visionOS as a target, the default button frame will always remain as a capsule. I would expect the "hover" behavior/background to fill the frame.

Anyone else? I will file feedback. Thanks!

Code:

struct HostCell: View {
    var body: some View {
        Button(action:{}, label: {
            Image(systemName: "plus")
        }).frame(width: 100, height: 100).background(.red)
    }
}

Result attached as an image

Accepted Reply

Hey! For anyone in the future, the solution to this is to add a buttonStyle modifier to the button :)

.buttonStyle(.plain)

  • That was it! Thank you so much.

Add a Comment

Replies

Unfortunately cannot edit anymore, but here's the result when I apply the modifiers on the label itself, even applying .clipShape(.rect) to the button, it stays a capsule:

struct HostCell: View {
    var body: some View {
        Button(action:  {print("Salut")}, label: {
            Image(systemName: "plus").frame(width: 200, height: 200).background(.red).cornerRadius(30).hoverEffect()
        })
    }
}

Result:

Hey! For anyone in the future, the solution to this is to add a buttonStyle modifier to the button :)

.buttonStyle(.plain)

  • That was it! Thank you so much.

Add a Comment