--- /dev/null
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using NUnit.Framework;
+using Xamarin.UITest;
+using Xamarin.Forms.Core.UITests;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Github, 6663, "Fix visibility of hidden pages in the stack", PlatformAffected.Gtk)]
+#if UITEST
+ [NUnit.Framework.Category(UITestCategories.Navigation)]
+#endif
+ public class Issue6663 : ContentPage
+ {
+ public Issue6663()
+ {
+ Title = "Issue 6663";
+ BackgroundColor = Color.Green;
+
+ var layout = new StackLayout();
+
+ var instructions = new Label
+ {
+ Text = "Press the button below to navigate to a new page. Navigate back and verify that the navigation bar is visible and the page is rendered correctly."
+ };
+
+ var navigateButton = new Button
+ {
+ Text = "Navigate"
+ };
+
+ navigateButton.Clicked += (sender, e) =>
+ {
+ Navigation.PushAsync(new Issue663SecondPage());
+ };
+
+ layout.Children.Add(instructions);
+ layout.Children.Add(navigateButton);
+
+ Content = layout;
+ }
+ }
+
+ internal class Issue663SecondPage : ContentPage
+ {
+ public Issue663SecondPage()
+ {
+ Title = "Issue 6663 SecondPage";
+ BackgroundColor = Color.Red;
+
+ var layout = new StackLayout();
+
+ var instructions = new Label
+ {
+ Text = "Press the button below to navigate back."
+ };
+
+ var navigateButton = new Button
+ {
+ Text = "Navigate Back"
+ };
+
+ navigateButton.Clicked += (sender, e) =>
+ {
+ Navigation.PopAsync();
+ };
+
+ layout.Children.Add(instructions);
+ layout.Children.Add(navigateButton);
+
+ Content = layout;
+ }
+ }
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Issue6127.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7283.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5395.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Issue6663.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8004.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7886.xaml.cs">
<DependentUpon>Issue7886.xaml</DependentUpon>
UWP = 1 << 4,
WPF = 1 << 5,
macOS = 1 << 6,
+ Gtk = 1 << 7,
All = ~0,
Default = 0
}
using Gdk;
using Gtk;
using System;
-using System.Linq;
using Xamarin.Forms.Platform.GTK.Extensions;
namespace Xamarin.Forms.Platform.GTK.Controls
_image.Pixbuf = await imageSource.GetNativeImageAsync();
}
- public void PushModal(Widget modal)
- {
- Children.Last().Hide();
- Attach(modal, 0, 1, 0, 1);
- modal.ShowAll();
- }
-
- public void PopModal(Widget modal)
- {
- if (Children.Length > 0)
- {
- Remove(modal);
- }
- Children.Last().Show();
- }
-
public override void Destroy()
{
base.Destroy();
Device.BeginInvokeOnMainThread(() =>
{
- pageControl?.Control?.PopModal(modalPage);
+ if (pageControl != null)
+ {
+ var page = pageControl.Control;
+
+ if (page != null)
+ {
+ if (page.Children.Length > 0)
+ {
+ page.Remove(modalPage);
+ }
+
+ if (page.Children != null)
+ {
+ foreach (var child in page.Children)
+ {
+ child.ShowAll();
+ }
+
+ page.ShowAll();
+ }
+ }
+ }
DisposeModelAndChildrenRenderers(modal);
});
if (page != null)
{
- page.PushModal(modalRenderer.Container);
+ page.Attach(modalRenderer.Container, 0, 1, 0, 1);
+
+ if (page.Children != null)
+ {
+ foreach (var child in page.Children)
+ {
+ child.ShowAll();
+ }
+
+ page.ShowAll();
+ }
}
}
});
if (oldPage != null && Platform.GetRenderer(oldPage) != null)
{
var oldPageRenderer = Platform.GetRenderer(oldPage);
- oldPageRenderer.Container.Visible = false;
+ oldPageRenderer.Container.Sensitive = false;
}
return true;
if (oldPage != null && Platform.GetRenderer(oldPage) != null)
{
var oldPageRenderer = Platform.GetRenderer(oldPage);
- oldPageRenderer.Container.Visible = true;
+ oldPageRenderer.Container.Sensitive = true;
}
(page as IPageController)?.SendDisappearing();