-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[.Net 10] Shell.SetNavBarVisibilityAnimationEnabled property #29279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.Net 10] Shell.SetNavBarVisibilityAnimationEnabled property #29279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new public property, NavBarVisibilityAnimationEnabled, to control whether navigation bar visibility changes are animated (currently only implemented for iOS). The key changes include:
- Adding the new attached BindableProperty and its getter/setter in Shell.cs with XML documentation.
- Updating PublicAPI.Unshipped.txt files across multiple platforms to include the new public API.
- Propagating the property in property propagation logic and using its value in iOS renderers to drive the navigation bar animation behavior.
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Controls/src/Core/Shell/Shell.cs | Added NavBarVisibilityAnimationEnabled property and related API methods. |
src/Controls/src/Core/PublicAPI/... | Updated public API definitions to reflect the newly added property. |
src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs | Propagated the new property from parent elements. |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs | Updated navigation bar hide logic to use the new animation flag. |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs | Incorporated the new property in updating navigation bar appearance. |
Files not reviewed (1)
- src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt: Language not supported
@@ -68,6 +68,12 @@ static void OnBackButonBehaviorPropertyChanged(BindableObject bindable, object o | |||
public static readonly BindableProperty NavBarIsVisibleProperty = | |||
BindableProperty.CreateAttached("NavBarIsVisible", typeof(bool), typeof(Shell), true, propertyChanged: OnNavBarIsVisibleChanged); | |||
|
|||
/// <summary> | |||
/// Determines if the navigation bar visibility change should be animated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider updating the documentation to explicitly mention that the current implementation of NavBarVisibilityAnimationEnabled only applies to iOS and does not affect Android/Windows behavior.
/// Determines if the navigation bar visibility change should be animated. | |
/// Determines if the navigation bar visibility change should be animated. | |
/// This property is currently only applicable on iOS and does not affect behavior on Android or Windows. |
Copilot uses AI. Check for mistakes.
/// </summary> | ||
/// <param name="obj">The object that retrieves the animation setting.</param> | ||
/// <returns><see langword="true"/> if the animation is enabled; otherwise, <see langword="false"/>.</returns> | ||
public static bool GetNavBarVisibilityAnimationEnabled(BindableObject obj) => (bool)obj.GetValue(NavBarVisibilityAnimationEnabledProperty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that tests in TestCases.HostApp and TestCases.Shared.Tests cover the behavior of the new NavBarVisibilityAnimationEnabled property, especially to verify that navigation bar animations behave as expected on iOS.
Copilot uses AI. Check for mistakes.
c1c55ed
to
1af5ea3
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -775,8 +774,6 @@ public override void WillShowViewController(UINavigationController navigationCon | |||
navBarVisible = Shell.GetNavBarIsVisible(element); | |||
} | |||
|
|||
navigationController.SetNavigationBarHidden(!navBarVisible, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure this doesn't break anything? What's the advantage of removing this line?
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
Show resolved
Hide resolved
4f8521a
to
2fde877
Compare
/rebase |
2fde877
to
f4bcacd
Compare
/rebase |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great!
Description of Change
This PR introduces a new public property:
NavBarVisibilityAnimationEnabled
For now, the implementation only applies to iOS. If support for Android/Windows is desired in the future, it can be added separately.
NavBarVisibilityAnimationEnabled is a bool property added to Shell. It controls whether the navigation bar's visibility changes are animated. The default value is true to preserve existing behavior.
Issues Fixed
Fixes #26994
Demo
Screen.Recording.2025-06-24.at.19.49.27.mov