xamarin/Xamarin.Forms

[Bug] [iOS] Secondary ToolbarItems are added to regular Toolbar instead a secondary Toolbar

开放

#8,422 创建于 2019年11月7日

 (4 条评论) (3 个反应) (0 位负责人)C# (1,926 个派生)batch import
e/3 :clock3:help wantedin-progressinactivep/iOS 🍎t/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

Bug is on iOS only. Traditionally, XF creates a secondary Toolbar to render ToolbarItems marked as "Secondary". When using Shell, XF does not create the seondary Toolbar, it adds all ToolbarItems to the main Toolbar.

Steps to Reproduce

  1. Create a new Shell project. When using the standard template, the created Pages and ViewModels can be removed. Only one Page is needed.
  2. Add a ContentPage (i.e. MainPage) if you deleted all pages.
  3. Add a toolbar Item with Order "Primary" and one with Order "Secondary"
  4. Add one Flyout Item with a ShellContent to the AppShell. Use MainPage for this ShellContent as DataTemplate.

or as I did:

  1. Take the official Xamarin.Forms samples
  2. Add an AppShell.xaml and AppShell.xaml.cs
  3. Assign AppShell instance as MainPage in App.xaml.cs
  4. Define MainPage as FlyoutItem/ShellContent in AppShell.xaml

Runtime:

  1. Start App
  2. Go to the page with the Toolbar Items

Expected Behavior

The ToolbarItem with Order Primary is shown in Toolbar. The ToolbarItem with Order Secondary is shown in a Secondard Toolbar below the regular Toolbar

Actual Behavior

ToolbarItem with Order Primary and Secondary are shown in the regular Toolbar. No secondard Toolbar is shown.

Basic Information

  • Version with issue: 4.2.0.709249 / 4.3.0.947036
  • Last known good version: n/a
  • IDE: Visual Studio 2019 (16.3.8)
  • Platform Target Frameworks:
    • iOS: XCode 11.1 (cannot update to XCode 11.2, update crashes for whatever reason), iOS 12.0, 12.4
    • Device: Simulator with iOS 12.0 and iPhone 6 Plus with 12.4.1

Screenshots

Secondary Toolbar without using Shell:

ShellSecondaryToolbarIssue-OK

Toolbar with using Shell: ShellSecondaryToolbarIssue-with-Shell-NOK

Reproduction Link

ToolbarItemDemos with Shell.zip

Recommendations for alternative?

Any recommendations for a nice alternative are very welcome as well.

贡献者指南