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 cuts off .hud alert #64

Open
nouun opened this issue Mar 20, 2023 · 5 comments
Open

Popover cuts off .hud alert #64

nouun opened this issue Mar 20, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@nouun
Copy link
Contributor

nouun commented Mar 20, 2023

Describe the bug
Using .hud in a popover causes the top of it to be cut off.

To Reproduce

struct ContentView: View {
    @State var showPopover = false
    @State var showToast = false
    
    var body: some View {
        Button("Show Popover") {
            self.showPopover.toggle()
        }
        .popover(isPresented: self.$showPopover) {
            List {
                Button("Show Toast") {
                    self.showToast.toggle()
                }
            }
            .toast(isPresenting: self.$showToast) {
                AlertToast(displayMode: .hud, type: .regular, title: "Test")
            }
        }
    }
}

Expected behaviour
The toast to be visible.

Screenshots
image

@nouun nouun added the bug Something isn't working label Mar 20, 2023
@metedata
Copy link

metedata commented Jun 2, 2023

Same issue when using .hud on MacOS:
image

@ImTheSquid
Copy link

This is most likely due to an implementation decision to reference the device's full screen bounds when positioning the toast instead of the presented view's bounds, so it can't take into account anything like sheets or title bars. As far as I know, to fix this you'd need to use an anchor/root view to handle all toast requests, I may work on a PR for this if I get time or fork it off into a separate library.

@ImTheSquid
Copy link

Made it.

@XuWeinan123
Copy link

XuWeinan123 commented Aug 24, 2023

may be the same problem?
WX20230824-204951@2x
toast overlap the navigationTitle

@kaanselhep
Copy link

This is most likely due to an implementation decision to reference the device's full screen bounds when positioning the toast instead of the presented view's bounds, so it can't take into account anything like sheets or title bars. As far as I know, to fix this you'd need to use an anchor/root view to handle all toast requests, I may work on a PR for this if I get time or fork it off into a separate library.

Hi, I checked out your package to test out if the sheet issue is fixed (AlertToast not completely visible when the view is shown as a sheet) but when I added the .toast modifier on the NavigationStack, it doesn't display it at all.
Were you able to fix it? Am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants