Skip to content

Commit

Permalink
Return correct size when SwiftUI proposes nil size
Browse files Browse the repository at this point in the history
  • Loading branch information
tevelee committed Jul 8, 2024
1 parent c8fec23 commit 733c317
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Flow/Internal/Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct FlowLayout {
let breakpoints = lineBreaker.wrapItemsToLines(
sizes: sizes.map(\.breadth),
spacings: spacings,
in: proposedSize.replacingUnspecifiedDimensions().value(on: axis)
in: proposedSize.replacingUnspecifiedDimensions(by: .infinity).value(on: axis)
)

var lines: Lines = []
Expand Down
7 changes: 7 additions & 0 deletions Sources/Flow/Internal/Size.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ extension CGSize: FixedOrientation2DCoordinate {
case .vertical: height
}
}

static var infinity: CGSize {
CGSize(
width: CGFloat.infinity,
height: CGFloat.infinity
)
}
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *)
Expand Down

0 comments on commit 733c317

Please sign in to comment.