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.
Remove unnecessary UpdateConstraints calls when rotating (#12728)
* Remove unnecessary extra UpdateConstraints calls when rotating Fixes #12193 * Restore correct height measurement * Scroll to current position when Carousel appears * Fix position setting * Validate scrollto position on CarouselView before attempting to scroll
- Loading branch information
Showing
9 changed files
with
126 additions
and
52 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12193.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,93 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.Forms.Core.UITests; | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.CarouselView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 12193, "[Bug] CarouselView content disappears after 2 rotations if TextType=Html is used", | ||
PlatformAffected.iOS)] | ||
public class Issue12193 : TestContentPage | ||
{ | ||
public const string HTML = "HTML"; | ||
|
||
protected override void Init() | ||
{ | ||
#if APP | ||
Title = "CarouselView HTML Label"; | ||
|
||
var instructions = new Label { Text = $"Rotate the device, then rotate it back 3 times. If the label \"{HTML}\" disappears, this test has failed." }; | ||
|
||
var source = new List<string>(); | ||
for (int n = 0; n < 10; n++) | ||
{ | ||
source.Add($"Item: {n}"); | ||
} | ||
|
||
var template = new DataTemplate(() => | ||
{ | ||
var label = new Label | ||
{ | ||
TextType = TextType.Html, | ||
Text = $"<p style='background-color:red;'>{HTML}</p>", | ||
AutomationId = HTML | ||
}; | ||
return label; | ||
}); | ||
|
||
var cv = new CarouselView() | ||
{ | ||
ItemsSource = source, | ||
ItemTemplate = template, | ||
Loop = false | ||
}; | ||
|
||
var layout = new StackLayout(); | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(cv); | ||
|
||
Content = layout; | ||
#endif | ||
} | ||
|
||
|
||
#if UITEST | ||
[Test] | ||
public async Task RotatingCarouselViewHTMLShouldNotDisappear() | ||
{ | ||
int delay = 3000; | ||
|
||
RunningApp.SetOrientationPortrait(); | ||
await Task.Delay(delay); | ||
|
||
RunningApp.SetOrientationLandscape(); | ||
await Task.Delay(delay); | ||
|
||
RunningApp.SetOrientationPortrait(); | ||
await Task.Delay(delay); | ||
|
||
RunningApp.SetOrientationLandscape(); | ||
await Task.Delay(delay); | ||
|
||
RunningApp.SetOrientationPortrait(); | ||
await Task.Delay(delay); | ||
|
||
RunningApp.WaitForElement(HTML); | ||
} | ||
#endif | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -393,6 +393,5 @@ void UpdateEmptyViewVisibility(bool isEmpty) | |
_emptyViewDisplayed = false; | ||
} | ||
} | ||
|
||
} | ||
} |
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