-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] - Fixed the performance issue that occurred when updating the Spacing in CollectionView for both Vertical List and Grid layouts #29635
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,5 @@ virtual Microsoft.Maui.Controls.BindableProperty.CreateDefaultValueDelegate<TDec | |
| ~virtual Microsoft.Maui.Controls.BindableProperty.ValidateValueDelegate<TPropertyType>.Invoke(Microsoft.Maui.Controls.BindableObject bindable, TPropertyType value) -> bool | ||
| ~virtual Microsoft.Maui.Controls.CollectionSynchronizationCallback.Invoke(System.Collections.IEnumerable collection, object context, System.Action accessMethod, bool writeAccess) -> void | ||
| ~virtual Microsoft.Maui.Controls.Internals.EvaluateJavaScriptDelegate.Invoke(string script) -> System.Threading.Tasks.Task<string> | ||
| ~virtual Microsoft.Maui.Controls.PropertyChangingEventHandler.Invoke(object sender, Microsoft.Maui.Controls.PropertyChangingEventArgs e) -> void | ||
| ~virtual Microsoft.Maui.Controls.PropertyChangingEventHandler.Invoke(object sender, Microsoft.Maui.Controls.PropertyChangingEventArgs e) -> void | ||
| ~override Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2.DisconnectHandler(UIKit.UIView platformView) -> void | ||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| using System.Collections.ObjectModel; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 27666, "Vertical list and Vertical grid pages have different abnormal behaviors when clicking Update after changing the spacing value", PlatformAffected.iOS | PlatformAffected.macOS)] | ||
|
|
||
| public class Issue27666_NavigationPage : TestNavigationPage | ||
| { | ||
| protected override void Init() | ||
| { | ||
| var root = CreateRootContentPage(); | ||
| PushAsync(root); | ||
| } | ||
|
|
||
| ContentPage CreateRootContentPage() | ||
| { | ||
| ContentPage ContentPage = new ContentPage(); | ||
|
|
||
| VerticalStackLayout rootLayout = new VerticalStackLayout | ||
| { | ||
| Spacing = 10, | ||
| Padding = new Thickness(10), | ||
| }; | ||
|
|
||
| Button collectionViewButton = new Button | ||
| { | ||
| Text = "Navigate to VerticalList CollectionView", | ||
| AutomationId = "NavigationButton" | ||
| }; | ||
| collectionViewButton.Clicked += (s, e) => Navigation.PushAsync(new Issue27666()); | ||
|
|
||
| rootLayout.Add(collectionViewButton); | ||
| ContentPage.Content = rootLayout; | ||
| return ContentPage; | ||
| } | ||
| } | ||
|
|
||
| public partial class Issue27666 : ContentPage | ||
| { | ||
| ObservableCollection<string> items; | ||
|
|
||
| public Issue27666() | ||
| { | ||
| InitializeComponent(); | ||
| items = new ObservableCollection<string>(Enumerable.Range(1, 30).Select(i => $"Item {i}")); | ||
| collectionView.ItemsSource = items; | ||
| } | ||
|
|
||
| private void OnItemSpacingButtonClicked(object sender, EventArgs e) | ||
| { | ||
| if (collectionView.ItemsLayout is LinearItemsLayout layout) | ||
| { | ||
| layout.ItemSpacing = layout.ItemSpacing == 0 ? 50 : 20; | ||
| } | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
src/Controls/tests/TestCases.HostApp/Issues/Issue27666.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?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.Issue27666"> | ||
|
|
||
| <Grid RowSpacing="5"> | ||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="Auto"/> | ||
| <RowDefinition Height="*"/> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <Button Grid.Row="0" | ||
| Text="Update ItemSpacing" | ||
| AutomationId="UpdateItemSpacingButton" | ||
| Clicked="OnItemSpacingButtonClicked"/> | ||
|
|
||
| <CollectionView x:Name="collectionView" | ||
| Grid.Row="1" | ||
| AutomationId="ItemsLayoutCollectionView" | ||
| ItemsLayout="HorizontalList"> | ||
| <CollectionView.ItemTemplate> | ||
| <DataTemplate> | ||
| <Border Padding="10" | ||
| Margin="5" | ||
| BackgroundColor="LightGray"> | ||
| <Label Text="{Binding .}"/> | ||
| </Border> | ||
| </DataTemplate> | ||
| </CollectionView.ItemTemplate> | ||
| </CollectionView> | ||
| </Grid> | ||
| </ContentPage> |
30 changes: 30 additions & 0 deletions
30
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27666.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue27666 : _IssuesUITest | ||
| { | ||
| public override string Issue => "Vertical list and Vertical grid pages have different abnormal behaviors when clicking Update after changing the spacing value"; | ||
| const string UpdateItemSpacingButton = "UpdateItemSpacingButton"; | ||
| const string ItemsLayoutCollectionView = "ItemsLayoutCollectionView"; | ||
| const string NavigationButton = "NavigationButton"; | ||
| public Issue27666(TestDevice device) : base(device) { } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.CollectionView)] | ||
| public void VerifySpacingUpdateInItemsLayout() | ||
| { | ||
| App.WaitForElement(NavigationButton); | ||
| App.Tap(NavigationButton); | ||
| App.WaitForElement(ItemsLayoutCollectionView); | ||
| App.Tap(UpdateItemSpacingButton); | ||
| App.TapBackArrow(); | ||
| App.WaitForElement(NavigationButton); | ||
| App.Tap(NavigationButton); | ||
| App.WaitForElement(ItemsLayoutCollectionView); | ||
| App.Tap(UpdateItemSpacingButton); | ||
| App.WaitForElement(ItemsLayoutCollectionView); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The introduction of a new override for DisconnectHandler in the public API could constitute a breaking change. Please ensure that the public documentation is updated accordingly and that consumers are aware of this update.