Skip to content
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

White screen when changing the main page #26845

Open
AramMar opened this issue Dec 27, 2024 · 8 comments · May be fixed by #27361
Open

White screen when changing the main page #26845

AramMar opened this issue Dec 27, 2024 · 8 comments · May be fixed by #27361
Assignees
Labels
area-navigation NavigationPage i/regression This issue described a confirmed regression on a currently supported version platform/android 🤖 regressed-in-8.0.20 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@AramMar
Copy link

AramMar commented Dec 27, 2024

2024-12-27_16-36-48.mp4

Description

White screen when changing the main page, occurs on Android devices.

I organised navigation with modal pages. I open some Modal pages with PushModalAsync, then show first page MainPage = new LoginPage(); to make empty ModalStack and show LoginPage MainPage = new LoginPage()

App shows white screen.

Steps to Reproduce

Steps to Reproduce
Create new NET MAUI app.
Create new Pages.
Switch between pages.( MainPage = new TestPage())
Version with bug
8.0, 9.0

Affected platforms
Android

Link to public reproduction project repository

DXMauiApp5.zip

No response

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

No response

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No response

Relevant log output

@AramMar AramMar added the t/bug Something isn't working label Dec 27, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@AlleSchonWeg
Copy link
Contributor

Hi,
perhaps i'm wrong but i remember i had similar problem. You could try to add these values to your android styles.xml file:

	<style name="XXX" parent="Maui.MainTheme.NoActionBar">
		<item name="android:windowBackground">@color/YYY</item>
		<item name="android:windowIsTranslucent">false</item>
		<item name="android:windowTranslucentNavigation">false</item>
		<item name="android:windowTranslucentStatus">false</item>
	</style>

You have to replace name and perhaps parent with your values. Also "android:windowBackground". I'm not at work atm so i can't say exactly which item could help.

Good luck.

@Zhanglirong-Winnie Zhanglirong-Winnie added platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed i/regression This issue described a confirmed regression on a currently supported version labels Dec 30, 2024
@Zhanglirong-Winnie
Copy link

This issue has been verified Visual Studio 17.13 Preview2.1 (9.0.21 & 9.0.0 & 8.0.100 & 8.0.20). Can repro this issue on Android platform. But works fine on 8.0.14.

@AramMar
Copy link
Author

AramMar commented Dec 30, 2024

Hi, perhaps i'm wrong but i remember i had similar problem. You could try to add these values to your android styles.xml file:

<style name="XXX" parent="Maui.MainTheme.NoActionBar"> @color/YYY false false false </style>

You have to replace name and perhaps parent with your values. Also "android:windowBackground". I'm not at work atm so i can't say exactly which item could help.

Good luck.

I checked and unfortunately it does not fix the issue, still page blinked

@AramMar
Copy link
Author

AramMar commented Dec 30, 2024

This issue has been verified Visual Studio 17.13 Preview2.1 (9.0.21 & 9.0.0 & 8.0.100 & 8.0.20). Can repro this issue on Android platform. But works fine on 8.0.14.

the issue is exist on 8.0.14 version also

@AramMar
Copy link
Author

AramMar commented Dec 30, 2024

Hi @Redth, i checked some other sources also somehow related to this topic, f.ex.
#24903 (comment)

Maybe you have workaround for this issue also?

@vishnumenon2684 vishnumenon2684 added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 2, 2025
@vishnumenon2684 vishnumenon2684 self-assigned this Jan 2, 2025
@mattleibow mattleibow added this to the .NET 9 Servicing milestone Jan 4, 2025
@mattleibow mattleibow added the area-navigation NavigationPage label Jan 4, 2025
@vishnumenon2684 vishnumenon2684 removed the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 16, 2025
@vishnumenon2684 vishnumenon2684 removed their assignment Jan 16, 2025
@kubaflo
Copy link
Contributor

kubaflo commented Jan 26, 2025

The white blink occurs when setting a new page using the following code:Application.Current!.Windows[0].Page = new TestPage2()

Each time a new root page is assigned, a new layout is inflated, which contains a fragment intended to display the page. However, because Android's fragment manager requires a few milliseconds to commit the transition, a noticeable white blink can be seen during this process.

I created a similar setup in Android Studio that mimics the behavior of .NET MAUI. The same white blink issue occurs, confirming that it stems from the fragment manager’s transition delay.

https://github.com/kubaflo/Android_Blink_Bug

MAUI Android Native
Screen.Recording.2025-01-26.at.02.35.09.mov
Screen.Recording.2025-01-26.at.02.35.25.mov
namespace Maui.Controls.Sample;

public partial class App : Application
{
	public App() => InitializeComponent();

	protected override Window CreateWindow(IActivationState? activationState) => new Window(new Page1());
}

class Page1 : ContentPage
{
	public Page1()
	{
		BackgroundColor = Color.FromArgb("#009900");
		Content = new Button
		{
			Text = "Open page 2",
			VerticalOptions = LayoutOptions.End,
			HeightRequest = 40,
			Command = new Command(() => Application.Current!.Windows[0].Page = new Page2())
		};
	}

}

class Page2 : ContentPage
{
	public Page2()
	{
		BackgroundColor = Color.FromArgb("#990000");
		Content = new Button
		{
			Text = "Open page 1",
			VerticalOptions = LayoutOptions.End,
			HeightRequest = 40,
			Command = new Command(() => Application.Current!.Windows[0].Page = new Page1())
		};
	}
}

@mattleibow @PureWeen

@kubaflo kubaflo self-assigned this Jan 26, 2025
@kubaflo
Copy link
Contributor

kubaflo commented Jan 26, 2025

That being said, there's a way of how to fix it 😅 #27361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-navigation NavigationPage i/regression This issue described a confirmed regression on a currently supported version platform/android 🤖 regressed-in-8.0.20 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

7 participants