-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
area-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutfixed-in-8.0.10fixed-in-9.0.0-preview.2.10293migration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-ConvertXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertp/1Work that is important, and has been scheduled for release in this or an upcoming sprintWork that is important, and has been scheduled for release in this or an upcoming sprintpartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withthis is an issue that impacts one of our partners or a customer our advisory team is engaged withplatform/ioss/needs-attentionIssue has more information and needs another lookIssue has more information and needs another lookt/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
Using the handler below to remove white space around the TitleView, the Shell TitleView does not occupy the requested height, unless we change tabs.
Example in the screenshots attached if we navigate from "General" to "Crew" the title view height adjusts itself and now occupies the right height.
using Microsoft.Maui.Controls.Platform.Compatibility;
using UIKit;
namespace CustomShellTitleView;
internal class CustomShellNavBarAppearanceTracker : IShellNavBarAppearanceTracker
{
readonly IShellContext _context;
readonly IShellNavBarAppearanceTracker _baseTracker;
public CustomShellNavBarAppearanceTracker(IShellContext context, IShellNavBarAppearanceTracker baseTracker)
{
_context = context;
_baseTracker = baseTracker;
}
public void Dispose() => _baseTracker.Dispose();
public void ResetAppearance(UINavigationController controller) => _baseTracker.ResetAppearance(controller);
public void SetAppearance(UINavigationController controller, ShellAppearance appearance) => _baseTracker.SetAppearance(controller, appearance);
public void SetHasShadow(UINavigationController controller, bool hasShadow) => _baseTracker.SetHasShadow(controller, hasShadow);
public void UpdateLayout(UINavigationController controller)
{
UIView titleView = Shell.GetTitleView(_context.Shell.CurrentPage).Handler.PlatformView as UIView;
UIView parentView = GetParentByType(titleView, typeof(UIKit.UIControl));
if (parentView != null)
{
NSLayoutConstraint.Create(parentView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, parentView.Superview, NSLayoutAttribute.Leading, 1.0f, 0.0f).Active = true;
NSLayoutConstraint.Create(parentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, parentView.Superview, NSLayoutAttribute.Trailing, 1.0f, 0.0f).Active = true;
NSLayoutConstraint.Create(parentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, parentView.Superview, NSLayoutAttribute.Bottom, 1.0f, 0.0f).Active = true;
NSLayoutConstraint.Create(parentView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, parentView.Superview, NSLayoutAttribute.Top, 1.0f, 0.0f).Active = true;
}
_baseTracker.UpdateLayout(controller);
}
static UIView GetParentByType(UIView view, Type type)
{
UIView currentView = view;
while (currentView != null)
{
if (currentView.GetType().UnderlyingSystemType == type)
break;
currentView = currentView.Superview;
}
return currentView;
}
}
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.0-rc.2.9373
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
change tabs; pages that have no tabs have no workaround.
Relevant log output
No response
Metadata
Metadata
Assignees
Labels
area-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutfixed-in-8.0.10fixed-in-9.0.0-preview.2.10293migration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-ConvertXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertp/1Work that is important, and has been scheduled for release in this or an upcoming sprintWork that is important, and has been scheduled for release in this or an upcoming sprintpartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withthis is an issue that impacts one of our partners or a customer our advisory team is engaged withplatform/ioss/needs-attentionIssue has more information and needs another lookIssue has more information and needs another lookt/bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done