Skip to content
Merged
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue25581.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue25581"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues">

<VerticalStackLayout>
<Button Text="Change Scale"
AutomationId="Button"
Clicked="Button_Clicked"/>
<Editor
x:Name="editor"
Text="1234567890"
Background="Red"
FontSize="32"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"/>

</VerticalStackLayout>
</ContentPage>
15 changes: 15 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue25581.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 25581, "Editor Scaling creating new lines on older iOS versions", PlatformAffected.iOS)]
public partial class Issue25581 : ContentPage
{
public Issue25581()
{
InitializeComponent();
}

private void Button_Clicked(object sender, EventArgs e)
{
editor.Scale = 0.5;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#if !MACCATALYST
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue25581 : _IssuesUITest
{
public override string Issue => "Editor Scaling creating new lines on older iOS versions";

public Issue25581(TestDevice device)
: base(device)
{ }

[Test]
[Category(UITestCategories.Editor)]
public void VerifyDynamicEditorScaling()
{
App.WaitForElement("Button");
App.Tap("Button");

VerifyScreenshot();
}
}
}
#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/Core/src/Handlers/Editor/EditorHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ protected override void DisconnectHandler(MauiTextView platformView)
_proxy.Disconnect(platformView);
}

public override bool NeedsContainer
{
get
{
// The layout of the Editor behaves differently on iOS 16 and earlier versions when the size or scale changes at runtime.
// https://github.com/dotnet/maui/issues/25581 - The content height gradually increases when scaling down the Editor, indicating improper handling of sizing.
// It appears that iOS 17.0 manages this correctly.
// To ensure consistent behavior that matches iOS 17.0, we wrap the Editor in a container on iOS 16 and earlier versions.
if (!OperatingSystem.IsIOSVersionAtLeast(17) && !OperatingSystem.IsMacCatalyst())
{
return true;
}

return base.NeedsContainer;
}
}

public override Size GetDesiredSize(double widthConstraint, double heightConstraint)
{
if (double.IsInfinity(widthConstraint) || double.IsInfinity(heightConstraint))
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ static Microsoft.Maui.ViewExtensions.DisconnectHandlers(this Microsoft.Maui.IVie
override Microsoft.Maui.Platform.MauiCALayer.AddAnimation(CoreAnimation.CAAnimation! animation, string? key) -> void
*REMOVED*override Microsoft.Maui.Handlers.BorderHandler.ConnectHandler(Microsoft.Maui.Platform.ContentView! platformView) -> void
override Microsoft.Maui.Handlers.BorderHandler.PlatformArrange(Microsoft.Maui.Graphics.Rect rect) -> void
override Microsoft.Maui.Handlers.EditorHandler.NeedsContainer.get -> bool
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ static Microsoft.Maui.ViewExtensions.DisconnectHandlers(this Microsoft.Maui.IVie
override Microsoft.Maui.Platform.MauiCALayer.AddAnimation(CoreAnimation.CAAnimation! animation, string? key) -> void
*REMOVED*override Microsoft.Maui.Handlers.BorderHandler.ConnectHandler(Microsoft.Maui.Platform.ContentView! platformView) -> void
override Microsoft.Maui.Handlers.BorderHandler.PlatformArrange(Microsoft.Maui.Graphics.Rect rect) -> void
override Microsoft.Maui.Handlers.EditorHandler.NeedsContainer.get -> bool