Xamarin and Maui shell tabs not rendering correctly on ios 16.3

Phil 166 Reputation points
2023-02-14T15:23:25.2+00:00

Hi there

I have a xamarin app that uses shell navigation with some navigation tabs, and a tab bar (multiple tabs on the top and bottom).

The application works as expected on android.

On iOS if the user rotates from portrait to landscape and then back to portrait, all tabs at the top after the first one don't appear.

I have raised a bug on the xamarin issues page with some screenshots and further details:

https://github.com/xamarin/Xamarin.Forms/issues/15684

I have tried this on both physical and virtual devices with the same results.

I put a breakpoint in the code below. When debugging I could see that the shell had the correct number of children etc.

protected override void OnSizeAllocated(double width, double height)
{
    base.OnSizeAllocated(width, height); //must be called
}

I was hoping there might be a work around by using a custom tab renderer on ios (it works for android).

I am unsure how to do this for iOS however.

I am hoping I might be able to remove and then redraw the tabs or change the visibility on and off etc to see if I can get the tabs to appear.

Any pointers or ideas on how best to achieve this would be greatly appreciated, or any other possible workarounds.

An additional note:

The tabs always display correctly when first loaded and when in landscape. It only seems to be when rotating from landscape to portrait.

I have also created a new Maui app with the same tab layout and it has the same issue.

Many thanks

Developer technologies .NET Xamarin
{count} votes

1 answer

Sort by: Most helpful
  1. Phil 166 Reputation points
    2023-04-06T08:52:26.7266667+00:00

    A fix for this has been created for Maui with this item. https://github.com/dotnet/maui/commit/13893ac2a1e8edf9f45b4a1a0faedab5b75dc9b9#diff-ff57f6c039d607e63f623a90b9dd5533ae450fb084eaae358dcceaef09a5d62d I am looking at trying to re-implement the fix for Xamarin. Obviously there are differences with handlers in Maui and how the rendering occurs. I am not very familiar with MAUI any help translating this fix to Xamarin would be appreciated. If I manage to get a fix working I'll post here also.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.