Skip to content

Status bar change to light content after Toast dismissed #39

@thomas-gogox

Description

@thomas-gogox

Pre-requisites:

  • Yes, I looked through both open and closed issues looking for what I needed.
  • No, I did not find what I was looking for.

Expected Behavior

The status bar color scheme should not be changed after toast dismissed

Current Behavior

The status bar is in dark content when the app is running on dark mode with a light background.
When the toast is shown, the status bar changes to light content

Steps to Reproduce

Simulator.Screen.Recording.-.iPhone.XR.-.2024-08-12.at.15.22.52.mp4
struct TestView: View {
    @State private var isLoading: Bool = false
    var body: some View {
        VStack {
            Button {
                isLoading = true
            } label: {
                Text("Hello World")
                    .padding()
            }
        }
        .toast(isPresented: $isLoading, dismissAfter: 2) {
            ToastView("Loading").toastViewStyle(.indeterminate)
        }
        .frame(
            minWidth: 0,
            maxWidth: .infinity,
            minHeight: 0,
            maxHeight: .infinity,
            alignment: .topLeading
        )
        .background(Color.white.ignoresSafeArea())
        .preferredColorScheme(.dark)
    }
}

Context

I want to keep the status bar color scheme after toast was dismissed.

Your Environment

  • Swift Version: 5
  • Xcode Version: 15.3
  • Operating System Version: 14.3.1
  • Device or Simulator: iOS 16 (dark mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions