ui-pulltorefresh icon indicating copy to clipboard operation
ui-pulltorefresh copied to clipboard

Pull to refresh element doesn't scroll consistently with other items in ScrollView on iOS

Open hendrickson-tyler opened this issue 2 years ago • 4 comments

I'm using PullToRefresh in my app in a view that also has a ScrollView like so:

<PullToRefresh
  (refresh)="refreshCards($event)"
  mainContent
  indicatorColor="white"
  indicatorFillColor="#701315"
>
  <ScrollView class="scroll-container">
    <GridLayout rows="auto, *" columns="*">
      ...
    </GridLayout>
  <ScrollView>
</PullToRefresh>

I'm noticing that the PullToRefresh area doesn't "track" at the same rate that the ScrollView does, so I can see the background between the two areas, which can be quite distracting.

Simulator Screen Recording - iPhone 14 Pro - 2023-07-07 at 19 16 31

In fact, you can see this same issue in the example GIF shown in the README.

I'm trying to figure out a workaround, but it would be amazing if this could be fixed on the plugin side. 🙂

hendrickson-tyler avatar Jul 08 '23 01:07 hendrickson-tyler

@hendrickson-tyler this plugin does not handle the scrolling itself. it is all done by the native iOS component. you can search for the native issue on the web

farfromrefug avatar Jul 08 '23 06:07 farfromrefug

Ah, I see. You're right, it appears that it is an issue with UIRefreshControl as this answer details exactly what I'm seeing. I'm surprised that this has been an issue for so long. They mention some hacky ways to address this. What is your opinion on implementing these in the plugin? I'm not super familiar with native iOS code, but I'd be happy to try and contribute a PR. I haven't been able to find a suitable workaround for this without changing the background color of my ScrollView.

hendrickson-tyler avatar Jul 08 '23 15:07 hendrickson-tyler

@hendrickson-tyler you can try that fix by creating a custom class to use. however I won't make it the default as the layoutsubviews hack can have performance issues. what I can do is make it an option. you could create a PR with an option "useLayoutHack" that would use the subclass in creareNativeView

farfromrefug avatar Jul 08 '23 16:07 farfromrefug

Sounds perfect, I'll try to find some time soon to look at adding that option.

hendrickson-tyler avatar Jul 08 '23 17:07 hendrickson-tyler