-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed Shell.NavBarHasShadow on Android #20188
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
Conversation
Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -101,6 +101,11 @@ void OnToggleFlyoutBackgroundColor(object sender, EventArgs e) | |||
flyoutBackgroundColor.Background = AppShell.FlyoutBackground; | |||
} | |||
|
|||
void OnToggleNavBarHasShadow(object sender, EventArgs e) | |||
{ | |||
Shell.SetNavBarHasShadow(this, !Shell.GetNavBarHasShadow(this)); |
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.
Updated the Shell sample to easily test the NavBarHasShadow
property.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
[Theory] | ||
[InlineData(true)] | ||
[InlineData(false)] | ||
public async Task CanHideNavBarShadow(bool navBarHasShadow) |
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.
Added Device Tests.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -561,15 +561,15 @@ void UpdateNavBarHasShadow(Page page) | |||
if (page == null || !_appBar.IsAlive()) | |||
return; | |||
|
|||
// 4 is the default | |||
_appBarElevation = _appBar.Context.ToPixels(4); |
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.
The point of the original code was to reduce the amount of calls to _appBar.Context
. The original code did a really bad job of it :-)
Maybe something like this? I think this is what the original author was intending.
if (Shell.GetNavBarHasShadow(page))
{
if (_appBarElevation <= 0)
_appBarElevation = _appBar.Context.ToPixels(4);
_appBar.SetElevation(_appBarElevation);
}
else
{
// 4 is the default
_appBar.SetElevation(0f);
}
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.
Changed, thanks!
Failing tests unrelated |
Description of Change
Fixed Shell.NavBarHasShadow on Android
Issues Fixed
Fixes #19458
Screen.Recording.2024-01-27.at.01.14.23.mov