unoplatform/uno

[WASM] `SystemNavigationManager.BackRequested` doesn't work.

Open

#3.115 geöffnet am 6. Mai 2020

Auf GitHub ansehen
 (9 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (837 Forks)batch import
difficulty/medium 🤔good first issuekind/bugno-reproplatform/wasm 🌐project/navigation-lifecycle 🧬

Repository-Metriken

Stars
 (9.789 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 8h) (130 gemergte PRs in 30 T)

Beschreibung

Current behavior

I have written the following code. The location is in the if block of the if(rootFrame == null) of the OnLanuched method in App.xaml.cs.

Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) =>
{
    if (!rootFrame.CanGoBack)
    {
        return;
    }
    rootFrame.GoBack();
    args.Handled = true;
};

I deployed it to azure and tried it on my Android Chrome, but it didn't work. I hit the back key on my Android after Navigate, resulting in the tab being closed. Chrome on Android is the latest version. (81.0.4044.117)

The above code worked fine in builds for other platforms.(ex: UWP)

[Wasm] Add support of hardware/browser back button in SystemNavigationManager.BackRequested It seems to be supported as of 1.45. Is it not working properly now?

Expected behavior

I want you to go back to the previous screen.

How to reproduce it (as minimally and precisely as possible)

I've already explained the code.

Environment

Nuget Package:Uno.UI

Package Version(s):2.3.0-dev.116

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Windows
  • Build tasks
  • Solution Templates

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Contributor Guide