-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ScrollView frozen in iOS when data is loaded async #9209
Copy link
Copy link
Closed
Labels
area-controls-scrollviewScrollViewScrollViewfixed-in-7.0.100fixed-in-7.0.101fixed-in-7.0.58Look for this fix in 7.0.58!Look for this fix in 7.0.58!fixed-in-8.0.0-preview.1.7762Look for this fix in 8.0.0-preview.1.7762!Look for this fix in 8.0.0-preview.1.7762!platform/iost/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
ScrollView populated via an async operation does not scroll in iOS. It scrolls fine on Maccatalyst and Windows using mouse scroller.
.NET Version: 6.0.400-preview.22330.6
Steps to Reproduce
- Create a default maui project via command line
dotnet new maui -n "maui-repro" - In MainPage.cs add the following code:
using System.Collections.ObjectModel;
namespace maui_repro;
public partial class MainPage : ContentPage
{
public ObservableCollection<AnimalItem> AnimalItems { get; private set; } = new ObservableCollection<AnimalItem>();
public MainPage()
{
InitializeComponent();
LoadMauiAsset();
BindingContext = this;
}
async Task LoadMauiAsset()
{
await Task.Delay(500);
for (int i = 0; i < 30; i++)
{
var item = new AnimalItem();
item.EnglishContent = "FOR the most wild, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in a case where my very senses reject their own evidence. Yet, mad am I not -- and very surely do I not dream. But to-morrow I die, and to-day I would unburthen my soul. My immediate purpose is to place before the world, plainly, succinctly, and without comment, a series of mere household events. In their consequences, these events have terrified -- have tortured -- have destroyed me. Yet I will not attempt to expound them. To me, they have presented little but Horror -- to many they will seem less terrible than barroques. Hereafter, perhaps, some intellect may be found which will reduce my phantasm to the common-place -- some intellect more calm, more logical, and far less excitable than my own, which will perceive, in the circumstances I detail with awe, nothing more than an ordinary succession of very natural causes and effects.";
AnimalItems.Add(item);
}
}
}
public class AnimalItem
{
public string EnglishContent { get; set; }
}- In MainPage.xaml add the following XAML
<?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_repro.MainPage">
<ScrollView Grid.Row="0" VerticalOptions="FillAndExpand">
<VerticalStackLayout BindableLayout.ItemsSource="{Binding AnimalItems}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="8" Margin="10,5">
<Label Text="{Binding EnglishContent}" TextColor="Black"/>
</Frame>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</ScrollView>
</ContentPage>Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 15
Did you find any workaround?
No. I've tried running LoadMauiAsset() inside of OnNavigated event as well as by wrapping it inside of MainThread.BeginInvokeOnMainThread but neither worked.
Relevant log output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-scrollviewScrollViewScrollViewfixed-in-7.0.100fixed-in-7.0.101fixed-in-7.0.58Look for this fix in 7.0.58!Look for this fix in 7.0.58!fixed-in-8.0.0-preview.1.7762Look for this fix in 8.0.0-preview.1.7762!Look for this fix in 8.0.0-preview.1.7762!platform/iost/bugSomething isn't workingSomething isn't working