Search code examples
swiftuivstackswiftui-view

Showing a view within a VStack causes other views within VStack to resize


I have a VStack of views which serve to act as a list of expanding rows. As you tap on any row, it expands to show further details. So long as I only have one row "expanded" at a time, everything works properly. However, if I "expand" 2 rows, then some text gets resized on the top row. I cannot understand what the relationship between the two rows are as there are no fixed frame heights anywhere in my view hierarchy.

What are some things to look for that could cause this connection?

With one row open: Note the 'Few Showers' text being full height and displaying properly.

With two rows open: Note the 'Few Showers' text has now shrunk in height along with some padding seeming to be reduced.


Solution

  • This was resolved by adding a .fixedSize(width: false, height: true) to the top section of the row.