fix(creator): 선택 탭을 가운데 정렬한다
This commit is contained in:
@@ -4,6 +4,7 @@ struct CreatorChannelTabBar: View {
|
||||
@Binding var selectedTab: CreatorChannelTab
|
||||
|
||||
var body: some View {
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(CreatorChannelTab.allCases, id: \.self) { tab in
|
||||
@@ -24,6 +25,13 @@ struct CreatorChannelTabBar: View {
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.id(tab)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: selectedTab) { tab in
|
||||
withAnimation {
|
||||
proxy.scrollTo(tab, anchor: .center)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ struct CreatorChannelView: View {
|
||||
onTapCommunityLike: viewModel.likeCommunityPost
|
||||
)
|
||||
} else {
|
||||
CreatorChannelPlaceholderTabView(title: viewModel.selectedTab.title)
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user