Fix tabbar sticking to keyboard

This commit is contained in:
OlegAba
2023-03-08 22:03:44 -05:00
committed by William Casarin
parent 094ac34135
commit 20505236ae
2 changed files with 37 additions and 38 deletions

View File

@@ -214,7 +214,6 @@ struct ContentView: View {
} }
} }
} }
.ignoresSafeArea(.keyboard)
} }
var MaybeSearchView: some View { var MaybeSearchView: some View {
@@ -257,49 +256,47 @@ struct ContentView: View {
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
if let damus = self.damus_state { if let damus = self.damus_state {
NavigationView { NavigationView {
ZStack { TabView { // Prevents navbar appearance change on scroll
TabView { // Prevents navbar appearance change on scroll MainContent(damus: damus)
MainContent(damus: damus) .toolbar() {
.toolbar() { ToolbarItem(placement: .navigationBarLeading) {
ToolbarItem(placement: .navigationBarLeading) { Button {
Button { isSideBarOpened.toggle()
isSideBarOpened.toggle() } label: {
} label: { ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles)
ProfilePicView(pubkey: damus_state!.pubkey, size: 32, highlight: .none, profiles: damus_state!.profiles) .opacity(isSideBarOpened ? 0 : 1)
.opacity(isSideBarOpened ? 0 : 1) .animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
.animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
}
.disabled(isSideBarOpened)
} }
.disabled(isSideBarOpened)
ToolbarItem(placement: .navigationBarTrailing) { }
HStack(alignment: .center) {
if home.signal.signal != home.signal.max_signal { ToolbarItem(placement: .navigationBarTrailing) {
NavigationLink(destination: RelayConfigView(state: damus_state!)) { HStack(alignment: .center) {
Text("\(home.signal.signal)/\(home.signal.max_signal)", comment: "Fraction of how many of the user's relay servers that are operational.") if home.signal.signal != home.signal.max_signal {
.font(.callout) NavigationLink(destination: RelayConfigView(state: damus_state!)) {
.foregroundColor(.gray) 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 { // maybe expand this to other timelines in the future
Button(action: { if selected_timeline == .search {
//isFilterVisible.toggle() Button(action: {
self.active_sheet = .filter //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") // checklist, checklist.checked, lisdt.bullet, list.bullet.circle, line.3.horizontal.decrease..., line.3.horizontail.decrease
.foregroundColor(.gray) Label(NSLocalizedString("Filter", comment: "Button label text for filtering relay servers."), systemImage: "line.3.horizontal.decrease")
//.contentShape(Rectangle()) .foregroundColor(.gray)
} //.contentShape(Rectangle())
} }
} }
} }
} }
} }
.tabViewStyle(.page(indexDisplayMode: .never))
} }
.tabViewStyle(.page(indexDisplayMode: .never))
.overlay( .overlay(
SideMenuView(damus_state: damus, isSidebarVisible: $isSideBarOpened.animation()) 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) TabBar(new_events: $home.new_events, selected: $selected_timeline, isSidebarVisible: $isSideBarOpened, action: switch_timeline)
.padding([.bottom], 8) .padding([.bottom], 8)
.background(Color(uiColor: .systemBackground).ignoresSafeArea())
} }
} }
.ignoresSafeArea(.keyboard)
.onAppear() { .onAppear() {
self.connect() self.connect()
setup_notifications() setup_notifications()

View File

@@ -206,7 +206,7 @@ struct EditMetadataView: View {
} }
} }
} }
.ignoresSafeArea() .ignoresSafeArea(edges: .top)
} }
} }