summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2016-12-30 22:14:13 (GMT)
committerE.Z. Hart <hartez@users.noreply.github.com>2016-12-30 22:14:13 (GMT)
commitffab6dd82e45f563ced3924fcbe8baa0a4a127fa (patch)
tree2727b54a807850be3bf0904756a8b833eea92115
parent32dab1d3c7641688e9435be22297e092bcdb5ee6 (diff)
downloadxamarin-forms-ffab6dd82e45f563ced3924fcbe8baa0a4a127fa.zip
xamarin-forms-ffab6dd82e45f563ced3924fcbe8baa0a4a127fa.tar.gz
xamarin-forms-ffab6dd82e45f563ced3924fcbe8baa0a4a127fa.tar.bz2
[iOS] Change keyboard type while keyboard is visible (#443)
* Change keyboard while changing text * add sample code
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31141.cs78
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs1
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs1
4 files changed, 81 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31141.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31141.cs
new file mode 100644
index 0000000..1c67f19
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31141.cs
@@ -0,0 +1,78 @@
+´╗┐using System;
+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, 31141, "Change Entry keyboard type while typing", PlatformAffected.iOS)]
+ public class Bugzilla31141 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init()
+ {
+ var stackLayout = new StackLayout
+ {
+ Orientation = StackOrientation.Vertical,
+ Spacing = 10,
+ VerticalOptions = LayoutOptions.Start,
+ HorizontalOptions = LayoutOptions.Center
+ };
+
+ var label = new Label
+ {
+ Text = "Focus Entry or Editor and type characters. For every 3 characters, the keyboard type will change while keyboard is focused up to 12 characters."
+ };
+ stackLayout.Children.Add(label);
+
+ var entry = new Entry
+ {
+ WidthRequest = 250,
+ HeightRequest = 50,
+ BackgroundColor = Color.DarkGoldenrod
+ };
+ entry.TextChanged += InputViewOnTextChanged;
+ stackLayout.Children.Add(entry);
+
+ var editor = new Editor
+ {
+ WidthRequest = 250,
+ HeightRequest = 50,
+ BackgroundColor = Color.AntiqueWhite
+ };
+ editor.TextChanged += InputViewOnTextChanged;
+ stackLayout.Children.Add(editor);
+
+ Content = stackLayout;
+ }
+
+ void InputViewOnTextChanged(object sender, TextChangedEventArgs textChangedEventArgs)
+ {
+ if (textChangedEventArgs.NewTextValue.Length >= 15)
+ return;
+
+ switch (textChangedEventArgs.NewTextValue.Length % 15)
+ {
+ case 0:
+ (sender as InputView).Keyboard = Keyboard.Default;
+ break;
+ case 3:
+ (sender as InputView).Keyboard = Keyboard.Numeric;
+ break;
+ case 6:
+ (sender as InputView).Keyboard = Keyboard.Email;
+ break;
+ case 9:
+ (sender as InputView).Keyboard = Keyboard.Telephone;
+ break;
+ case 12:
+ (sender as InputView).Keyboard = Keyboard.Url;
+ break;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 53ae50a..d770220 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -43,6 +43,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla29158.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla29363.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla29229.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla31141.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31145.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31333.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31366.cs" />
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
index c92ccb4..448ebad 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
@@ -118,6 +118,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateKeyboard()
{
Control.ApplyKeyboard(Element.Keyboard);
+ Control.ReloadInputViews();
}
void UpdateText()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
index a50a4e7..9c4e298 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
@@ -155,6 +155,7 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateKeyboard()
{
Control.ApplyKeyboard(Element.Keyboard);
+ Control.ReloadInputViews();
}
void UpdatePassword()