NavigationSam icon indicating copy to clipboard operation
NavigationSam copied to clipboard

PushModal - Android Hardware Back

Open Engincode opened this issue 3 years ago • 2 comments

Hi Sam There are strange bug on the Android side..

When we push with Modal (with NavigationPage); HardwareBack doesn't work.

Example: Page1.xaml, Page2.xaml

Page1, Button1, OnTap body

private void Button1_Tapped(object sender, EventArgs e) { Navigation.PushModalAsync(new NavigationPageSam(new Page2())); }

After that, HardwareBack doesn't work. Can you check?

Engincode avatar Aug 25 '22 18:08 Engincode

You have to implement the INavigationPopInterceptor interface in the ContentPage (class) to be able to handle the backbutton (the software and hardware both acts same using this package).

mlyga avatar Jan 13 '23 18:01 mlyga

Example:

public partial class Page1 : ContentPage, INavigationPopInterceptor
{
    public bool IsPopRequest { get; set; }

    public MainPageView()
    {
        InitializeComponent();
    }

    public Task<bool> RequestPop()
    {
        return Task.Run(() => true);
    }
}

mlyga avatar Jan 13 '23 18:01 mlyga