jamesmontemagno / Xamarin.Forms-PullToRefreshLayout

Pull To Refresh a ScrollView or ListView in Xamarin.Forms
218 stars 49 forks source link

Setting IsPullToRefreshEnabled to false does not work on iOS #3

Closed jamesmontemagno closed 6 years ago

jamesmontemagno commented 8 years ago

If you set IsPullToRefreshEnabled it doesn't seem to do anything. Quite possibly related to the following question on SO - http://stackoverflow.com/questions/19480424/how-do-i-hide-a-uirefreshcontrol

To disable, you need to fully remove the UIRefresh control, not simply set Enabled to false.

Moved from: https://github.com/jamesmontemagno/Xamarin.Forms-Awesome-Controls/issues/14

ghost commented 8 years ago

But if we want to enable it again, we've to render the page again!

jamesmontemagno commented 8 years ago

I am still looking in to this, I haven't experienced this really, but need to test it out.

dcasbonne commented 8 years ago

Hi there ! Same problem here on iOS and Android. It could be great if we can set this property to enable or disable "on the fly" the ability to pull to refresh!

ghost commented 8 years ago

We can disable individual ScrollViews recursively. Same way you added the ScrollViews in first place.

aliuspetraska commented 8 years ago

The problem is still open, activity indicator keeps on spinning right after setting IsRefreshing = false;

jamesmontemagno commented 8 years ago

@aliuspetraska that would seem to be a different issue if it is so as this mentions IsPullToRefreshEnabled, not IsRefreshing, but have you done a data binding to IsRefreshing?

danielbigler commented 8 years ago

@aliuspetraska @jamesmontemagno I have the same issue. The indicator keeps spinning. Is there any solution for this problem?

jamesmontemagno commented 8 years ago

Can someone create me a small repo of the bug please.

danielbigler commented 8 years ago

The problem is on iOS when setting IsRefreshing = false immediately after executing the refresh command it keeps spinning forever. For me it worked by adding a time delay of around one second or slowing down "loadData()".

` async Task ExecuteRefreshCommand() { if (IsBusy) return;

        IsBusy = true;
        //await loadData();
        await Task.Delay(1000); // otherwise it´s spinning forever
        IsBusy = false;
    }`
Kricke242 commented 8 years ago

@aliuspetraska @jamesmontemagno

I had this problem (spinner not stopping when setting the bounded, IsRefreshing, property to false).

I think that the components BindingMode.TwoWay does not work for the property IsRefreshing. I.e when pulling to refresh in the UI, the component does not update the IsRefreshing-property in the viewmodel. Since it is already false, when setting it to false again, the INotifyPropertyChange does not get triggered. And it keeps spinning.

I have not studied it in depth, so I'm not sure this is the issue.

However, when I now set the IsRefreshing-property to true, manually, in the RefreshCommand, it works when I set it to false, after the update.

aherrick commented 8 years ago

@danielbigler had to do something similar as well thanks for the tip..!

hlogmans commented 7 years ago

As @Kricke242 correctly observed, the IsBusy property is still false when the refresh command is executed. So if the setter of this property does check for equality before sending INotifyPropertyChanged, setting it to false won't trigger UI updates. This is not conform the Pull to refresh functionality of the X.F ListView component. Setting it to true manually solved it, and probably just raising the NotifyPropertyChanged with the correct parameter, too.

andrii-borysov-me commented 7 years ago

@jamesmontemagno it looks like, if one uses VisualElement.IsEnabled property instead of the IsPullToRefreshEnabled property, it works on both Android and iOS as expected. The reason is that if you leave IsEnabled as true, the VisualElementTracker uses this property and overrides yours IsPullToRefreshEnabled.

mariuszdybala commented 7 years ago

Guys, what's a status of bug with IsPullToRefreshEnabled ? I've just added PullToRefresh nuget and there's still a problem with disabling refresh.

Qythyx commented 6 years ago

Instead of the delay, just calling OnPropertyChanged("IsBusy"); worked for me.