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

how to dismiss popover when parent view will disappear #93

Open
AngelDev0329 opened this issue Jun 25, 2023 · 3 comments
Open

how to dismiss popover when parent view will disappear #93

AngelDev0329 opened this issue Jun 25, 2023 · 3 comments

Comments

@AngelDev0329
Copy link

I am using popover in swiftUI project.
When I pop the paged attached popover, showed popover doesn't disappear.

How can I dismiss showed popover?

@massimilianochiodi
Copy link

I have same issue

@aehlke
Copy link
Contributor

aehlke commented Jan 22, 2024

Ever find a solution to this?

@aehlke
Copy link
Contributor

aehlke commented Jan 22, 2024

I wonder if this commit in a fork can help resolve this by retaining access to the hosting container: main...chariotsolutions:Popovers:preserve-popover-host#diff-e2a643bfa30cc7d3b75f535698c31a998c099a263a60db12da9ee43c55df1ac6 cc @aheze

Could this perhaps be used to force the popover closed inside .onDisappear on the parent view ?

edit: I now see that this change is included in this PR: #73

edit: Success! I used that PR plus some other changes to make properties public to retain presentedPopoverContainer in my SwiftUI view that uses popover, then I can dismiss it in onDisappear. Yay. Messy code but maybe there's a way to resolve this within the library itself.

edit: The #73 PR is likely irrelevant to my fix, which just requires exposing presentedPopoverContainer as public and capturing it in a PopoverReader. A better solution would be to solve this inside Popovers itself.

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

3 participants