Swiftui Navigation bar showing for a second before disappear after back button click

Viewed 217

When I click on navigation bar back button, navigation bar is still visible for a second before hiding. How should I do to hide it directly ?(You may click on the GIF below to see what I am facing).

Gif Demo

I come from this view (back button is here).

I replaced parts of code by "..." to make it lighter for my question.

struct GroupeDetailsView: View {
    let objGroupe : Groupe
    @EnvironmentObject var objCourse : CourseActuelle
    @EnvironmentObject var listActuelle : ListActuelle
       
    var body: some View {
        Form {...}
        .navigationTitle(objGroupe.nomGroupe)
        .navigationBarTitleDisplayMode(.inline)
        .navigationBarItems(trailing: HStack {...} )

I go here (back button direction)

struct GroupeGeneralView: View { 
    @EnvironmentObject var objCourse : CourseActuelle
    @State var groupeManager : GroupeManager
    var flexibleLayout = [GridItem(.flexible()),GridItem(.flexible()), GridItem(.flexible())]
    var body: some View {
        ScrollView{
            LazyVGrid(columns: flexibleLayout){   
            ForEach(0 ..< groupeManager.groupeList.count, id:\.self) { gr in
                BtComponentView(objGroupe: groupeManager.groupeList[gr], num: gr)
            }    
        }
            .onAppear(perform: {
                groupeManager = GroupeManager(courseId: objCourse.id!)
            })
    }.navigationBarHidden(true)
}
}
0 Answers
Related