Bug 59868 - Secondary ToolbarItems broken on Xamarin.Forms iOS 2.4stable
Summary: Secondary ToolbarItems broken on Xamarin.Forms iOS 2.4stable
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.4.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-29 18:41 UTC by Nathan Castle (Esri)
Modified: 2018-05-22 14:34 UTC (History)
18 users (show)

Tags: ios 11, toolbaritem, ac, fr
Is this bug a regression?: ---
Last known good build:


Attachments
Secondary menu offsets (95.76 KB, image/jpeg)
2018-02-23 18:42 UTC, Chad Magendanz
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Nathan Castle (Esri) 2017-09-29 18:41:09 UTC
# Steps to reproduce

1. Create a ContentPage with a control and two ToolbarItems marked as secondary.
2. Load the page. Observe that the leftmost toolbar item becomes offset. Notice also that the rightmost toolbar item disappears (as if by magic!). 

See code example below:

````
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="xamtest.AboutPage" xmlns:vm="clr-namespace:xamtest;">
    <ContentPage.ToolbarItems>
        <ToolbarItem Order="Secondary" Priority="0" Text="Stop"/>
        <ToolbarItem Order="Secondary" Priority="1" Text="Start" />
    </ContentPage.ToolbarItems>
	<Grid />
</ContentPage>
```
# Expected behavior

1. The display of the toolbar items doesn't change after the page loads; all controls are visible and in the right place. 

# Actual behavior

1. The display of toolbar items does change after the page loads; some controls are invisible and others are offset.

# Supplemental info (logs, images, videos)

Note that 
video capture:

https://imgur.com/0ngk2oN

# Test environment (full version information)

iOS 11 simulator, macOS Sierra, Xamarin.Forms 2.4 stable
Comment 1 Paul DiPietro [MSFT] 2017-09-29 20:30:37 UTC
I believe this might very well be related to 59868 but due to the other aspect of the left item, I'll set this to confirmed for the time being until we can investigate this further.
Comment 2 Timothy Risi 2017-10-09 05:38:44 UTC
Some more information on this, since I'm running into this issue as well.

From what I can tell, this is an issue with XF 2.4, but with Xamarin iOS 11 and Xcode 9.  I've been using 2.3.4.221-pre6 with no issues.  I had some other problems with the last version of my app that I published (before xcode 9 was released), and after fixing those issues, I"m running into the offset secondary toolbaritems while using that same version of XF.  I've also tested with 2.3.4.270, 2.4.0.280 and 2.4.0.282 and nit hasn't made any difference.  

I'm using three secondary ToolbarItems instead of only 2, and only see the problem on device.  It looks fine in the simulator.  On device I see this: https://imgur.com/a/dWQsR.  If I comment out one of the three to only have 2, I see exactly w hat's described in the original bug description.

Visual Studio Community 2017 for Mac
Version 7.1.5 (build 2)
Installation UUID: 9aeeaee4-e204-4c3b-ac1e-e44b2ad7a503
Runtime:
	Mono 5.2.0.224 (d15-3/14f2c81) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000224

NuGet
Version: 4.3.0.2418

.NET Core
Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler
Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Xamarin.Android
Version: 7.4.5.1 (Visual Studio Community)
Android SDK: /Users/Tim/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24.0.2
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Inspector
Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

Apple Developer Tools
Xcode 9.0 (13247)
Build 9A235

Xamarin.Mac
Version: 3.6.3.3 (Visual Studio Community)

Xamarin.iOS
Version: 11.0.0.0 (Visual Studio Community)
Hash: 152b654a
Branch: xcode9
Build date: 2017-09-15 02:25:56-0400

Build Information
Release ID: 701050002
Git revision: 7afedcaef8e7542e70e3cf8f9bdb26938b8c0876
Build date: 2017-09-15 08:39:58-04
Xamarin addins: 3262aadf811a18c12eac6742532d052b0139a808
Build lane: monodevelop-lion-d15-3-xcode9

Operating System
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 3 Rui Marinho 2017-10-26 18:08:48 UTC
Can you try with 2.5.0-pre2 ?
Comment 4 Timothy Risi 2017-10-26 19:16:04 UTC
I'm still seeing it with 2.5.0.19271-pre2
Comment 5 Mathias Hartner 2017-11-08 14:53:03 UTC
I have a similar problem since iOS 11.
I have two secondary toolbar items with plain text on my main menu page.
If I navigate one level deeper the same toolbar items are added to the page and that's where the magic happens:

The right toolbar item gets invisible and the left one gets kind an offset.
If I try to navigate back on the upper left screen, the app freezes and the only thing I can do is kill it.
The actions associated with the toolbar items are still working.
With iOS 10.x everything worked just fine and as expected but since iOS 11.x ...No way!

Because of freezing my app, a fix for this bug is really crucial to me!!!

P.S. I tried with any of the 2.4.x versions of Xamarin.Forms, no luck!
Comment 6 patrik.kosonen 2017-11-15 10:52:48 UTC
I have the same problem....Is there some nice work around?
I need to publish an update of my app but can't because of this issue.
Comment 7 Radoslav Gatev 2017-12-08 14:01:05 UTC
We have the same problem and it is seriously blocking our next release!
Comment 8 Greg Felix 2018-01-15 21:08:25 UTC
Any update on this bug? We have the same issue with iOS11 in our application using two secondary ToolbarItems.

Thanks
Comment 9 Greg Felix 2018-01-15 21:10:14 UTC
I forgot to mention that rotating the device to landscape orientation fixes the issue, and after rotating it back to portrait orientation, the issue remains fixed.
Comment 10 Chad Magendanz 2018-02-23 18:42:37 UTC
Created attachment 26189 [details]
Secondary menu offsets

Here's another example.  I have three secondary menu items on a TabbedPage.  The layout is initially as shown, but positioning is corrected if I switch to the List tab and return to the Map.

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:c="clr-namespace:TRC.Controls"
            x:Class="TRC.Views.MainPage"
            Title="{Binding SelectedSheet.Name}">

  <TabbedPage.ToolbarItems>
    <c:CustomToolbarItem Icon="ic_cloud_upload_white.png" Order="Primary" Command="{Binding SyncCommand}" />
    <ToolbarItem Icon="ic_sync.png" Text="Sync" Order="Secondary" Command="{Binding RefreshCommand}" />
    <ToolbarItem Icon="ic_remove.png" Text="Remove" Order="Secondary" Command="{Binding RemoveCommand}" />
    <ToolbarItem Icon="ic_info.png" Text="Info" Order="Secondary" Command="{Binding DetailCommand}" />
  </TabbedPage.ToolbarItems>
  <!--Pages are added in constructor-->
</TabbedPage>

Note that positioning is improved after the tab switch, but is still not consistent.  I had expected the icon and text to be centered in the toolbar button as a group, but it looks like the icon is centered and text forced to its right.  Visually, this still looks wrong.
Comment 11 Rio 2018-03-15 11:10:56 UTC
Any Update on this? Still an issue for me
Comment 12 Greg Felix 2018-03-15 18:16:53 UTC
This issue went away for me when I upgraded to 2.5.0.122203.
Comment 13 Samantha Houts [MSFT] 2018-03-20 18:38:30 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1208

Should be fixed in 2.5.0. Thanks!
Comment 14 sabretoothdeveloper 2018-03-27 11:38:09 UTC
I am still having this issue in 2.5.0.280555.  What am I missing? When the screen is rotated landscape then back to portrait it mostly corrects itself but is still offset.
Comment 15 timothy.risi 2018-04-22 08:16:14 UTC
I just updated to the 2.5.1.444934 and this still is not fixed for me with 3 secondary toolbar items.  Toolbar is created with:

<local:BaseView.ToolbarItems>
		<ToolbarItem Text="+" Command="{Binding AddSquadron}" />
		<ToolbarItem Text="Import" Command="{Binding ImportSquadron}" Order="Secondary" />
		<ToolbarItem Text="Export All" Command="{Binding ExportAll}" Order="Secondary" />
		<ToolbarItem Text="Sort" Command="{Binding SortSquadron}" Order="Secondary" />
	</local:BaseView.ToolbarItems>

And this is the output I get: https://imgur.com/a/T5J1fL2
Comment 16 crazy.nolde 2018-05-22 08:57:38 UTC
I can confirm that as well. Please reopen the bug.
Comment 17 crazy.nolde 2018-05-22 12:26:43 UTC
I created Github Issue 2798 for this Bug.
https://github.com/xamarin/Xamarin.Forms/issues/2798
Comment 18 crazy.nolde 2018-05-22 14:34:47 UTC
does anyone know a workaround?