Skip to content

Commit e9e6211

Browse files
kubafloCopilot
andcommitted
Address review: fix Windows Rect ambiguity, add iOS frame guard
- Use fully qualified Microsoft.Maui.Graphics.Rect in ShellTests to fix Windows compilation error (CS0246) - Add 'if (Shell.Frame != destination)' guard in iOS ShellRenderer to avoid unnecessary frame updates during layout passes - Remove unused 'using Microsoft.Maui.Graphics' import - Restore original whitespace formatting in using directives Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent befa081 commit e9e6211

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellRenderer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ public override void ViewDidLayoutSubviews()
142142
if (_currentShellItemRenderer != null)
143143
_currentShellItemRenderer.ViewController.View.Frame = View.Bounds;
144144

145-
Shell.Frame = View.Bounds.ToRectangle();
145+
var destination = View.Bounds.ToRectangle();
146+
if (Shell.Frame != destination)
147+
Shell.Frame = destination;
146148
}
147149

148150
public override void ViewDidLoad()

src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
using Microsoft.Maui.Controls.Handlers.Items;
1313
using Microsoft.Maui.Devices;
1414
using Microsoft.Maui.DeviceTests.Stubs;
15-
using Microsoft.Maui.Graphics;
1615
using Microsoft.Maui.Handlers;
1716
using Microsoft.Maui.Hosting;
1817
using Microsoft.Maui.Platform;
1918
using Xunit;
2019
using static Microsoft.Maui.DeviceTests.AssertHelpers;
20+
2121
#if ANDROID || IOS || MACCATALYST
2222
using ShellHandler = Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer;
23-
2423
#endif
2524

2625
#if IOS || MACCATALYST
@@ -1158,7 +1157,7 @@ public async Task SettingFrameDoesTriggerInvalidatedMeasure()
11581157
measureInvalidatedCount++;
11591158
};
11601159

1161-
shell.Frame = new Rect(0, 0, 100, 100);
1160+
shell.Frame = new Microsoft.Maui.Graphics.Rect(0, 0, 100, 100);
11621161

11631162
await CreateHandlerAndAddToWindow<IWindowHandler>(shell, _ =>
11641163
{

0 commit comments

Comments
 (0)