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 {
ScrollViewReader { proxy in
List {
Group {
makeHeaderView(proxy: proxy)
.padding(.bottom, -20)
familiarFollowers
featuredTagsView
}
.listRowInsets(.init())
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
makeHeaderView(proxy: proxy)
.applyAccountDetailsRowStyle(theme: theme)
.padding(.bottom, -20)
familiarFollowers
.applyAccountDetailsRowStyle(theme: theme)
featuredTagsView
.applyAccountDetailsRowStyle(theme: theme)
Picker("", selection: $viewModel.selectedTab) {
ForEach(isCurrentUser ? AccountDetailViewModel.Tab.currentAccountTabs : AccountDetailViewModel.Tab.accountTabs,
@ -59,9 +57,7 @@ public struct AccountDetailView: View {
}
.pickerStyle(.segmented)
.padding(.layoutPadding)
.listRowSeparator(.hidden)
.listRowBackground(theme.primaryBackgroundColor)
.listRowInsets(.init())
.applyAccountDetailsRowStyle(theme: theme)
.id("status")
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 {
static var previews: some View {
AccountDetailView(account: .placeholder())