Skip to content

Commit

Permalink
Tentative fix for Android
Browse files Browse the repository at this point in the history
Context: #18757
  • Loading branch information
jonathanpeppers committed Apr 23, 2024
1 parent bd19000 commit b294779
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using Android.Content;
using Android.Runtime;
using Android.Views;
Expand Down Expand Up @@ -476,19 +477,17 @@ void UpdateIsRefreshing(bool isInitialValue = false)
}
}

void UpdateIsSwipeToRefreshEnabled()
async void UpdateIsSwipeToRefreshEnabled()
{
if (_refresh != null)
{
var isEnabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
_refresh.Post(() =>
{
// NOTE: only disable while NOT refreshing, otherwise Command bindings CanExecute behavior will effectively
// cancel refresh animation. If not possible right now we will be called by UpdateIsRefreshing().
// For details see https://github.com/xamarin/Xamarin.Forms/issues/8384
if (isEnabled || !_refresh.Refreshing)
_refresh.Enabled = isEnabled;
});
await Task.Yield();
// NOTE: only disable while NOT refreshing, otherwise Command bindings CanExecute behavior will effectively
// cancel refresh animation. If not possible right now we will be called by UpdateIsRefreshing().
// For details see https://github.com/xamarin/Xamarin.Forms/issues/8384
if (isEnabled || !_refresh.Refreshing)
_refresh.Enabled = isEnabled;
}
}

Expand Down

0 comments on commit b294779

Please sign in to comment.