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

PartialSheet auto close when openURL in sheet content with @Environment(\.scenePhase) #162

Open
Notsfsssf opened this issue Jul 15, 2022 · 0 comments

Comments

@Notsfsssf
Copy link

When I add @Environment(\.scenePhase) var scenePhase,partialSheet will auto close and never show again

import SwiftUI
import PartialSheet

@main
struct nnonoApp: App {
    @State private var isPresented = false
    @Environment(\.openURL) private var openURL
    @Environment(\.scenePhase) var scenePhase // <-
    
    var body: some Scene {
        WindowGroup {
            ZStack {
                Rectangle().onTapGesture {
                    isPresented = true
                }.partialSheet(isPresented: $isPresented) {
                    Button {
                        openURL(URL(string: "https://github.com")!)
                    } label: {
                        Label("Get Help", systemImage: "person.fill.questionmark")
                    }
                    
                }
            }.attachPartialSheetToRoot()
        }
    }
}
out1.mp4
vfn added a commit to vfn/PartialSheet that referenced this issue Jan 23, 2023
Example issue that would trigger the recreation of the manager and loss of state when the app goes to background and back to the foreground.

AndreaMiotto#162
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

1 participant