Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JohnKuan opened this issue Dec 9, 2022 · 1 comment

Comments

@JohnKuan
Copy link

JohnKuan commented Dec 9, 2022

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 JohnKuan changed the title Popover assumes the maxWidth or maxHeight value as the size of the popover Popover assumes the maxWidth or maxHeight value as the size of the popover, if it was defined with .frame(maxWidth, maxHeight) Dec 9, 2022
@Akazm
Copy link

Akazm commented Feb 26, 2023

I'm facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants