зеркало из https://github.com/DeGsoft/maui-linux.git
move await to Begin Invoke and check for disposed (#7192)
This commit is contained in:
Родитель
0645a44d16
Коммит
88bc6a80ce
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Xamarin.Forms.Platform.iOS
|
||||
{
|
||||
internal static class NSObjectExtensions
|
||||
{
|
||||
public static void QueueForLater(this NSObject nsObject, Action action) =>
|
||||
nsObject.BeginInvokeOnMainThread(action);
|
||||
}
|
||||
}
|
|
@ -360,7 +360,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
Control.TableHeaderView = _headerRenderer.NativeView;
|
||||
}
|
||||
|
||||
async void OnScrollToRequested(object sender, ScrollToRequestedEventArgs e)
|
||||
void OnScrollToRequested(object sender, ScrollToRequestedEventArgs e)
|
||||
{
|
||||
if (Superview == null)
|
||||
{
|
||||
|
@ -386,15 +386,17 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
Control.Layer.RemoveAllAnimations();
|
||||
//iOS11 hack
|
||||
if (Forms.IsiOS11OrNewer)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
Control.ScrollToRow(NSIndexPath.FromRowSection(index, 0), position, e.ShouldAnimate);
|
||||
this.QueueForLater(() =>
|
||||
{
|
||||
if (Control != null && !_disposed)
|
||||
Control.ScrollToRow(NSIndexPath.FromRowSection(index, 0), position, e.ShouldAnimate);
|
||||
});
|
||||
else
|
||||
Control.ScrollToRow(NSIndexPath.FromRowSection(index, 0), position, e.ShouldAnimate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UpdateFooter()
|
||||
{
|
||||
var footer = ListView.FooterElement;
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
<Compile Include="ExportRendererAttribute.cs" />
|
||||
<Compile Include="Extensions\ArrayExtensions.cs" />
|
||||
<Compile Include="Extensions\FlowDirectionExtensions.cs" />
|
||||
<Compile Include="Extensions\NSObjectExtensions.cs" />
|
||||
<Compile Include="Extensions\PlatformConfigurationExtensions.cs" />
|
||||
<Compile Include="Extensions\LabelExtensions.cs" />
|
||||
<Compile Include="Extensions\VisualElementExtensions.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче