summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1891.cs
blob: 523c563bfeab45b27273dd9e6075f99580f26641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using NUnit.Framework;
using Xamarin.UITest;
#endif

namespace Xamarin.Forms.Controls {
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Github, 1891, "Modal dialog scrolls to far when focusing input boxes", PlatformAffected.iOS)]
	public class Issue1891 : TestContentPage
	{
		protected override void Init ()
		{
			var entry = new Entry {
				Text = "Email Address", 
				VerticalOptions = LayoutOptions.End,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				HeightRequest = 60
			};
			var btn = new Button { Text = "focus entry" };
			btn.Clicked += async (object sender, EventArgs e) => {
				await Navigation.PushModalAsync (new ModalWithInputPage ());
			};

			Content = new ScrollView {
				Content = new StackLayout {
					VerticalOptions = LayoutOptions.End,
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Children = {
						new StackLayout{ Children = { btn, entry } }
					}
				}
			};
		}
		public class ModalWithInputPage : ContentPage
		{
			public ModalWithInputPage()
			{
				Content = BuildLayout();
			}

			static Layout BuildLayout()
			{
				return new ScrollView 
				{ 
					Content = new StackLayout
					{
						VerticalOptions = LayoutOptions.End,
						HorizontalOptions = LayoutOptions.FillAndExpand,
						Children = {
							new Entry {
								Placeholder = "Email Address", 
								VerticalOptions = LayoutOptions.End,
								HorizontalOptions = LayoutOptions.FillAndExpand,
								HeightRequest = 60
							}
						}
					}
				};
			}
		}

#if UITEST
		[Test]
		[UiTest (typeof(TabbedPage))]
		public void Issue1891Tests ()
		{
			// TODO
			// Please redo, invalid test
			Assert.Inconclusive ("Needs test");
		}
#endif

	}
}