NAXAM / bottomtabbedpage-xamarin-forms

A page control for Xamarin.Forms to place tabs at the bottom.
Apache License 2.0
94 stars 32 forks source link

Demo crash when switch page #32

Closed chentotal closed 6 years ago

chentotal commented 6 years ago

I got a switch page problem. When switch page, it always pop to root, so I downloaded demo for test. And I found out demo has same problem and it crash.

Call Stack 0x65 in Naxam.Controls.Platform.Droid.Utils.BottomTabbedRendererUtils.SwitchPage at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\Utils\SizeUtils.cs:81,13 C# 0x3 in Naxam.Controls.Platform.Droid.BottomTabbedRenderer.OnNavigationItemSelected at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\BottomTabbedRenderer.Tabs.cs:31,13 C# [External Code] 0x84 in Naxam.Controls.Platform.Droid.Utils.BottomTabbedRendererUtils.EnsureTabIndex at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\Utils\SizeUtils.cs:50,17 C# 0x61 in Naxam.Controls.Platform.Droid.Utils.BottomTabbedRendererUtils.ChangePage at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\Utils\SizeUtils.cs:317,13 C# 0x9 in Naxam.Controls.Platform.Droid.BottomTabbedRenderer.SwitchContent at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\BottomTabbedRenderer.cs:166,13 C# 0x2B in Naxam.Controls.Platform.Droid.BottomTabbedRenderer.OnElementPropertyChanged at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\BottomTabbedRenderer.cs:89,17 C# 0xB1 in Naxam.Controls.Platform.Droid.Utils.BottomTabbedRendererUtils.SwitchPage at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\Utils\SizeUtils.cs:87,17 C# 0x3 in Naxam.Controls.Platform.Droid.BottomTabbedRenderer.OnNavigationItemSelected at C:\Users\total\Downloads\bottomtabbedpage-xamarin-forms\BottomTabbedPage.Droid\BottomTabbedRenderer.Tabs.cs:31,13 C#

Main cause is when switch page public static void SwitchPage(this BottomTabbedRenderer renderer, IMenuItem item) would be called twice.

bkosmowski commented 6 years ago

In App.xaml.cs file in App method try change MainPage = tabs; to MainPage = new NavigationPage(tabs);

chentotal commented 6 years ago

@bkosmowski Thanks, it works.

cassionandi commented 6 years ago

Updated to the last version of Xamarin Forms and BottomTabbedPage and now I get PopToRootAsync is not supported... when changed tabs. There is some workaround?

bkosmowski commented 6 years ago

Did you try change MainPage = tabs; to MainPage = new NavigationPage(tabs); like I mentioned in first comment?

cassionandi commented 6 years ago

Hi! I'm using Prism and the first Navigation is

await NavigationService.NavigateAsync("NavigationPage/LoginPage");

Is this similar to MainPage = new NavigationPage(tabs)?