nativescript-community / ui-pulltorefresh

:recycle: NativeScript plugin for PullToRefresh controls
Other
18 stars 6 forks source link

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

Open hendrickson-tyler opened 1 year ago

hendrickson-tyler commented 1 year ago

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. 🙂

farfromrefug commented 1 year ago

@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

hendrickson-tyler commented 1 year ago

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.

farfromrefug commented 1 year ago

@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

hendrickson-tyler commented 1 year ago

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