I'll keep it quick. I have a view which leads to a detailView via navigationLink and displays the following screen:
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:
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)}