-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] SwipeView Closes when Content Changes - fix #29088
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
Merged
Merged
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
46 changes: 46 additions & 0 deletions
46
src/Controls/tests/TestCases.HostApp/Issues/Issue29086.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,46 @@ | ||
| <?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:Name="Self" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue29086"> | ||
| <CollectionView ItemsSource="{Binding Numbers}" | ||
| Margin="60"> | ||
| <CollectionView.ItemTemplate> | ||
| <DataTemplate> | ||
| <SwipeView> | ||
| <SwipeView.LeftItems> | ||
| <SwipeItems | ||
| Mode="Reveal" | ||
| SwipeBehaviorOnInvoked="RemainOpen"> | ||
| <SwipeItemView> | ||
| <Button | ||
| Text="+" | ||
| AutomationId="AddButton" | ||
| WidthRequest="40" | ||
| BackgroundColor="LightGreen" | ||
| Command="{Binding Source={x:Reference Self}, Path=IncrementCommand}" | ||
| CommandParameter="{Binding .}"/> | ||
| </SwipeItemView> | ||
| <SwipeItemView> | ||
| <Button | ||
| Text="-" | ||
| WidthRequest="40" | ||
| BackgroundColor="LightCoral" | ||
| Command="{Binding Source={x:Reference Self}, Path=DecrementCommand}" | ||
| CommandParameter="{Binding .}"/> | ||
| </SwipeItemView> | ||
| </SwipeItems> | ||
| </SwipeView.LeftItems> | ||
|
|
||
| <Grid Padding="10" | ||
| AutomationId="SwipeItem" | ||
| BackgroundColor="LightBlue"> | ||
| <Label Text="{Binding Value}" | ||
| FontSize="18" | ||
| HorizontalOptions="Center"/> | ||
| </Grid> | ||
| </SwipeView> | ||
| </DataTemplate> | ||
| </CollectionView.ItemTemplate> | ||
| </CollectionView> | ||
| </ContentPage> |
37 changes: 37 additions & 0 deletions
37
src/Controls/tests/TestCases.HostApp/Issues/Issue29086.xaml.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,37 @@ | ||
| using System.Collections.ObjectModel; | ||
| using System.Windows.Input; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 29086, "SwipeView Closes when Content Changes even with SwipeBehaviorOnInvoked='RemainOpen'", PlatformAffected.iOS)] | ||
| public partial class Issue29086 : ContentPage | ||
| { | ||
| public ObservableCollection<NumberItem> Numbers { get; set; } | ||
| public ICommand IncrementCommand { get; } | ||
| public ICommand DecrementCommand { get; } | ||
|
|
||
| public Issue29086() | ||
| { | ||
| InitializeComponent(); | ||
|
|
||
| Numbers = new ObservableCollection<NumberItem> | ||
| { | ||
| new NumberItem { Value = 1 }, | ||
| }; | ||
|
|
||
| IncrementCommand = new Command<NumberItem>((item) => item.Value++); | ||
| DecrementCommand = new Command<NumberItem>((item) => item.Value--); | ||
|
|
||
| BindingContext = this; | ||
| } | ||
|
|
||
| public class NumberItem : ViewModelBase | ||
| { | ||
| int _value; | ||
| public int Value | ||
| { | ||
| get => _value; | ||
| set { _value = value; OnPropertyChanged(); } | ||
| } | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29086.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,26 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue29086 : _IssuesUITest | ||
| { | ||
|
|
||
| public Issue29086(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "SwipeView Closes when Content Changes even with SwipeBehaviorOnInvoked='RemainOpen'"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.SwipeView)] | ||
| public void SwipeViewShouldNotClose() | ||
| { | ||
| App.WaitForElement("SwipeItem"); | ||
| App.SwipeLeftToRight("SwipeItem"); | ||
| App.Click("AddButton"); | ||
| App.Click("AddButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
Binary file modified
BIN
+4.64 KB
(120%)
...rols/tests/TestCases.iOS.Tests/snapshots/ios/ItemImageSourceShouldBeVisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.74 KB
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/SwipeViewShouldNotClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
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.
LGTM, just trigger a build. Pending test snapshots in all the platforms.