From 7e0a92bd6fe42215a90ca274e58f9c524e11fff8 Mon Sep 17 00:00:00 2001 From: Adolfo Marinucci Date: Thu, 19 Sep 2024 22:34:14 +0200 Subject: [PATCH] fixes #254 --- .github/workflows/build-deploy.yml | 2 +- src/MauiReactor/Shell.partial.cs | 36 +++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 0f2fb16..d81f04b 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -15,7 +15,7 @@ jobs: env: Solution_Name: ./src/MauiReactor.Build.sln TemplatePack_Name: ./src/MauiReactor.TemplatePack/MauiReactor.TemplatePack.csproj - Version: 2.0.48 + Version: 2.0.49 steps: - name: Checkout diff --git a/src/MauiReactor/Shell.partial.cs b/src/MauiReactor/Shell.partial.cs index 8cae45a..dd7c17e 100644 --- a/src/MauiReactor/Shell.partial.cs +++ b/src/MauiReactor/Shell.partial.cs @@ -422,7 +422,7 @@ public static class MauiControlsShellExtensions internal static Stack _shellStack = []; - public static async Task GoToAsync

(this Microsoft.Maui.Controls.Shell shell, string route, Action

propsInitializer) where P : new() + public static async Task GoToAsync

(this Microsoft.Maui.Controls.Shell shell, string route, Action

propsInitializer, bool? animate = null) where P : new() { try { @@ -439,7 +439,15 @@ public static class MauiControlsShellExtensions propsInitializer(convertedProps); } }), shell)); - await shell.GoToAsync(route); + + if (animate == null) + { + await shell.GoToAsync(route); + } + else + { + await shell.GoToAsync(route, animate.Value); + } } finally { @@ -447,7 +455,7 @@ public static class MauiControlsShellExtensions } } - public static async Task GoToAsync(this Microsoft.Maui.Controls.Shell shell, Action

propsInitializer) where P : new() + public static async Task GoToAsync(this Microsoft.Maui.Controls.Shell shell, Action

propsInitializer, bool? animate = null) where P : new() { try { @@ -464,7 +472,15 @@ public static class MauiControlsShellExtensions CopyObjectExtensions.CopyProperties(convertedProps, props); } }), shell)); - await shell.GoToAsync(typeof(T).FullName); + + if (animate == null) + { + await shell.GoToAsync(typeof(T).FullName); + } + else + { + await shell.GoToAsync(typeof(T).FullName, animate.Value); + } } finally { @@ -472,12 +488,20 @@ public static class MauiControlsShellExtensions } } - public static async Task GoToAsync(this Microsoft.Maui.Controls.Shell shell, string? route = null) where T : Component, new() + public static async Task GoToAsync(this Microsoft.Maui.Controls.Shell shell, string? route = null, bool? animate = null) where T : Component, new() { try { _shellStack.Push(shell); - await shell.GoToAsync(route ?? typeof(T).FullName); + + if (animate == null) + { + await shell.GoToAsync(route ?? typeof(T).FullName); + } + else + { + await shell.GoToAsync(route ?? typeof(T).FullName, animate.Value); + } } finally {