Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected override void UpdateTextColor()
_textColorSwitcher.UpdateTextColor(EditText, Element.TextColor);
}

[PortHandler]
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
Expand Down
12 changes: 12 additions & 0 deletions src/Core/src/Handlers/Editor/EditorHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ protected override AppCompatEditText CreatePlatformView()

protected override void ConnectHandler(AppCompatEditText platformView)
{
platformView.ViewAttachedToWindow += OnPlatformViewAttachedToWindow;
platformView.TextChanged += OnTextChanged;
platformView.FocusChange += OnFocusedChange;
}

protected override void DisconnectHandler(AppCompatEditText platformView)
{
platformView.ViewAttachedToWindow -= OnPlatformViewAttachedToWindow;
platformView.TextChanged -= OnTextChanged;
platformView.FocusChange -= OnFocusedChange;
}
Expand Down Expand Up @@ -87,6 +89,16 @@ public static void MapCursorPosition(IEditorHandler handler, ITextInput editor)
public static void MapSelectionLength(IEditorHandler handler, ITextInput editor) =>
handler.PlatformView?.UpdateSelectionLength(editor);

void OnPlatformViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e)
{
if (PlatformView.IsAlive() && PlatformView.Enabled)
{
// https://issuetracker.google.com/issues/37095917
PlatformView.Enabled = false;
PlatformView.Enabled = true;
}
}

void OnTextChanged(object? sender, Android.Text.TextChangedEventArgs e) =>
VirtualView?.UpdateText(e);

Expand Down