Skip to content
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

fix(iOS): textbox selection clear button #18522

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Layouter/Layouter.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public IEnumerable<View> GetChildren()

protected Size MeasureChildOverride(View view, Size slotSize)
{
if (view is null)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinZikmund Looks like a proper fix may be needed :/

return default;
}

var ret = view
.SizeThatFits(slotSize.LogicalToPhysicalPixels())
.PhysicalToLogicalPixels()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ internal static Size GetDesiredSize(UIElement element)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Size GetDesiredSize(object view)
{
if (view is null)
{
// TODO: should we let it break or return default?
return default;
}

switch (view)
{
case UIElement iue:
Expand Down
5 changes: 4 additions & 1 deletion src/Uno.UI/UI/Xaml/Controls/StackPanel/StackPanel.Layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ protected override Size MeasureOverride(Size availableSize)

for (int i = 0; i < count; i++)
{
var view = Children[i];
if (Children[i] is not { } view)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see situations where one of the children is null, causing the app to behave wrongly. More specifically when tapping inside an iOS TextBox.

{
continue;
}

var measuredSize = MeasureElement(view, slotSize);
view.EnsureLayoutStorage();
Expand Down
Loading