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

NavigationStack toolbar not displaying on sheet #70

Open
onelettershor2 opened this issue Dec 30, 2024 · 1 comment
Open

NavigationStack toolbar not displaying on sheet #70

onelettershor2 opened this issue Dec 30, 2024 · 1 comment

Comments

@onelettershor2
Copy link

I have a sheet that is displayed ontop of another sheet in a SwiftUI view and the the top most sheet view is inside of a NavigationStack. Pre iOS 18 everything worked fine, but now the toolbar content does not display on the top most sheet view controller. Everything else in the stack displays just fine. I found out that a NavigationView works in place of the stack, however that is deprecated after 18.2. Is it possible this is a bug or am I doing something incorrectly with the view hierarchy?

 /// Bottom sheet is already presented
Struct BottomSheetView {

    @State var activateBottomSheet = false

    var body: some View {
         NavigationStack {
             Button {
                 activateBottomSheet = true
             }, label: {
                    Image(systemName: "slider.horizontal.3")
                        .foregroundColor(Color("text"))
             }
             .viewExtensionForPresentationForIssue(isPresented: $showGraphs) {
                  /// This is the topmost view controller view that has a NavigationStack and a toolbar attached that doesn't display. It WOULD display pre iOS 18
                  TopMostView()
              }
         }
    }
}

extension View {
    func viewExtensionForPresentationForIssue<C: View>(isPresented: Binding<Bool>,
                                     @ViewBuilder content: @escaping () -> (C)) -> some View {
            return
                self.presentation(
                    transition: .sheet(
                        options: .init(detents: [.medium],
                        largestUndimmedDetentIdentifier: .medium)
                    ),
                    isPresented: isPresented
                ) {
                    content()
                }
    }
}
@nathantannar4
Copy link
Owner

Could you please share an example that reproduces, and which iOS version you're experiencing it on?

I was not able to repo on iOS 18.1 with this code

image

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

2 participants