dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.27k stars 1.76k forks source link

CharacterSpacing is not working on iOS after clearing textbox #16971

Open mattiascibien opened 1 year ago

mattiascibien commented 1 year ago

Description

When using an Entry with CharacterSpacing specified and clearing all the text (using backspace) in an entry I found out that when typing text back the CharacterSpacing it seems that it is not correct anymore (like it is set to 0).

Steps to Reproduce

  1. Create a new MAUI project
  2. Add an Entry with CharacterSpacing
  3. Delete all the text in the Entry
  4. Type Text again
  5. Check that the CharacterSpacing is not correct

Link to public reproduction project repository

https://github.com/mattiascibien/TestCharacterSpacing

Version with bug

7.0.92

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.X

Did you find any workaround?

Adding this code should suffice and does not incur in problems with rendering

private void InputView_OnTextChanged(object? sender, TextChangedEventArgs e)
{
    if (sender as Entry is { } entry)
    {
        var characterSpacing = entry.CharacterSpacing;
        entry.CharacterSpacing = 0;
        entry.CharacterSpacing = characterSpacing;
    }
}

Relevant log output

No response

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

PureWeen commented 1 year ago

If you get a chance can you test this on .NET8 to see if it's still an issue?

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.8.0 Preview 1.0. Repro on iOS 16.4 .NET 8, not repro on Windows 11 and Android 13.0-API33 with below Project: TestCharacterSpacing.zip

spacing