Fix button interactions

This commit is contained in:
Ali
2022-07-06 14:25:48 +02:00
parent d4f4e10761
commit 2377d3e08c
2 changed files with 6 additions and 2 deletions

View File

@@ -109,8 +109,11 @@ public final class ComponentHostView<EnvironmentType>: UIView {
if self.alpha.isZero {
return nil
}
if !self.isUserInteractionEnabled {
return nil
}
for view in self.subviews.reversed() {
if let result = view.hitTest(self.convert(point, to: view), with: event), result.isUserInteractionEnabled {
if view.isUserInteractionEnabled, view.alpha != 0.0, let result = view.hitTest(self.convert(point, to: view), with: event) {
return result
}
}

View File

@@ -48,7 +48,6 @@ public final class AudioTranscriptionButtonComponent: Component {
override init(frame: CGRect) {
self.backgroundLayer = SimpleLayer()
self.animationView = ComponentHostView<Empty>()
self.animationView.isUserInteractionEnabled = false
super.init(frame: frame)
@@ -56,6 +55,8 @@ public final class AudioTranscriptionButtonComponent: Component {
self.backgroundLayer.cornerRadius = 10.0
self.layer.addSublayer(self.backgroundLayer)
self.animationView.isUserInteractionEnabled = false
self.addSubview(self.animationView)
self.addTarget(self, action: #selector(self.pressed), for: .touchUpInside)