danielsaidi / SwiftUIKit

SwiftUIKit is a Swift SDK that adds extra functionality to Swift & SwiftUI.
MIT License
1.4k stars 54 forks source link

BlurView in background disables Buttons #1

Closed nidegen closed 2 years ago

nidegen commented 4 years ago

It seems that

ZStack {
  BlurView()
  Button()
}

makes Button not to work. Could it have sth to do with the implementation?

danielsaidi commented 4 years ago

Oh, good catch! I'll have a look 👍

nidegen commented 4 years ago

Seems not to be generally reproducible. Maybe its only when presented above a UIViewRepresentable.. Ill get back if I can isolate it

nidegen commented 4 years ago

here we go: the example code can toggle on an off the blur view, which enables or disables buttons. funnily, it works when the blur is not behind any spacers or Images in buttons

danielsaidi commented 4 years ago

Great, thanks! I will check and see if the blur does something unexpected with the view hierarchy. Or do you think it's a SwiftUI thing?

nidegen commented 4 years ago

Its inconsistent appearance hints to SwiftUI, but it never occurs when I use a Color view instead of BlurView for instance.

I have to admit that I do not expect it to be an easy fix.

Maybe it's the reason why there is no builtin blur in SwiftUI yet 😅

nidegen commented 4 years ago

OK, setting BlurView(style: .systemChromeMaterial).allowsHitTesting(false) helps. At least sometimes 😅🙈

danielsaidi commented 4 years ago

Omg...does it only happen in lists?

nidegen commented 4 years ago

I have only been testing in v, h, and zstacks

danielsaidi commented 2 years ago

I should probably deprecate the blur view, since we now have native SwiftUI materials instead. What do you think @nidegen ?

nidegen commented 2 years ago

Sure! I was using a code copy anyways and I think I switched to the native one now.