[iOS] Add check for UIGestureRecognizerState.Cancelled when closing context action (#442)

This commit is contained in:
Paul DiPietro 2016-10-26 12:11:58 -05:00 коммит произвёл Rui Marinho
Родитель b4a46d482f
Коммит a0fb20a075
3 изменённых файлов: 48 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,45 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 44338, "Tapping off of a cell with an open context action causes a crash in iOS 10", PlatformAffected.iOS)]
public class Bugzilla44338 : TestContentPage
{
protected override void Init()
{
string[] items = new string[] { "A", "B", "C" };
Content = new ListView
{
ItemsSource = items,
ItemTemplate = new DataTemplate(() =>
{
var label = new Label();
label.SetBinding(Label.TextProperty, ".");
var view = new ViewCell
{
View = new StackLayout
{
Children =
{
label
}
}
};
view.ContextActions.Add(new MenuItem
{
Text = "Action",
Command = new Command(() => DisplayAlert("Alert", "Context Action Pressed", "Close"))
});
return view;
})
};
}
}
}

Просмотреть файл

@ -129,9 +129,11 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44584.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44584.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla42832.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42832.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44044.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44044.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44338.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" /> <Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34727.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla34727.cs" />

Просмотреть файл

@ -210,7 +210,7 @@ namespace Xamarin.Forms.Platform.iOS
void ClearCloserRecognizer(UIScrollView scrollView) void ClearCloserRecognizer(UIScrollView scrollView)
{ {
if (_globalCloser == null) if (_globalCloser == null || _globalCloser.State == UIGestureRecognizerState.Cancelled)
return; return;
var cell = GetContextCell(scrollView); var cell = GetContextCell(scrollView);