Skip to content

Android: "Navigate back" gesture navigates back 2 times/steps #124

@gentledepp

Description

@gentledepp

In my android app, when I use the "swipe back gesture", the app navigates back twice

I debugged it and it turns out, that on Android, when this gesture is used, Avalonia fires two events:

  • TopLevel.KeyUp (with Key.Escape)
  • TopLevel.BackRequested

so to fix this, I had to add an OperatingSystem.IsAndroid() check:

In ShellView.cs line 545:

    private async void TopLevelOnKeyUp(object? sender, KeyEventArgs e)
    {
        if (OperatingSystem.IsAndroid())
            return;

        if (e.Key == Key.Escape)
            await Back();
    }

Is this a known issue?
Happens with Avalonia 11.3.9

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions