commit 20505236ae5b1afefb5cdd27d9314242d0358acd
parent 094ac3413585cd8f5e5499dfe37c662530c2d133
Author: OlegAba <mail@olegaba.com>
Date: Wed, 8 Mar 2023 22:03:44 -0500
Fix tabbar sticking to keyboard
Diffstat:
2 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/damus/ContentView.swift b/damus/ContentView.swift
@@ -214,7 +214,6 @@ struct ContentView: View {
}
}
}
- .ignoresSafeArea(.keyboard)
}
var MaybeSearchView: some View {
@@ -257,49 +256,47 @@ struct ContentView: View {
VStack(alignment: .leading, spacing: 0) {
if let damus = self.damus_state {
NavigationView {
- ZStack {
- TabView { // Prevents navbar appearance change on scroll
- MainContent(damus: damus)
- .toolbar() {
- ToolbarItem(placement: .navigationBarLeading) {
- Button {
- isSideBarOpened.toggle()
- } label: {
- ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles)
- .opacity(isSideBarOpened ? 0 : 1)
- .animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
- }
- .disabled(isSideBarOpened)
+ TabView { // Prevents navbar appearance change on scroll
+ MainContent(damus: damus)
+ .toolbar() {
+ ToolbarItem(placement: .navigationBarLeading) {
+ Button {
+ isSideBarOpened.toggle()
+ } label: {
+ ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles)
+ .opacity(isSideBarOpened ? 0 : 1)
+ .animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
}
-
- ToolbarItem(placement: .navigationBarTrailing) {
- HStack(alignment: .center) {
- if home.signal.signal != home.signal.max_signal {
- NavigationLink(destination: RelayConfigView(state: damus_state!)) {
- Text("\(home.signal.signal)/\(home.signal.max_signal)", comment: "Fraction of how many of the user's relay servers that are operational.")
- .font(.callout)
- .foregroundColor(.gray)
- }
+ .disabled(isSideBarOpened)
+ }
+
+ ToolbarItem(placement: .navigationBarTrailing) {
+ HStack(alignment: .center) {
+ if home.signal.signal != home.signal.max_signal {
+ NavigationLink(destination: RelayConfigView(state: damus_state!)) {
+ Text("\(home.signal.signal)/\(home.signal.max_signal)", comment: "Fraction of how many of the user's relay servers that are operational.")
+ .font(.callout)
+ .foregroundColor(.gray)
}
-
- // maybe expand this to other timelines in the future
- if selected_timeline == .search {
- Button(action: {
- //isFilterVisible.toggle()
- self.active_sheet = .filter
- }) {
- // checklist, checklist.checked, lisdt.bullet, list.bullet.circle, line.3.horizontal.decrease..., line.3.horizontail.decrease
- Label(NSLocalizedString("Filter", comment: "Button label text for filtering relay servers."), systemImage: "line.3.horizontal.decrease")
- .foregroundColor(.gray)
- //.contentShape(Rectangle())
- }
+ }
+
+ // maybe expand this to other timelines in the future
+ if selected_timeline == .search {
+ Button(action: {
+ //isFilterVisible.toggle()
+ self.active_sheet = .filter
+ }) {
+ // checklist, checklist.checked, lisdt.bullet, list.bullet.circle, line.3.horizontal.decrease..., line.3.horizontail.decrease
+ Label(NSLocalizedString("Filter", comment: "Button label text for filtering relay servers."), systemImage: "line.3.horizontal.decrease")
+ .foregroundColor(.gray)
+ //.contentShape(Rectangle())
}
}
}
}
- }
- .tabViewStyle(.page(indexDisplayMode: .never))
+ }
}
+ .tabViewStyle(.page(indexDisplayMode: .never))
.overlay(
SideMenuView(damus_state: damus, isSidebarVisible: $isSideBarOpened.animation())
)
@@ -308,8 +305,10 @@ struct ContentView: View {
TabBar(new_events: $home.new_events, selected: $selected_timeline, isSidebarVisible: $isSideBarOpened, action: switch_timeline)
.padding([.bottom], 8)
+ .background(Color(uiColor: .systemBackground).ignoresSafeArea())
}
}
+ .ignoresSafeArea(.keyboard)
.onAppear() {
self.connect()
setup_notifications()
diff --git a/damus/Views/EditMetadataView.swift b/damus/Views/EditMetadataView.swift
@@ -206,7 +206,7 @@ struct EditMetadataView: View {
}
}
}
- .ignoresSafeArea()
+ .ignoresSafeArea(edges: .top)
}
}