Fix crash when opening account details (#972) close #918

This commit is contained in:
Alex Grebenyuk 2023-02-21 01:03:24 -05:00 committed by GitHub
parent f04c15b8fe
commit c9e542a2ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,15 +40,13 @@ public struct AccountDetailView: View {
public var body: some View { public var body: some View {
ScrollViewReader { proxy in ScrollViewReader { proxy in
List { List {
Group {
makeHeaderView(proxy: proxy) makeHeaderView(proxy: proxy)
.applyAccountDetailsRowStyle(theme: theme)
.padding(.bottom, -20) .padding(.bottom, -20)
familiarFollowers familiarFollowers
.applyAccountDetailsRowStyle(theme: theme)
featuredTagsView featuredTagsView
} .applyAccountDetailsRowStyle(theme: theme)
.listRowInsets(.init())
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
Picker("", selection: $viewModel.selectedTab) { Picker("", selection: $viewModel.selectedTab) {
ForEach(isCurrentUser ? AccountDetailViewModel.Tab.currentAccountTabs : AccountDetailViewModel.Tab.accountTabs, ForEach(isCurrentUser ? AccountDetailViewModel.Tab.currentAccountTabs : AccountDetailViewModel.Tab.accountTabs,
@ -59,9 +57,7 @@ public struct AccountDetailView: View {
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
.padding(.layoutPadding) .padding(.layoutPadding)
.listRowSeparator(.hidden) .applyAccountDetailsRowStyle(theme: theme)
.listRowBackground(theme.primaryBackgroundColor)
.listRowInsets(.init())
.id("status") .id("status")
switch viewModel.tabState { switch viewModel.tabState {
@ -487,6 +483,15 @@ public struct AccountDetailView: View {
} }
} }
private extension View {
func applyAccountDetailsRowStyle(theme: Theme) -> some View {
self
.listRowInsets(.init())
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
}
}
struct AccountDetailView_Previews: PreviewProvider { struct AccountDetailView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
AccountDetailView(account: .placeholder()) AccountDetailView(account: .placeholder())