The renderer throws an exception when the TopTabbedPage is renderer without any children.
This issue is specific to iOS. On Android it works just fine.
I did a little bit of debugging myself, and I think that the issue is located at the following lines:
As you can see there, the if statement checks if lastSelectedIndex >= 0 || lastSelectedIndex < ViewControllers.Count, but that will also pass if the selected index is 0 and when ViewControllers.Count is 0.
The || here should be replaced with &&.
The renderer throws an exception when the TopTabbedPage is renderer without any children. This issue is specific to iOS. On Android it works just fine. I did a little bit of debugging myself, and I think that the issue is located at the following lines:
https://github.com/NAXAM/toptabbedpage-xamarin-forms/blob/master/Naxam.TopTabbedPage.Platform.iOS/TopTabbedRenderer.cs#L138-L143
As you can see there, the if statement checks if
lastSelectedIndex >= 0 || lastSelectedIndex < ViewControllers.Count
, but that will also pass if the selected index is0
and whenViewControllers.Count
is0
. The||
here should be replaced with&&
.