This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fix swipe conflict between SwipeView and TabbedPage (#11358)
* Added repro sample * Updated sample * Added instructions to the sample * Fix the issue Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com> fixes #11314
- Loading branch information
1 parent
9a9b842
commit e966d64
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11314.cs
This file contains 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,118 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.SwipeView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11314, | ||
"Cannot swipe the swipeview inside a Listview[Bug]", | ||
PlatformAffected.Android)] | ||
public class Issue11314 : TestTabbedPage | ||
{ | ||
public Issue11314() | ||
{ | ||
#if APP | ||
Device.SetFlags(new List<string> { ExperimentalFlags.SwipeViewExperimental }); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
Title = "Issue 11314"; | ||
|
||
var page1 = new Issue11314Page("Page 1"); | ||
var page2 = new Issue11314Page("Page 2"); | ||
|
||
Children.Add(page1); | ||
Children.Add(page2); | ||
} | ||
} | ||
|
||
public class Issue11314Page : ContentPage | ||
{ | ||
public Issue11314Page(string title) | ||
{ | ||
Title = title; | ||
|
||
for (int i = 0; i < 5; i++) | ||
{ | ||
Items.Add(DateTime.Now.ToString()); | ||
} | ||
|
||
var layout = new StackLayout | ||
{ | ||
Padding = 0 | ||
}; | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "Try to open the SwipeView doing swipe, if you can open it, the test has passed." | ||
}; | ||
|
||
var listView = new ListView() | ||
{ | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
HasUnevenRows = true, | ||
ItemsSource = Items, | ||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
var itemLayout = new StackLayout(); | ||
var swipeView = new SwipeView(); | ||
var content = new Grid | ||
{ | ||
HeightRequest = 80, | ||
BackgroundColor = Color.LightGray | ||
}; | ||
content.Children.Add(new Label | ||
{ | ||
HorizontalOptions = LayoutOptions.Center, | ||
VerticalOptions = LayoutOptions.Center, | ||
Text = "Swipe to Left" | ||
}); | ||
swipeView.Content = content; | ||
var swipeItem = new SwipeItem | ||
{ | ||
BackgroundColor = Color.Red, | ||
Text = "Text" | ||
}; | ||
swipeView.RightItems = new SwipeItems | ||
{ | ||
swipeItem | ||
}; | ||
itemLayout.Children.Add(swipeView); | ||
return new ViewCell { View = itemLayout }; | ||
}) | ||
}; | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(listView); | ||
|
||
Content = layout; | ||
} | ||
|
||
public ObservableCollection<string> Items = new ObservableCollection<string>(); | ||
} | ||
} |
This file contains 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 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