0

I'll keep it quick. I have a view which leads to a detailView via navigationLink and displays the following screen:

enter image description here

I wanted to hide the navigation back button when the user makes a tap gesture and bring it back when they make a swipe down gesture I was able to do that. However, I don't know how to hide that top grey area. When I use .ignoresSafeArea or even .navigationbarhidden the top doesn't go away: enter image description here

Do you know if the ignoresafearea is applied to views called by navigation link? Would appreciate any input.

Code:

var body : Some View{

  ZStack {

   
        TextEditor(text: $newNote)
       .ignoresSafeArea()

}.navigationBarHidden(true)

.onTapGesture {
            self.navigationBarBackButtonHidden = true
            self.navigationBarHidden = true
                }

.gesture(DragGesture(minimumDistance: 20, coordinateSpace: .global)
            .onEnded({ value in
                if value.translation.width < 0 {
                    // left
                }
                
                if value.translation.width > 0 {
                    hideKeyboard()
                    self.navigationBarBackButtonHidden = false
                    self.navigationBarHidden = false
                }
                if value.translation.height < 0 {
                    
                }
                
                if value.translation.height > 0 {
                    hideKeyboard()
                    self.navigationBarBackButtonHidden = false
                    self.navigationBarHidden = false
                }
            }

.onAppear{ .navigationBarHidden(navigationBarHidden)
           .navigationBarBackButtonHidden(navigationBarBackButtonHidden)}
Asperi
  • 228,894
  • 20
  • 464
  • 690
alex
  • 118
  • 1
  • 6
  • Next should be helpful https://stackoverflow.com/a/61686561/12299030 – Asperi Jul 02 '22 at 16:28
  • Wait hold one, so you're saying I'll have to add the navigationbarhidden tag to my parent view where the navigationlink is prompted from? – alex Jul 02 '22 at 16:30
  • @Asperi Okay so this is partially working. Like when I call a function that's supposed to hide navigation view, it does indeed hide the navigation view but I don't see that change in effect until I go back to parent view and come to the navigation link again. Any clue why that would happen? – alex Jul 02 '22 at 17:57

0 Answers0