Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected virtual IShellBottomNavViewAppearanceTracker CreateBottomNavViewAppear
protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == Shell.CurrentItemProperty.PropertyName)
SwitchFragment(FragmentManager, _frameLayout, Element.CurrentItem);
SwitchFragment(FragmentManager, _frameLayout, Element.CurrentItem, Element.IsAnimateOnNavigation);

_elementPropertyChanged?.Invoke(sender, e);
}
Expand Down Expand Up @@ -226,7 +226,14 @@ protected virtual void SwitchFragment(FragmentManager manager, AView targetView,
FragmentTransaction transaction = manager.BeginTransactionEx();

if (animate)
transaction.SetTransitionEx((int)global::Android.App.FragmentTransit.FragmentOpen);
{
transaction.SetCustomAnimations(
global::Android.Resource.Animation.FadeIn,
global::Android.Resource.Animation.FadeOut,
global::Android.Resource.Animation.FadeIn,
global::Android.Resource.Animation.FadeOut
);
}

transaction.ReplaceEx(_frameLayout.Id, fragment);

Expand Down
4 changes: 4 additions & 0 deletions src/Controls/src/Core/Shell/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ public Task GoToAsync(ShellNavigationState state)
/// <include file="../../../docs/Microsoft.Maui.Controls/Shell.xml" path="//Member[@MemberName='GoToAsync'][2]/Docs/*" />
public Task GoToAsync(ShellNavigationState state, bool animate)
{
IsAnimateOnNavigation = animate;
Copy link

Copilot AI Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment to IsAnimateOnNavigation is repeated across multiple GoToAsync overloads; consider refactoring this duplication into a common helper method or a centralized assignment to improve maintainability.

Copilot uses AI. Check for mistakes.
return _navigationManager.GoToAsync(state, animate, false);
}

Expand All @@ -1054,6 +1055,7 @@ public Task GoToAsync(ShellNavigationState state, IDictionary<string, object> pa
/// <returns>A task that represents the asynchronous navigation operation.</returns>
public Task GoToAsync(ShellNavigationState state, bool animate, IDictionary<string, object> parameters)
{
IsAnimateOnNavigation = animate;
Copy link

Copilot AI Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment to IsAnimateOnNavigation is repeated across multiple GoToAsync overloads; consider refactoring this duplication into a common helper method or a centralized assignment to improve maintainability.

Copilot uses AI. Check for mistakes.
return _navigationManager.GoToAsync(state, animate, false, parameters: new ShellRouteParameters(parameters));
}

Expand All @@ -1077,6 +1079,7 @@ public Task GoToAsync(ShellNavigationState state, ShellNavigationQueryParameters
/// <returns></returns>
public Task GoToAsync(ShellNavigationState state, bool animate, ShellNavigationQueryParameters shellNavigationQueryParameters)
{
IsAnimateOnNavigation = animate;
Copy link

Copilot AI Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment to IsAnimateOnNavigation is repeated across multiple GoToAsync overloads; consider refactoring this duplication into a common helper method or a centralized assignment to improve maintainability.

Copilot uses AI. Check for mistakes.
return _navigationManager.GoToAsync(state, animate, false, parameters: new ShellRouteParameters(shellNavigationQueryParameters));
}

Expand Down Expand Up @@ -1178,6 +1181,7 @@ public Task GoToAsync(ShellNavigationState state, bool animate, ShellNavigationQ
ShellNavigationManager _navigationManager;
ShellFlyoutItemsManager _flyoutManager;
Page _previousPage;
internal bool IsAnimateOnNavigation = true;

/// <include file="../../../docs/Microsoft.Maui.Controls/Shell.xml" path="//Member[@MemberName='.ctor']/Docs/*" />
public Shell()
Expand Down
Loading