-
Notifications
You must be signed in to change notification settings - Fork 116
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
Dismiss mode set to .none always stays on screen #45
Comments
Can't say it's intended, but would it be possible to do |
Tried that approach first. Didn't work for me. I'll put together a sample project to demonstrate, just in case it was a result of my complex layouts. I'll close the comment if I can't re-create. |
If you run this code and tap the back button the popover remains on screen. Is this intended? If not, I guess this is a bug. import SwiftUI
import Popovers
extension String: Identifiable {
public var id: String {
return self
}
}
struct ContentView: View {
@State var parks: [String] = ["Central", "Greenwich", "Thorpe"]
var body: some View {
NavigationStack {
List(parks) { park in
NavigationLink(park, value: park)
}
.navigationDestination(for: String.self) { park in
ChildView(parkName: park)
}
}
}
}
struct ChildView: View {
@State var parkName: String
@State var replyPresent = false
var body: some View {
VStack {
Text(parkName)
Button {
self.replyPresent = true
} label: {
Text("Show Popover")
}
}
.padding()
.popover(present: $replyPresent,
attributes: {
$0.dismissal.mode = .none
// $0.dismissal.mode = .dragUp
// $0.dismissal.mode = .dragDown
// $0.dismissal.mode = .tapOutside
}
) {
Text("My Popover")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
} |
I have same issue |
Anyone find a solution? |
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 Could this perhaps be used to force the popover closed inside .onDisappear on the parent view ? edit: I figured out a solution #93 (comment) |
When setting this mode, the popover will always stick around even when the presenting parent view disappears. Is this as intended?
The text was updated successfully, but these errors were encountered: