Closed neal3000 closed 8 months ago
Hello,
Can you try the following code? (Mostly the same as what you posted, but cleaned up so it can compile) Works fine for me. Targeting iOS 16, running on iOS 17.
struct ContentView: View {
struct FriendsView: View {
var body: some View {
ScrollView(.vertical) {
VStack {
Text("Foo")
}
}.refresher() {}
}
}
var body: some View {
NavigationStack {
ZStack(alignment: .bottom) {
HStack {
TabView() {
FriendsView().tabItem {
Label("Friends", systemImage: "square.fill")
}
}
}
}
}
}
}
Thanks ! That fix it. That does look like what I tried, but obviously something changed. previously OffSet reader never got called (I put in some print statements)
btw, avoid .scrollTargetBehavior(.viewAligned(limitBehavior: .never)). it makes things jerky.
I'm using a TabView as my initial content view and that has a FriendsView with a ScrollView.
I can't get Refresher to work with the ScrollView in FriendsView - it looks like private func offsetChanged(_ val: CGFloat) never gets called.
If I make FriendsView the initial view ( removing the TabView) then things work.
struct ContentView: View {NavigationStack {ZStack(alignment: .bottom) {HStack {TabView(selection: $appData.currentTab) { FriendsView().tabItem { Label("Friends", systemImage: "square.fill") }.tag(TabPages.FriendTab) ....
struct FriendsView: View { var body: some View { ScrollView(.vertical) { VStack { }} .refresher() {...}