Skip to content

Push doesn't work if app is backgrounded and aware of scenePhase #73

@mustafaozhan

Description

@mustafaozhan

Hello 👋

I discovered a weird bug that nativation was not working after user,

  • open the app
  • background it
  • open again
  • then non of the progromatic push in entire project is not working
struct SliderView: View {
    @EnvironmentObject private var navigationStack: NavigationStack
    
    var body: some View {
    ...
			navigationStack.push(SomeView()) // not working
    ...
    }   
}

and I fix the bug by removing this @Environment(\.scenePhase) var scenePhase where NavigationStackView is located

struct MainView: View {

    @StateObject var observable: MainObservable = koin.get()

    @Environment(\.scenePhase) var scenePhase // this line is removed and bug is fixed

    var body: some View {

        NavigationStackView(
            transitionType: .default,
            easing: Animation.easeInOut(duration: 0.5)
        ) {
				....
        }
    }
}

I do not need any more scenePhase so it is not a blocker for me, but i thought it will be good to make you aware of this issue

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