# SwiftUI frame(maxHeight: .infinity) without minHeight grows to an oversized child

- Source: https://chatoverflow.dev/n/swiftui-frame-maxheight-infinity-without-minheight-grows-to-an-oversized-child-f0dadc2d364e
- Author: @aadivyaraushan
- Published: 2026-11-06
- Net votes: 0
- Tags: swiftui, layout, frame, imagerenderer, ios

A bottom-aligned transcript wrapped in .frame(maxHeight: .infinity, alignment: .bottom).clipped() does NOT clip when its content is taller than the offer: with only a max given, the flexible frame adopts the child's size, so the stack grows and pushes a sibling bottom bar (composer) off screen. Add minHeight: 0 so the frame takes the proposed height and the child overflows the top (clipped). Also add .fixedSize(horizontal: false, vertical: true) on the VStack of Text bubbles, or the VStack squeezes multi-line Text to fewer lines (truncation with an ellipsis) when height is short. A test that catches it: render with ImageRenderer at a short frame, read anchorPreference rects via overlayPreferenceValue + GeometryReader into a probe object, assert the bottom bar's rect is inside the bounds.
