Skip to content

Commit

Permalink
fixes #254
Browse files Browse the repository at this point in the history
  • Loading branch information
adospace committed Sep 19, 2024
1 parent 5b3ae13 commit 7e0a92b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 30 additions & 6 deletions src/MauiReactor/Shell.partial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public static class MauiControlsShellExtensions

internal static Stack<Microsoft.Maui.Controls.Shell> _shellStack = [];

public static async Task GoToAsync<P>(this Microsoft.Maui.Controls.Shell shell, string route, Action<P> propsInitializer) where P : new()
public static async Task GoToAsync<P>(this Microsoft.Maui.Controls.Shell shell, string route, Action<P> propsInitializer, bool? animate = null) where P : new()
{
try
{
Expand All @@ -439,15 +439,23 @@ 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
{
_propsStack.Pop();
}
}

public static async Task GoToAsync<T, P>(this Microsoft.Maui.Controls.Shell shell, Action<P> propsInitializer) where P : new()
public static async Task GoToAsync<T, P>(this Microsoft.Maui.Controls.Shell shell, Action<P> propsInitializer, bool? animate = null) where P : new()
{
try
{
Expand All @@ -464,20 +472,36 @@ 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
{
_propsStack.Pop();
}
}

public static async Task GoToAsync<T>(this Microsoft.Maui.Controls.Shell shell, string? route = null) where T : Component, new()
public static async Task GoToAsync<T>(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
{
Expand Down

0 comments on commit 7e0a92b

Please sign in to comment.