diff --git a/src/Controls/src/Core/Editor/Editor.Android.cs b/src/Controls/src/Core/Editor/Editor.Android.cs index d67d92fd03d0..2f746734b8aa 100644 --- a/src/Controls/src/Core/Editor/Editor.Android.cs +++ b/src/Controls/src/Core/Editor/Editor.Android.cs @@ -5,19 +5,17 @@ namespace Microsoft.Maui.Controls { public partial class Editor { - public static void MapText(EditorHandler handler, Editor editor) + public static void MapText(EditorHandler handler, Editor editor) => + MapText((IEditorHandler)handler, editor); + + public static void MapText(IEditorHandler handler, Editor editor) { - if (handler.DataFlowDirection == DataFlowDirection.FromPlatform) + if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform) { Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, editor); return; } - MapText((IEditorHandler)handler, editor); - } - - public static void MapText(IEditorHandler handler, Editor editor) - { Platform.EditTextExtensions.UpdateText(handler.PlatformView, editor); } diff --git a/src/Controls/src/Core/Entry/Entry.Android.cs b/src/Controls/src/Core/Entry/Entry.Android.cs index 267969957b3b..632cb653cb8d 100644 --- a/src/Controls/src/Core/Entry/Entry.Android.cs +++ b/src/Controls/src/Core/Entry/Entry.Android.cs @@ -11,16 +11,8 @@ public partial class Entry public static void MapImeOptions(EntryHandler handler, Entry entry) => MapImeOptions((IEntryHandler)handler, entry); - public static void MapText(EntryHandler handler, Entry entry) - { - if (handler.DataFlowDirection == DataFlowDirection.FromPlatform) - { - Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry); - return; - } - + public static void MapText(EntryHandler handler, Entry entry) => MapText((IEntryHandler)handler, entry); - } public static void MapImeOptions(IEntryHandler handler, Entry entry) { @@ -29,6 +21,12 @@ public static void MapImeOptions(IEntryHandler handler, Entry entry) public static void MapText(IEntryHandler handler, Entry entry) { + if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform) + { + Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry); + return; + } + Platform.EditTextExtensions.UpdateText(handler.PlatformView, entry); } diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs index ac60efa26e1c..fb0666a769ed 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs @@ -142,6 +142,7 @@ void OnTextChanged(object? sender, TextChangedEventArgs e) // Let the mapping know that the update is coming from changes to the platform control DataFlowDirection = DataFlowDirection.FromPlatform; + VirtualView.UpdateText(e); // Reset to the default direction