Fix duplicate post buttons when swiping tabs

Move the postButtonContainer view to avoid having 2 buttons on screen when swiping tabs

Closes: #366
Changelog-Fixed: Fix duplicate post buttons when swiping tabs
This commit is contained in:
Thomas Rademaker
2023-01-22 09:14:16 -05:00
committed by William Casarin
parent 77c2abc524
commit ced6e2488f

View File

@@ -93,15 +93,23 @@ struct ContentView: View {
var PostingTimelineView: some View { var PostingTimelineView: some View {
VStack { VStack {
TabView(selection: $filter_state) { ZStack {
contentTimelineView(filter: FilterState.posts.filter) TabView(selection: $filter_state) {
.tag(FilterState.posts) contentTimelineView(filter: FilterState.posts.filter)
.id(FilterState.posts) .tag(FilterState.posts)
contentTimelineView(filter: FilterState.posts_and_replies.filter) .id(FilterState.posts)
.tag(FilterState.posts_and_replies) contentTimelineView(filter: FilterState.posts_and_replies.filter)
.id(FilterState.posts_and_replies) .tag(FilterState.posts_and_replies)
.id(FilterState.posts_and_replies)
}
.tabViewStyle(.page(indexDisplayMode: .never))
if privkey != nil {
PostButtonContainer(userSettings: user_settings) {
self.active_sheet = .post
}
}
} }
.tabViewStyle(.page(indexDisplayMode: .never))
} }
.safeAreaInset(edge: .top, spacing: 0) { .safeAreaInset(edge: .top, spacing: 0) {
VStack(spacing: 0) { VStack(spacing: 0) {
@@ -120,11 +128,6 @@ struct ContentView: View {
if let damus = self.damus_state { if let damus = self.damus_state {
TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter) TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter)
} }
if privkey != nil {
PostButtonContainer(userSettings: user_settings) {
self.active_sheet = .post
}
}
} }
} }