Bug 44211 - Android/Forms Tabpage OnDisappearing firing minimized
Summary: Android/Forms Tabpage OnDisappearing firing minimized
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.3
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
URL:
: 46914 49281 51574 58012 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-12 18:29 UTC by Andrew
Modified: 2018-01-10 15:01 UTC (History)
21 users (show)

Tags: android, fr, ac
Is this bug a regression?: ---
Last known good build:


Attachments
sample (1.01 MB, application/zip)
2016-09-12 18:29 UTC, Andrew
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Andrew 2016-09-12 18:29:23 UTC
Run Sample for Tabs Android Forms.

Click Push Page2.
Click Push Tab

Tab Message:
Tab2Page2 Appear (OK)
TabPage1 Appear (OK)
TabPage1 Disappear (WHY? wrong)
TabPage1 Appear (WHY 2 times?)
Tabpage2 Disappear (WHY?)

What I think should happen.
TabPage1 Appear
TabPage2 Appear

Referenced bug:  https://bugzilla.xamarin.com/show_bug.cgi?id=44160
Comment 1 Andrew 2016-09-12 18:29:50 UTC
Created attachment 17427 [details]
sample
Comment 2 Andrew 2016-09-12 18:30:12 UTC
created new bug for TabPage onAppear and OnDisappear.
Comment 3 adrianknight89 2016-09-12 18:40:58 UTC
Also referencing: https://bugzilla.xamarin.com/show_bug.cgi?id=43774
Comment 4 adrianknight89 2016-09-13 00:48:46 UTC
I added some discussion here: https://github.com/xamarin/Xamarin.Forms/pull/348
Comment 5 Marius Kahmen 2016-09-13 17:02:46 UTC
What I think should happen:
TabPage1 Appear.

Just like in iOS...
Comment 6 Andrew 2016-09-13 17:08:44 UTC
Marius: The best solution be just TabPage1 to appear.  Navigate to Tab2, TabPage2 appears.  

unsure how Xamarin overlooked testing on this.
Comment 7 Trevi Awater 2016-11-24 08:21:35 UTC
*** Bug 46914 has been marked as a duplicate of this bug. ***
Comment 8 adrianknight89 2016-12-07 15:37:20 UTC
There is an open PR for this: https://github.com/xamarin/Xamarin.Forms/pull/354
Comment 9 Paul DiPietro [MSFT] 2016-12-16 17:49:53 UTC
*** Bug 49281 has been marked as a duplicate of this bug. ***
Comment 10 Paul DiPietro [MSFT] 2017-02-14 19:43:53 UTC
*** Bug 51574 has been marked as a duplicate of this bug. ***
Comment 11 Jimmy [MSFT] 2017-07-07 18:33:58 UTC
*** Bug 58012 has been marked as a duplicate of this bug. ***
Comment 12 plaroche 2017-09-03 14:04:18 UTC
Hi Guys,

It is crazy, i posted a solution since last may 2017 on the PR 354.

It is seems nobody want really solve this problem.

If you comment lines 37 to 51 in FragmentContainer.cs, the events appears all normal....

public override bool UserVisibleHint
{
	get { return base.UserVisibleHint; }
	set
	{
		base.UserVisibleHint = value;
//		if (_isVisible == value)
//			return;
//		_isVisible = value;
//		if (_isVisible.Value)
//			PageController?.SendAppearing();
//		else
//			PageController?.SendDisappearing();
	}
}
In facts, if you comment thoses lines (UserVisibleHint), methods below, do their jobs.

public override void OnHiddenChanged(bool hidden)
{
	base.OnHiddenChanged(hidden);

	if (Page == null)
		return;

	if (hidden)
		PageController?.SendDisappearing();
	else
		PageController?.SendAppearing();
}

public override void OnPause()
{
	bool shouldSendEvent = Application.Current.OnThisPlatform().GetSendDisappearingEventOnPause();
	if (shouldSendEvent)
		SendLifecycleEvent(false);

	base.OnPause();
}

public override void OnResume()
{
	bool shouldSendEvent = Application.Current.OnThisPlatform().GetSendAppearingEventOnResume();
	if (shouldSendEvent)
		SendLifecycleEvent(true);

	base.OnResume();
}

Can someone confirm that ?
Best regards,
Paulin
Comment 13 Geoff 2017-12-02 01:23:44 UTC
Still happening on Xamarin.Forms 2.4.0.91020.  Highly frustrating.
Comment 14 plaroche 2017-12-04 11:39:18 UTC
Geoff,

I posted a solution, but it's seem that nobody want to test it ....
Comment 15 brux88 2017-12-18 10:36:12 UTC
i have the same problem
Comment 16 David Ortinau [MSFT] 2017-12-20 01:49:46 UTC
Migrated to https://github.com/xamarin/Xamarin.Forms/issues/1438

Please subscribe to that issue for future updates.
Comment 17 Rui Marinho 2018-01-10 15:01:11 UTC
Hi Andrew i updated to 2.5.0 the latest stable and the only issue i see is TabPage1 does fire Appearing the 1st time.