Merge 'Fix padding for views for tabbar' from github/pr/2589

This commit is contained in:
William Casarin
2024-10-16 09:09:24 -07:00
7 changed files with 9 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import Combine
struct DMChatView: View, KeyboardReadable { struct DMChatView: View, KeyboardReadable {
let damus_state: DamusState let damus_state: DamusState
@FocusState private var isTextFieldFocused: Bool
@ObservedObject var dms: DirectMessageModel @ObservedObject var dms: DirectMessageModel
var pubkey: Pubkey { var pubkey: Pubkey {
@@ -46,6 +47,7 @@ struct DMChatView: View, KeyboardReadable {
} }
} }
} }
.padding(.bottom, isTextFieldFocused ? 0 : tabHeight)
} }
func scroll_to_end(_ scroller: ScrollViewProxy, animated: Bool = false) { func scroll_to_end(_ scroller: ScrollViewProxy, animated: Bool = false) {
@@ -74,6 +76,7 @@ struct DMChatView: View, KeyboardReadable {
.textEditorBackground { .textEditorBackground {
InputBackground() InputBackground()
} }
.focused($isTextFieldFocused)
.cornerRadius(8) .cornerRadius(8)
.background( .background(
RoundedRectangle(cornerRadius: 8) RoundedRectangle(cornerRadius: 8)

View File

@@ -35,6 +35,7 @@ struct DirectMessagesView: View {
} }
.padding(.horizontal) .padding(.horizontal)
} }
.padding(.bottom, tabHeight)
} }
func filter_dms(dms: [DirectMessageModel]) -> [DirectMessageModel] { func filter_dms(dms: [DirectMessageModel]) -> [DirectMessageModel] {

View File

@@ -203,7 +203,7 @@ struct EditMetadataView: View {
}) })
.buttonStyle(GradientButtonStyle(padding: 15)) .buttonStyle(GradientButtonStyle(padding: 15))
.padding(.horizontal, 10) .padding(.horizontal, 10)
.padding(.bottom, 10 + tabHeight + getSafeAreaBottom()) .padding(.bottom, 10 + tabHeight)
.disabled(!didChange()) .disabled(!didChange())
.opacity(!didChange() ? 0.5 : 1) .opacity(!didChange() ? 0.5 : 1)
.disabled(profileUploadObserver.isLoading || bannerUploadObserver.isLoading) .disabled(profileUploadObserver.isLoading || bannerUploadObserver.isLoading)

View File

@@ -22,7 +22,7 @@ struct ReactionsView: View {
} }
.padding() .padding()
} }
.padding(.bottom, tabHeight + getSafeAreaBottom()) .padding(.bottom, tabHeight)
.navigationBarTitle(NSLocalizedString("Reactions", comment: "Navigation bar title for Reactions view.")) .navigationBarTitle(NSLocalizedString("Reactions", comment: "Navigation bar title for Reactions view."))
.onAppear { .onAppear {
model.subscribe() model.subscribe()

View File

@@ -13,6 +13,7 @@ struct QuoteRepostsView: View {
var body: some View { var body: some View {
TimelineView<AnyView>(events: model.events, loading: $model.loading, damus: damus_state, show_friend_icon: true, filter: ContentFilters.default_filters(damus_state: damus_state).filter(ev:)) TimelineView<AnyView>(events: model.events, loading: $model.loading, damus: damus_state, show_friend_icon: true, filter: ContentFilters.default_filters(damus_state: damus_state).filter(ev:))
.padding(.bottom, tabHeight)
.navigationBarTitle(NSLocalizedString("Quotes", comment: "Navigation bar title for Quote Reposts view.")) .navigationBarTitle(NSLocalizedString("Quotes", comment: "Navigation bar title for Quote Reposts view."))
.onAppear { .onAppear {
model.subscribe() model.subscribe()

View File

@@ -20,7 +20,7 @@ struct RepostsView: View {
} }
.padding() .padding()
} }
.padding(.bottom, tabHeight + getSafeAreaBottom()) .padding(.bottom, tabHeight)
.navigationBarTitle(NSLocalizedString("Reposts", comment: "Navigation bar title for Reposts view.")) .navigationBarTitle(NSLocalizedString("Reposts", comment: "Navigation bar title for Reposts view."))
.onAppear { .onAppear {
model.subscribe() model.subscribe()

View File

@@ -28,7 +28,7 @@ struct ZapsView: View {
} }
} }
} }
.padding(.bottom, tabHeight + getSafeAreaBottom()) .padding(.bottom, tabHeight)
.navigationBarTitle(NSLocalizedString("Zaps", comment: "Navigation bar title for the Zaps view.")) .navigationBarTitle(NSLocalizedString("Zaps", comment: "Navigation bar title for the Zaps view."))
.onAppear { .onAppear {
model.subscribe() model.subscribe()