Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] OnAppearing not being called when modal page dismissed #5418

Closed
patridge opened this issue Feb 28, 2019 · 3 comments
Closed

[Android] OnAppearing not being called when modal page dismissed #5418

patridge opened this issue Feb 28, 2019 · 3 comments

Comments

@patridge
Copy link
Member

Description

When a modal page is dismissed, the page being revealed doesn't seem to get OnAppearing called on Android even though it does on iOS.

Steps to Reproduce

  1. Create a new Xamarin.Forms Blank app.
  2. In App.xaml.cs, set the app's MainPage to be a NavigationPage containing the template MainPage class.
  3. Create a second page with a button that calls await this.Navigation.PopModalAsync(); when clicked.
  4. In MainPage.xaml.cs, override OnAppearing and put a breakpoint in there to monitor progress.
  5. Run the app on Android (and optionally on iOS to compare)

Expected Behavior

The breakpoint in OnAppearing of the root page should be hit twice. Once as the page is loaded initially for the app and once when the modal page is dismissed.

Actual Behavior

On Android, OnAppearing is only called when the app loads, not when the modal page is dismissed.
On iOS, OnAppearing is called twice as expected.

Basic Information

  • Version with issue: v3.5.0.169047, v3.6.0.135200-pre1
  • Last known good version: presumably v2.3.2, based on prior fixed Bugzilla bug
  • IDE: Visual Studio 2019 preview
  • Platform Target Frameworks:
    • iOS: 12.6.0.23
    • Android: 9.2.0.1
  • Android Support Library Version: 28.0.0.1
  • Nuget Packages: NETStandard.Library, Newtonsoft.Json, Xamarin.Android.Support.*, Xamarin.Essentials, Xamarin.Forms
  • Affected Devices: Android API 27 emulator

Reproduction Link

Attached is a minimal repro example, but this also occurs in this Xamarin University course exercise 3 (exercise instructions), even when that app is copied into a fresh File > New Blank Xamarin.Forms solution. On Android, when you set the personalization information in the initial modal, it is not set on the root page. On iOS, it works as expected.

In the attached repro solution, after dismissing the initial modal page, you will see the difference on iOS and Android. On iOS, there will be two OnAppearing additions to the root label: one for the app loading the main page, and one for after the modal page is dismissed. On Android, though, there will only be one OnAppearing addition to the root label: one for the app loading the main page.

ReproModelDismissWithoutOnAppearing.zip

Screenshots

ios-repro-screenshot

android-repro-screenshot

@pkhandelwal-cdl
Copy link

pkhandelwal-cdl commented Apr 3, 2019

Confirmed this is occurring for Android in Xamarin.Forms 3.6.0.264807.
Another thing to note: If you background the app while the modal page is visible, upon foregrounding OnAppearing gets called on the root page instead of the modal page. The expected behavior here would be that OnAppearing gets called on the modal page since that is the visible/appearing page.

@ewroblewski-intelivert
Copy link

This issue appears in Xamarin.Forms 3.6.0.344457 as well.

@PureWeen
Copy link
Contributor

Consolidating OnAppearing issues here
#6919

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants