Skip to content

Instantly share code, notes, and snippets.

@samhouts
Created September 20, 2016 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samhouts/f3dd0ca2fbd500e0eba339208b0d0d28 to your computer and use it in GitHub Desktop.
Save samhouts/f3dd0ca2fbd500e0eba339208b0d0d28 to your computer and use it in GitHub Desktop.
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Collections.Generic;
using System;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 43993, "iOS: ListView size does not return to normal after keyboard disappears")]
public class Bugzilla43993 : TestContentPage
{
protected override void Init()
{
var grid = new Grid();
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
grid.RowDefinitions.Add(new RowDefinition());
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
var contentView = new ContentView() { BackgroundColor = Color.Red };
grid.AddChild(contentView, 0, 0);
var entry = new Entry { AutomationId = "entry" };
grid.AddChild(entry, 0, 1);
var list = new List<string>();
for (var i = 0; i < 100; i++)
{
list.Add($"Item {i}: {Guid.NewGuid()}");
}
var listView = new ListView() { ItemsSource = list };
grid.AddChild(listView, 0, 2);
var contentView2 = new ContentView() { BackgroundColor = Color.Yellow };
grid.AddChild(contentView2, 0, 3);
Content = grid;
NavigationPage.SetHasNavigationBar(this, false);
listView.ScrollTo(99, ScrollToPosition.Center, false);
}
#if UITEST
[Test]
public void Bugzilla43993Test()
{
RunningApp.WaitForElement(q => q.Marked("99"));
RunningApp.WaitForElement(q => q.Marked("entry"));
RunningApp.Tap(q => q.Marked("entry"));
RunningApp.Back();
RunningApp.WaitForElement(q => q.Marked("99"));
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment