jamesmontemagno / Xamarin.Forms-PullToRefreshLayout

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

Pull to Refresh does not register on iOS #31

Closed jboyda closed 6 years ago

jboyda commented 6 years ago

Pull to Refresh works wonderfully on Android but when deployed to iOS, it does not register. Any thoughts? Am I missing something that needs to be added to the AppDelegate?

jamesmontemagno commented 6 years ago

works fine in my sample app...

jamesmontemagno commented 6 years ago

seeing you provided no code or screenshot i have no idea how you are using it...

jboyda commented 6 years ago

My apologies, must have overlooked it. This is the snippet of where it is being called.

 BindingContext = new TestViewModel(this);

var sv = new ScrollView()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

Label test = new Label()
            {
                Text = "test"
            };

sv.Content = test;

var refreshView = new PullToRefreshLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Content = sv,
                RefreshColor = Color.White,
                RefreshBackgroundColor = Color.FromHex("#f8af35")
            };

refreshView.SetBinding<TestViewModel>(PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);
refreshView.SetBinding<TestViewModel>(PullToRefreshLayout.RefreshCommandProperty, vm => vm.RefreshCommand);

Content = new StackLayout
{
            Spacing = 5,
            Children =
            {
                    refreshView
            }
};
Cherry-1902Software commented 6 years ago

Add PullToRefreshLayoutRenderer.Init() on your AppDelegate