Skip to content

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

@Notsfsssf

Description

@Notsfsssf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions