-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introspector in iOS 14 not working for ScrollView... #55
Comments
I'm seeing the same problem. The introspectScrollView is not being called at all. |
The problems seems to be that the function: public static func findAncestor<AnyViewType: PlatformView>(ofType type: AnyViewType.Type, from entry: PlatformView) -> AnyViewType? {
var superview = entry.superview
while let s = superview {
if let typed = s as? AnyViewType { // This won't match a UIScrollView in iOS 14
return typed
}
superview = s.superview
}
return nil
} returns Where I have manually added the project sources to workaround my app having a deployment target < iOS 13. Some debugger testing:
My SwiftUI code: ScrollView {
VStack {
// ...
}
}
.introspectScrollView {
self.scrollViewHelper.scrollView = $0
} |
Created a PR with a potential fix: #56 |
commit 0ae9f17 Author: Lucas Wilkinson <wilkinson.lucas@gmail.com> Date: Fri Sep 25 00:50:17 2020 -0400 Fix: Introspector in iOS 14 not working for ScrollView (siteline#55)
The #56 fix works fine for as far as I can see! But I'm facing some other issue by adding a UIRefreshControl to the ScrollView. it has some uncommon behavior by not really showing the refresh animation but disappearing when it is pulled. I also tried it with a List but that seems to only appear on the introspected ScrollView. Am I missing something here or is it a bug? I think the "normal" behavior would be to show the refresh animation forever as I'm not giving it a target. A basic example where it happens for me is: struct TEST: View {
var body: some View {
ScrollView {
Text("Message 1")
Text("Message 2")
Text("Message 3")
}
.introspectScrollView() { scrollView in
print("is now working with fix #56 (so definitly fires at all)")
scrollView.refreshControl = UIRefreshControl()
}
}
} |
Hi guys! How did you fix this issue? I also experienced this bug and can't figure out how to solve it. Hoping for a quick response. Thank you |
Also seeing the same behavior as Paulo has pointed out. The animation disappears once the UIRefreshControl has been enabled. |
Fixed in master, see 6ddd059. Props to @lucastimeless for their work on #56 ! |
Hi @Paulo2703 @maschoffjake @ldiqual Did you find a way how to figure out the issue you described? I'm facing this issue too. The animation disappears once the UIRefreshControl has been enabled. |
Sadly not :/
…On Thu, Nov 19, 2020 at 7:16 AM Svyat Zubyak ***@***.***> wrote:
Hi @Paulo2703 <https://github.com/paulo2703> @maschoffjake
<https://github.com/maschoffjake> Did you find a way how to figure out
the issue you described? I'm facing this issue too. The animation
disappears once the UIRefreshControl has been enabled.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDUC3LAPPECA6M64S6FY3LSQUSCNANCNFSM4RT5MKDA>
.
|
Hey, so i have found kind of a sneakaround by putting the scrollview into a List, where the introspect uirefreshcontrol actually works. |
First of all the specs: iOS 14, Xcode 12.2 beta and Catalina running on my Mac.
I tried to add a pulltorefresh function to a ScrollView in Swiftui but it doesnt show up. Actually the whohle introspect is never called. I tried a few times and it actually only works if I change it to List, but not with ScrollView like it is shown in the Github example. As I defo need it for ScrollView I need your help. Cheers...
So this one actually works:
List {
ForEach(0..<100)
{ _ in
Text("hello")
}
}
.introspectScrollView { scrollView in
print("Test")
scrollView.refreshControl = UIRefreshControl()
}
while this does not:
ScrollView {
ForEach(0..<100)
{ _ in
Text("hello")
}
}
.introspectScrollView { scrollView in
print("Test")
scrollView.refreshControl = UIRefreshControl()
}
The text was updated successfully, but these errors were encountered: