Fix build

This commit is contained in:
Ali
2022-11-17 01:38:41 +04:00
parent c36e158519
commit f9f194f04c
5 changed files with 59 additions and 1 deletions

View File

@@ -438,6 +438,10 @@ open class BlurredBackgroundView: UIView {
}
}
public protocol NavigationBarHeaderView: UIView {
func update(size: CGSize, transition: ContainedViewLayoutTransition)
}
open class NavigationBar: ASDisplayNode {
public static var defaultSecondaryContentHeight: CGFloat {
return 38.0
@@ -647,6 +651,18 @@ open class NavigationBar: ASDisplayNode {
}
}
public var customHeaderContentView: NavigationBarHeaderView? {
didSet {
if self.customHeaderContentView !== oldValue {
self.customHeaderContentView?.removeFromSuperview()
if let customHeaderContentView = self.customHeaderContentView {
self.view.addSubview(customHeaderContentView)
}
}
}
}
public var layoutSuspended: Bool = false
private let titleNode: ImmediateTextNode
@@ -1355,6 +1371,12 @@ open class NavigationBar: ASDisplayNode {
leftTitleInset -= 1.0
}
if let customHeaderContentView = self.customHeaderContentView {
let headerSize = CGSize(width: size.width, height: nominalHeight)
customHeaderContentView.update(size: headerSize, transition: transition)
transition.updateFrame(view: customHeaderContentView, frame: CGRect(origin: CGPoint(x: 0.0, y: contentVerticalOrigin), size: headerSize))
}
if self.titleNode.supernode != nil {
let titleSize = self.titleNode.updateLayout(CGSize(width: max(1.0, size.width - max(leftTitleInset, rightTitleInset) * 2.0), height: nominalHeight))