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

[iOS] Updating the text of a label destroys the ScrollView layout #18496

Closed
hwsmo opened this issue Nov 3, 2023 · 3 comments
Closed

[iOS] Updating the text of a label destroys the ScrollView layout #18496

hwsmo opened this issue Nov 3, 2023 · 3 comments
Labels
area-controls-scrollview ScrollView i/regression This issue described a confirmed regression on a currently supported version platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@hwsmo
Copy link

hwsmo commented Nov 3, 2023

Description

If the text of a label in a ScrollView is updated, then it destroys the layout of the ScrollView.

Bug is only see in iOS. There are no problems on Android and Windows.

Version wich bug:
[8.0.0-rc.2.9511]

The bug did not occur in version 8.0.0-rc.2.9373!

Steps to Reproduce

  1. Create a new project > New .NET MAUI App
  2. Create a page with a lots of labels in a ScrollView and with one label (named "ViewCounter") far below.
  3. In the code behind, we start a dispatcher timer and update the text of the "ViewCounter" label every 5 seconds.
  4. Start the test app and scroll to the “ViewCounter” label.
  5. Wait and admire the bug ;o)

MainPage XAML:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
  x:Class="HW_Playground.MainPage"
  xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

  <ScrollView
    Orientation="Vertical"
    VerticalOptions="FillAndExpand"
    VerticalScrollBarVisibility="Always">
    <VerticalStackLayout
      Padding="30,0"
      Spacing="25"
      VerticalOptions="Center">
      <Image
        HeightRequest="200"
        HorizontalOptions="Center"
        SemanticProperties.Description="Cute dot net bot waving hi to you!"
        Source="dotnet_bot.png" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        x:Name="ViewCounter"
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="COUNTER"
        TextColor="Red" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
      <Label
        FontSize="32"
        HorizontalOptions="Center"
        SemanticProperties.HeadingLevel="Level1"
        Text="Hello, World!" />
    </VerticalStackLayout>
  </ScrollView>

</ContentPage>

MainPage Code Behind:

namespace HW_Playground;

public partial class MainPage : ContentPage
{
  int count = 0;

  public MainPage()
  {
    InitializeComponent();
  }


  protected override void OnAppearing()
  {
    base.OnAppearing();

    Timer.Start();
  }

  private IDispatcherTimer Timer
  {
    get
    {
      if ( _timer == null )
      {
        _timer = Dispatcher.CreateTimer();
        _timer.Interval = TimeSpan.FromSeconds( 5 );
        _timer.Tick += Tick;
      }

      return _timer;
    }
  }
  private IDispatcherTimer? _timer;


  int counter = 1;
  private void Tick( object? _sender, EventArgs _eventArgs )
  {
    ViewCounter.Text = $"Counter: {counter++}";
  }

}

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-rc.2.9373

Affected platforms

iOS

Affected platform versions

iOS 17.0.3

Did you find any workaround?

Not yet.

Relevant log output

No response

@hwsmo hwsmo added the t/bug Something isn't working label Nov 3, 2023
@PureWeen PureWeen added this to the .NET 8 SR1 milestone Nov 3, 2023
@PureWeen PureWeen added potential-regression This issue described a possible regression on a currently supported version., verification pending i/regression This issue described a confirmed regression on a currently supported version and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Nov 3, 2023
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Nov 6, 2023
@mattleibow
Copy link
Member

@hwsmo I just want to see if I am seeing the same bug, but it is when you scroll and then the content updates there is a massive padding at the top and scrolling is off?

@hwsmo
Copy link
Author

hwsmo commented Nov 7, 2023

@mattleibow Exactly, that's the bug!

@mattleibow
Copy link
Member

Duplicate of #18513

@mattleibow mattleibow marked this as a duplicate of #18513 Nov 7, 2023
@mattleibow mattleibow closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
@Eilon Eilon removed the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-scrollview ScrollView i/regression This issue described a confirmed regression on a currently supported version platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants