xamarin/Xamarin.Forms

[Bug] Navigated event fired at startup for custom WebView on Android

Aberta

#8.954 aberto em 18 de dez. de 2019

 (4 comentários) (0 reação) (0 responsável)C# (1.926 forks)batch import
a/customrenderera/webviewe/5 :clock5:help wantedin-progressp/Androidt/bug :bug:up-for-grabs

Métricas do repositório

Stars
 (5.644 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Description

If you create a custom renderer for Android WebView, the Navigated event is called during app startup. This results in behavior that Navigated event is called twice after launching the app.

  • The first call is when the app is starting - INCORRECT
  • The second call is when the page is loaded - CORRECT

Steps to Reproduce

  1. Download and open this project: App2.zip

  2. Put a breakpoint in this line in MainPage.xaml.cs

Debug.WriteLine("Navigated");
  1. Launch the app on Android.
  2. As you can see Navigated event is called twice. The first call is when the app is starting (during splash screen). Navigated event definitely should not be called at this moment.

Expected Behavior

Navigated event should be called only when the WebView page is loaded.

Actual Behavior

On Android Navigated event is also called during app startup.

Basic Information

  • Version with issue: 4.4.0.991265
  • IDE: Visual Studio 2019 16.4.1
  • Platform Target Frameworks:
    • Android: 9.0 (Pie)

Guia do colaborador