summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2016-11-16 14:59:21 -0600
committerJason Smith <jason.smith@xamarin.com>2016-11-16 12:59:21 -0800
commit281bfa2b0a6de05130b87ad5c25f9bf8b05f876c (patch)
treeea3edbbb0a86e8806d2955d5473c4e0c994c0441
parenteb243bcea492088f07934409f047d05ecd2aea45 (diff)
downloadxamarin-forms-281bfa2b0a6de05130b87ad5c25f9bf8b05f876c.tar.gz
xamarin-forms-281bfa2b0a6de05130b87ad5c25f9bf8b05f876c.tar.bz2
xamarin-forms-281bfa2b0a6de05130b87ad5c25f9bf8b05f876c.zip
[iOS] Update Editor text from autocorrect when losing focus (#535)
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35736.cs55
-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.cs3
3 files changed, 59 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35736.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35736.cs
new file mode 100644
index 00000000..0bcf5f16
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35736.cs
@@ -0,0 +1,55 @@
+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, 35736, "[iOS] Editor does not update Text value from autocorrect when losing focus", PlatformAffected.iOS)]
+ public class Bugzilla35736 : TestContentPage
+ {
+ protected override void Init()
+ {
+ var editor = new Editor
+ {
+ AutomationId = "Bugzilla35736Editor"
+ };
+ var label = new Label
+ {
+ AutomationId = "Bugzilla35736Label",
+ Text = ""
+ };
+
+ Content = new StackLayout
+ {
+ Children =
+ {
+ editor,
+ label,
+ new Button
+ {
+ AutomationId = "Bugzilla35736Button",
+ Text = "Click to set label text",
+ Command = new Command(() => { label.Text = editor.Text; })
+ }
+ }
+ };
+ }
+
+
+#if UITEST
+ [Test]
+ public void Bugzilla35736Test()
+ {
+ RunningApp.WaitForElement(q => q.Marked("Bugzilla35736Editor"));
+ RunningApp.EnterText(q => q.Marked("Bugzilla35736Editor"), "Testig");
+ RunningApp.Tap(q => q.Marked("Bugzilla35736Button"));
+ Assert.AreEqual("Testing", RunningApp.Query(q => q.Marked("Bugzilla35736Label"))[0].Text);
+ }
+#endif
+ }
+} \ 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 a0caedd6..7b0fda62 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
@@ -461,6 +461,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39908.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39489.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla36802.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla35736.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
index 49126dad..8819ba33 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
@@ -99,6 +99,9 @@ namespace Xamarin.Forms.Platform.iOS
void OnEnded(object sender, EventArgs eventArgs)
{
+ if (Control.Text != Element.Text)
+ ElementController.SetValueFromRenderer(Editor.TextProperty, Control.Text);
+
Element.SetValue(VisualElement.IsFocusedPropertyKey, false);
Element.SendCompleted();
}