diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml new file mode 100644 index 000000000..99ea892a0 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml.cs new file mode 100644 index 000000000..5ba29c6d8 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9305.xaml.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms.CustomAttributes; +using System.Collections.Generic; + +#if UITEST +using Xamarin.Forms.Core.UITests; +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Issue(IssueTracker.Github, 9305, "Swipe View BackgroundColor Issues", PlatformAffected.Android | PlatformAffected.iOS)] + public partial class Issue9305 : TestContentPage + { + public Issue9305() + { +#if APP + Device.SetFlags(new List { ExperimentalFlags.SwipeViewExperimental }); + Title = "Issue 9305"; + InitializeComponent(); +#endif + } + + protected override void Init() + { + + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index af3d59103..e579c905c 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -1268,6 +1268,7 @@ + @@ -1418,6 +1419,10 @@ + + Designer + MSBuild:UpdateDesignTimeXaml + MSBuild:UpdateDesignTimeXaml @@ -1834,4 +1839,4 @@ MSBuild:UpdateDesignTimeXaml - \ No newline at end of file + diff --git a/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs index a45370f75..d8dc5c64f 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs @@ -28,7 +28,6 @@ namespace Xamarin.Forms.Platform.Android public class SwipeViewRenderer : ViewRenderer, GestureDetector.IOnGestureListener { const int SwipeThreshold = 250; - const int SwipeThresholdMargin = 0; const int SwipeItemWidth = 100; const long SwipeAnimationDuration = 200; const float SwipeMinimumDelta = 10f; @@ -141,7 +140,7 @@ namespace Xamarin.Forms.Platform.Android SetBackgroundColor(backgroundColor); - if (Element.Content == null) + if (Element.Content == null || (Element.Content != null && Element.Content.BackgroundColor == Color.Default)) _contentView?.SetBackgroundColor(backgroundColor); } else @@ -578,7 +577,7 @@ namespace Xamarin.Forms.Platform.Android void UpdateSwipeItems() { - if (_contentView == null) + if (_contentView == null || _actionView != null) return; var items = GetSwipeItemsByDirection(); @@ -730,7 +729,7 @@ namespace Xamarin.Forms.Platform.Android { if (_actionView != null) { - RemoveView(_actionView); + _actionView.RemoveFromParent(); _actionView.Dispose(); _actionView = null; } @@ -1019,13 +1018,13 @@ namespace Xamarin.Forms.Platform.Android if (swipeThreshold > contentWidth) swipeThreshold = contentWidth; - return swipeThreshold - SwipeThresholdMargin; + return swipeThreshold; } if (swipeThreshold > contentHeight) swipeThreshold = contentHeight; - return swipeThreshold - SwipeThresholdMargin / 2; + return swipeThreshold; } Size GetSwipeItemSize(ISwipeItem swipeItem) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs index afc1c9241..f69aac771 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs @@ -14,7 +14,6 @@ namespace Xamarin.Forms.Platform.iOS public class SwipeViewRenderer : ViewRenderer { const double SwipeThreshold = 250; - const int SwipeThresholdMargin = 0; const double SwipeItemWidth = 100; const double SwipeAnimationDuration = 0.2; const double SwipeMinimumDelta = 10; @@ -148,7 +147,7 @@ namespace Xamarin.Forms.Platform.iOS { BackgroundColor = Element.BackgroundColor.ToUIColor(); - if (_contentView != null && Element.Content == null) + if (_contentView != null && (Element.Content == null || (Element.Content != null && Element.Content.BackgroundColor == Color.Default))) _contentView.BackgroundColor = Element.BackgroundColor.ToUIColor(); } else @@ -916,13 +915,13 @@ namespace Xamarin.Forms.Platform.iOS if (swipeThreshold > _contentView.Frame.Width) swipeThreshold = _contentView.Frame.Width; - return swipeThreshold - SwipeThresholdMargin; + return swipeThreshold; } if (swipeThreshold > _contentView.Frame.Height) swipeThreshold = _contentView.Frame.Height; - return swipeThreshold - SwipeThresholdMargin / 2; + return swipeThreshold; } Size GetSwipeItemSize(ISwipeItem swipeItem)