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 doesn't position properly #74

Open
rampatra opened this issue Mar 4, 2023 · 2 comments
Open

Popover doesn't position properly #74

rampatra opened this issue Mar 4, 2023 · 2 comments

Comments

@rampatra
Copy link

rampatra commented Mar 4, 2023

CleanShot 2023-03-04 at 19 13 58@2x

In the picture attached, I have attached the popover to the last box in the grid and still the popover opens up a bit left of the source view and not directly under it. In other words, I want to get rid of the space shown by the arrow in the screenshot. Any ideas?

This is the code I am using:

.popover(present: $popoverShown) {
    VStack {
        Text("This is a pretty standard-looking popover with an arrow.")
            .foregroundColor(.primary)
            .onTapGesture {
                print("ok")
            }
    }
    .padding()
    .background(.background)
    .cornerRadius(12)
    .shadow(radius: 1)
    .frame(maxWidth: 150)
}
@lmbcosta
Copy link

lmbcosta commented Jun 8, 2023

.popover(present: $popoverShown) {
    $0.position = .absolute(
        originAnchor: .bottomRight,
        popoverAnchor: .topRight
    )
} view: { SomeView() }  }

@rampatra
Copy link
Author

rampatra commented Jun 8, 2023

@lmbcosta surprisingly this adds even more space. I did try this too. Removing the frame modifier makes it slightly better.

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