Problem with NavigationLink

I am making application where I use navigation link to navigate from bottom menu to other views, and there is a problem when I change view a few times because views start stacking and when I set navigationBarBackButtonHidden(false) I can see on left side a lot of back button. This generate big problem because after changing views I got warning Abnormal number of gesture recognizer dependencies: 100. System performance may be affected. Please investigate reducing gesture recognizers and/or their dependencies. And after some more changes everything from screen is pushed down back button. Is there any solution to close previous view from we came?

There is code:

// // BottomMenu.swift // SpaceManager // // Created by Kuba Kromomołowski on 04/05/2024. //

import SwiftUI import Firebase import FirebaseAuth

struct BottomMenu: View {

@StateObject var logManager = MainViewModel()
@StateObject var mvm = MenuViewModel()
@State var condition1: Bool = true
@State var condition2: Bool = false
@State var condition3: Bool = false

// @StateObject private var cameraViewModel = CameraViewModel() var body: some View { HStack{ Group{ //.navigationBarBackButtonHidden(true) Spacer() BtnMenu(btnText: "Dodaj", btnIcon: "plus.app.fill", destinationView:AnyView(LoggedMainView()), isActive: condition1

        )
        Spacer()
        BtnMenu(btnText: "Szukaj", 
                btnIcon: "magnifyingglass",
                destinationView:AnyView(SearchView()),
                isActive: condition2
        )
        Spacer()
        BtnMenu(btnText: "Profil", 
                btnIcon: "person.crop.circle.fill",
                destinationView:AnyView(ProfileView()),
                isActive: condition3
        )
        Spacer()
      
    }.padding(.bottom, 30)
        .font(.system(size: 20))
    }
}

}

#Preview { BottomMenu() } // // BtnMenu.swift // SpaceManager // // Created by Kuba Kromomołowski on 04/05/2024. //

import SwiftUI

struct BtnMenu: View { var btnText: String var btnIcon: String var destinationView: AnyView

@State var isActive: Bool = true
var body: some View {
    NavigationLink{
        
        destinationView
    }  label: {
        ZStack {
            Text("\(Image(systemName: btnIcon)) \(btnText)")
        }
    }.disabled(isActive)
   
}

}

Could you please update your post to ensure the example code is formatted correctly and can be run?

Problem with NavigationLink
 
 
Q