Popovers icon indicating copy to clipboard operation
Popovers copied to clipboard

Popover assumes the maxWidth or maxHeight value as the size of the popover, if it was defined with .frame(maxWidth, maxHeight)

Open JohnKuan opened this issue 1 year ago • 1 comments

I have a case where the popover is to be bound within a certain size.

For example:

Templates.Container(...
   VStack {
      Text()
   }
   .frame(maxWidth: 250)
)
  1. In this case, regardless of whether the subviews of the VStack did not fill up the maxWidth space, the popover frame is define to be 250 in width (+attribute.padding)

However if I do not define the maxWidth, it will be fine for the case of elements smaller than maxWidth, but it poses a problem for those with longer than maxWidth as it takes up as much space.

  1. I also have another case where a popover is scrollable, and this is in relation to this as well, that because the content in the stack can vary, it is likely to be wrapped in a ScrollView, but a scrollView defines the popover frame height to be a very long height (probably screenHeight - padding).
Templates.Container(...
   VStack {
      ScrollView {
         VStack {
            Text()
         }
      }
   }
   .frame(maxWidth: 250)
)

Simulator Screen Shot - iPhone 14 Pro - 2022-12-09 at 10 42 42

I could bound the height of the container, and that kinds of resolve the issue about scrollView, but the 1st issue is still of concern where the frame height still assumes the maxHeight of 250, regardless of the content.

Templates.Container(...
VStack {
      ScrollView {
         VStack {
            Text()
         }
      }
   }
   .frame(maxWidth: 250, maxHeight: 250)
)

JohnKuan avatar Dec 09 '22 02:12 JohnKuan