dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

WebView loading issue #21870

Open linkaiyu opened 5 months ago

linkaiyu commented 5 months ago

Description

When WebView loads a source for the first time, it displays a blank area. It looks like a flash

please note: this problem also appears in NET7 and previous versions

Steps to Reproduce

  1. in a VS created MAUI default app, add to MainPage.xaml
  2. in the code behind, in the button click function, add: webView.Source = "https://bing.com";

Link to public reproduction project repository

https://github.com/linkaiyu/WebViewPerf

Version with bug

8.0.10 SR3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, Yes, this used to work in Xamarin.Forms, No, this is something new

Last version that worked well

7.0.101

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

no workaround found

Relevant log output

No response

Zhanglirong-Winnie commented 5 months ago

Verified this issue with Visual Studio 17.10.0 Preview 3(8.0.20&8.0.7&8.0.3&8.0.0-rc.2.9530). Can repro on windows platform whit sample project.

janne-hmp commented 5 months ago

I'm having the same issue with WebView on iOS in .NET MAUI 9.0 Preview 3.

bfunk-tt commented 3 months ago

this is extremely annoying. I have to open multiple different URLs and the only way to make that work right now is to make one page with a static web view and set the source manually on each. I can't pass the URL via query params and load the URL at launch in ApplyQueryAttributes.

RuddyOne commented 3 weeks ago

Are you seeing a black flash before content loads? If so I am have the same issue and am trying to find a workaround. Anyone have one?

The flash color seems to depend on the Windows color mode (e.g. Dark Mode)

Redth commented 5 days ago

I do believe I'm seeing this in a plain WinUI3 app without MAUI at all in the equation.

The flash is quicker on my machine and seems to be maybe only a single window flashing briefly, but it's definitely there and I would think is the same symptom.

I don't believe this is a MAUI specific issue at this point.

linkaiyu commented 5 days ago

@Redth , the originally reported problem is a delay of the screen rendering(with a flash). This time, the screen is blank with some of customer code. I've added you to the customer provided repro. Hope the repro may provide some additional info