Skip to content

Commit

Permalink
scalessec#93: Fix layout when title exists and message is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Scalesse committed Jan 6, 2024
1 parent 75897c8 commit a6c80e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Toast/Toast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ public extension UIView {
let longerWidth = max(titleRect.size.width, messageRect.size.width)
let longerX = max(titleRect.origin.x, messageRect.origin.x)
let wrapperWidth = max((imageRect.size.width + (style.horizontalPadding * 2.0)), (longerX + longerWidth + style.horizontalPadding))
let wrapperHeight = max((messageRect.origin.y + messageRect.size.height + style.verticalPadding), (imageRect.size.height + (style.verticalPadding * 2.0)))

let textMaxY = messageRect.size.height <= 0.0 && titleRect.size.height > 0.0 ? titleRect.maxY : messageRect.maxY
let wrapperHeight = max((textMaxY + style.verticalPadding), (imageRect.size.height + (style.verticalPadding * 2.0)))

wrapperView.frame = CGRect(x: 0.0, y: 0.0, width: wrapperWidth, height: wrapperHeight)

Expand Down

0 comments on commit a6c80e7

Please sign in to comment.