jamesmontemagno / Xamarin.Forms-PullToRefreshLayout

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

Crash on Xamarin Android #44

Closed bastianbecker21 closed 5 years ago

bastianbecker21 commented 6 years ago
<controls:PullToRefreshLayout
      IsPullToRefreshEnabled="True"
      RefreshCommand="{Binding RefreshCommand}"
      IsRefreshing="{Binding IsBusy}"
      RefreshColor="Blue"> 
      <ScrollView
      HorizontalOptions="FillAndExpand"
      VerticalOptions="FillAndExpand">
        <StackLayout
              HorizontalOptions="FillAndExpand"
              VerticalOptions="FillAndExpand">
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Blue"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Red"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Yellow"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Purple"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Maroon"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Blue"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Red"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Yellow"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Purple"/>
            <BoxView HeightRequest="100" WidthRequest="100" BackgroundColor="Maroon"/>
        </StackLayout>
      </ScrollView>
  </controls:PullToRefreshLayout>

This package works good in general but it crashes when the content size is changed. The views of StackLayout inner ScrollView of my project is changed dynamically. Some views are not shown in some case, so the content size get smaller than ScrollView size.

In this case, the app crashes with "Cannot access a disposed object" Please help me to fix this issue soon.

Thanks!

conradh commented 6 years ago

I have the same issue now. In my case 100% reproducible if navigating through all my 5 tabs (where 2 of them has pulltorefreshlayout) Then i click a button to do a pushhmodal(navigationpage), I navigate 2 steps and click on an editfield that triggers the keyboard to popup and also scroll the view. Thereby some onLayout-thingy crashes on:

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Refractored.XamForms.PullToRefresh.Droid.PullToRefreshLayoutRenderer'.

stesvis commented 6 years ago

Same is happening to me. I use the PullToRefreshLayout in some pages, but then when i navigate to a page with <Entry> elements (this page doesn't contain a PullToRefreshLayout), it crashes as soon as i click on the text box and the keyboard shows.

Unhandled Exception:

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Refractored.XamForms.PullToRefresh.Droid.PullToRefreshLayoutRenderer'.

Only on Android. iOS works fine.

jamesmontemagno commented 5 years ago

Duplicate of #12