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

[Android, Help Needed, Do Not Merge] TabbedPage child should not call disappearing on initial run #348

Closed
wants to merge 8 commits into from
Closed

Conversation

adrianknight89
Copy link
Contributor

@adrianknight89 adrianknight89 commented Sep 13, 2016

Description of Change

Currently, there is a bug with Android TabbedPage that triggers appearing / disappearing events the wrong way. When you load a TabbedPage, the following happens:

  • TabbedPage Appearing
  • Page1 Appearing
  • Page1 Disappearing
  • Page1 Appearing

Page1 should NOT call its Disappearing event. I was able to identify how this bug happens but not why.

In Page.cs, after TabbedPage invokes its Appearing event inside IPageController.SendAppearing(), it also invokes its current page's Appearing event like so:

((IPageController)pageContainer?.CurrentPage)?.SendAppearing();

Then, TabbedPageRenderer invokes pager.Measure(...) inside OnLayout(...) which in turn triggers IPageController.SendDisappearing() in Page.cs. I'm not sure why this is the case. This will fire Disappearing event for the current page.

The hack is to skip calling current page's appearing event as seen in the commit. This way, IPageController.SendDisappearing() will be called but not processed since _hasAppeared is false.

Can anyone comment why pager.Measure(...) sets UserVisibleHint of FragmentContainer to false?

Bugs Fixed

@dnfclas
Copy link

dnfclas commented Sep 13, 2016

Hi @adrianknight89, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@amccorma
Copy link

Thanks for tying to resolve this bug.

@amccorma
Copy link

was this fixed with Xamarin forms v.2.3.2.127?

@tonholis
Copy link

tonholis commented May 4, 2017

this bug remains in XF 2.3.4.231

@goldenkeyz-plaroche
Copy link

goldenkeyz-plaroche commented May 10, 2017

Hello,

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();
//	}
//}

Can someone confirm that ?
Best regards,
Paulin

@samhouts samhouts modified the milestone: 2.3.0 Jun 27, 2018
@samhouts samhouts modified the milestone: 3.2.0 Sep 11, 2018
@samhouts samhouts added this to In Review in vCurrent (4.8.0) Jun 20, 2020
@samhouts samhouts removed this from In Review in vCurrent (4.8.0) Jul 30, 2020
mattleibow pushed a commit that referenced this pull request Jan 28, 2021
* Implemented Barometer across all platforms.

* Added tests modeling compass sensor tests

* Added more unit tests

* Added samples

* removed unused usings

* Added barometer to all sensor page

* Updated docs

* Removed unused ios properties

* Implemented maps as mentioned in branch name issue. also fixed a spelling mistake

* Fixed typo which caused ui bug

* Finished reset of fork

* removed proj items

* Android emulator has barometer

* Code cleanup, lazy introduction, access modifiers

* Modified barometer to be in sync with generic event handlers

* copy paste

* Updated barometer docs/en/Xamarin.Essentials/Barometer.xml

* Finished updating barometer docs

* Removed remnants from delegates

* Changes requested in pr

* iOS queue change

* Sensor Speed

* sensor reset
mattleibow added a commit that referenced this pull request Jan 28, 2021
rmarinho pushed a commit that referenced this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants