Is there a way to be selective about what entails .onDisappear? E.g. not involve scrolling?
// The navigation bar hiding is being done like so
struct UserProfileView: View {
var body: some View {
@Published var hideBar = true
NavigationView {
ZStack {
List {
Section(header: Text(NSLocalizedString("My Routes", comment: ""))) {
MyRoutesSectionView(hideBar: self.$hideBar, selectedView: self.$selectedView)
}
}
VStack {
}
}
.navigationTitle("")
.navigationBarHidden(self.hideBar)
}
}
}
struct MyRoutesSectionView: View {
var body: some View {
@Binding var hideBar = true
NavigationLink(destination: modifiedView, tag: tag, selection: self.$selectedView) {
MyRoutesNavigationLinkView(myRoutesObject: object)
}.onDisappear {
if #available(iOS 14, *) {
// redundant --- just have it here to make it clear
// the actual problem being --- navbar is hidden in detail on iOS 13.5
self.hideBar = true
} else {
// this will not hide the navbar in the detail view but upon scrolling
// the `UserProfileView` . . . when the section disappears . . . navbar would appear
self.hideBar = false
}
}
}
}