Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-11-20 23:37:24 +04:00
parent 96629b3d37
commit 26b0b4021c
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import UIKit
import AsyncDisplayKit
import SwiftSignalKit
private let containerInsets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0)
@ -59,6 +60,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.bottomDimView.isUserInteractionEnabled = false
self.itemGroupsContainerNode = ActionSheetItemGroupsContainerNode(theme: self.theme)
self.itemGroupsContainerNode.isUserInteractionEnabled = false
super.init()
@ -128,6 +130,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.updateScrollDimViews(size: layout.size, insets: insets, transition: transition)
}
func animateIn(completion: @escaping () -> Void) {
let tempDimView = UIView()
tempDimView.backgroundColor = self.theme.dimColor
@ -144,6 +147,10 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate {
tempDimView?.removeFromSuperview()
completion()
})
Queue.mainQueue().after(0.3, {
self.itemGroupsContainerNode.isUserInteractionEnabled = true
})
}
func animateOut(cancelled: Bool) {
@ -170,7 +177,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate {
}
@objc func dimNodeTap(_ recognizer: UITapGestureRecognizer) {
if case .ended = recognizer.state {
if case .ended = recognizer.state, self.itemGroupsContainerNode.isUserInteractionEnabled {
self.view.window?.endEditing(true)
self.animateOut(cancelled: true)
}

View File

@ -84,6 +84,9 @@ final class ActionSheetItemGroupsContainerNode: ASDisplayNode {
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard self.isUserInteractionEnabled else {
return nil
}
for groupNode in self.groupNodes {
if groupNode.frame.contains(point) {
return groupNode.hitTest(self.convert(point, to: groupNode), with: event)