removed Type/type added layoutSubViews to deal with cornerRadius logic.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-02-14 10:48:44 -06:00
parent 3b6e8948bb
commit e15a4321b3

View File

@ -58,11 +58,6 @@ open class Notification: View {
case vertical, horizontal
}
/// Enum used to describe the type of the Notification.
public enum `Type`: String, CaseIterable {
case fullBleed, inLine
}
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
@ -177,9 +172,6 @@ open class Notification: View {
/// Add this attribute determine your type of Notification.
open var style: Style = .info { didSet { setNeedsUpdate()}}
/// If true, will hide the close button.
open var type: Type = .inLine { didSet { setNeedsUpdate()} }
private var _layout: Layout = .vertical
@ -333,7 +325,6 @@ open class Notification: View {
open override func updateView() {
super.updateView()
layer.cornerRadius = type == .fullBleed ? 0 : 4.0
backgroundColor = backgroundColorConfiguration.getColor(self)
updateIcons()
updateLabels()
@ -341,6 +332,12 @@ open class Notification: View {
setConstraints()
}
/// Override to check the screen width to determine cornerRadius
open override func layoutSubviews() {
super.layoutSubviews()
layer.cornerRadius = UIScreen.main.bounds.width == bounds.width ? 0 : 4.0
}
//--------------------------------------------------
// MARK: - Private Methods
//--------------------------------------------------