Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected override void OnAttachedTo(VisualElement bindable, AView platformView)
viewGroup = platformView.GetParentOfType<ViewGroup>();

platformView.Touch += OnTouch;
platformView.KeyPress += OnKeyPressed;
UpdateClickHandler();
accessibilityManager = platformView.Context?.GetSystemService(Context.AccessibilityService) as AccessibilityManager;

Expand Down Expand Up @@ -89,6 +90,7 @@ protected override void OnDetachedFrom(VisualElement bindable, AView platformVie
{
view.Touch -= OnTouch;
view.Click -= OnClick;
view.KeyPress -= OnKeyPressed;
}

Element = null;
Expand Down Expand Up @@ -117,6 +119,15 @@ void UpdateClickHandler()
}
}

void OnKeyPressed(object? sender, AView.KeyEventArgs e)
{
if (e.KeyCode == Keycode.Space && e.Event?.Action == KeyEventActions.Up)
{
IsCanceled = false;
HandleTouchEnded(TouchStatus.Completed);
}
}

void OnClick(object? sender, EventArgs args)
{
if (!IsEnabled)
Expand Down
Loading