mirror of
git://jb55.com/damus
synced 2024-09-20 03:57:06 +00:00
Fix TabView loading new view on scroll
This commit is contained in:
parent
d878ff6fdb
commit
5f22a7691f
@ -93,9 +93,9 @@ struct ContentView: View {
|
||||
var PostingTimelineView: some View {
|
||||
VStack {
|
||||
TabView(selection: $filter_state) {
|
||||
ContentTimelineView
|
||||
contentTimelineView(filter: posts_filter_event)
|
||||
.tag(FilterState.posts)
|
||||
ContentTimelineView
|
||||
contentTimelineView(filter: posts_and_replies_filter_event)
|
||||
.tag(FilterState.posts_and_replies)
|
||||
}
|
||||
.tabViewStyle(.page(indexDisplayMode: .never))
|
||||
@ -113,10 +113,10 @@ struct ContentView: View {
|
||||
.ignoresSafeArea(.keyboard)
|
||||
}
|
||||
|
||||
var ContentTimelineView: some View {
|
||||
func contentTimelineView(filter: (@escaping (NostrEvent) -> Bool)) -> some View {
|
||||
ZStack {
|
||||
if let damus = self.damus_state {
|
||||
TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter_event)
|
||||
TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter)
|
||||
}
|
||||
if privkey != nil {
|
||||
PostButtonContainer {
|
||||
@ -126,6 +126,14 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
|
||||
func posts_and_replies_filter_event(_ ev: NostrEvent) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func posts_filter_event(_ ev: NostrEvent) -> Bool {
|
||||
return !ev.is_reply(nil)
|
||||
}
|
||||
|
||||
var FiltersView: some View {
|
||||
VStack{
|
||||
Picker("Filter State", selection: $filter_state) {
|
||||
@ -136,14 +144,6 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
|
||||
func filter_event(_ ev: NostrEvent) -> Bool {
|
||||
if self.filter_state == .posts {
|
||||
return !ev.is_reply(nil)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func MainContent(damus: DamusState) -> some View {
|
||||
VStack {
|
||||
NavigationLink(destination: MaybeProfileView, isActive: $profile_open) {
|
||||
|
Loading…
Reference in New Issue
Block a user