adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
555 stars 46 forks source link

Is there a way to cancel navigating back when clicking the physical back button on Android? #152

Closed ajrcamigla closed 10 months ago

adospace commented 10 months ago

Use the standard MAUI way to cancel navigation, for example for the Shell:

new Shell()   
      .OnNavigating(OnNavigating); 

private void OnNavigating(object? sender, ShellNavigatingEventArgs args)
{
    // Cancel any back navigation.
    if (args.Source == ShellNavigationSource.Pop)
    {
        args.Cancel();
    }
}