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

[Android] Navigation dont wait initial pages to be loaded on AppCompat #4729

Closed
kvpt opened this issue Dec 13, 2018 · 4 comments · Fixed by #4730
Closed

[Android] Navigation dont wait initial pages to be loaded on AppCompat #4729

kvpt opened this issue Dec 13, 2018 · 4 comments · Fixed by #4730

Comments

@kvpt
Copy link
Contributor

kvpt commented Dec 13, 2018

Description

If you want to navigate to another page in the OnStart method, auto login for exemple, and if you navigate to fast, the page will load before the MainPage and will be wipped by the MainPage loaded after.
The state of the navigation stack will be inconsistant and it will cause differents issues or crash like IndexOutOfRange.

The FormsApplicationActivity works as excepted.

Steps to Reproduce

  1. Create an Xamarin Forms Android from the template
  2. In App class set a NavigationPage as MainPage
  3. In the OnStart method push a new page
    await Current.MainPage.Navigation.PushAsync(new Page { Title = "New" });
  4. Launch application

Expected Behavior

The page displayed is the page loaded in OnStart
And if you go back it's your MainPage

Actual Behavior

The page displayed is the original page and the page loaded in OnStart is "phantom", if you press go back it throw an IndexOutOfRangeException.

@hartez
Copy link
Contributor

hartez commented Jan 14, 2019

@kvpt If I open your repro and make these changes to NavigationPageRenderer.OnAttachedToWindow(), I get an ArgumentOutOfRangeException.

@kvpt
Copy link
Contributor Author

kvpt commented Jan 15, 2019

@hartez You're right, I have made a more complex reproduction to test this case and forgot to test if the first reproduction case was still fixed, and indeed it's not the case.
I will try to fix this asap later in the week.

@kvpt
Copy link
Contributor Author

kvpt commented Jan 17, 2019

@hartez I fixed it, you can review it again.

@samhouts
Copy link
Member

samhouts commented Apr 8, 2019

Duplicate of #3528

@samhouts samhouts marked this as a duplicate of #3528 Apr 8, 2019
@samhouts samhouts closed this as completed Apr 8, 2019
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Oct 2, 2019
@samhouts samhouts added a/navigation and removed in-progress This issue has an associated pull request that may resolve it! labels Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants