SwiftUI: Adding a navigationBarItem to a List changes its style to SidebarListStyle

Originator:jaherhi
Number:rdar://FB7804205 Date Originated:Jun 27, 2020 at 9:18 AM
Status:Open Resolved:
Product:SwiftUI Product Version:Xcode 12.0 beta (12A6159)
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
 
Description
A List inside a NavigationView presents its content with the default style. In this state the rows fill the width of the screen, and the List expands to the bottom of the view.

When adding a trailing navigationBarItem, the List style changes to SidebarListStyle, instead of keeping its previous style.

As a workaround, it's possible to use toolbar with a ToolbarItem placed with navigationBarTrailing to get the same UI without the change on the style.

The issue can be found when running a project in Xcode 12.0 beta (12A6159).

Steps to reproduce
1. Open the attached project
2. Run the app on the simulator
3. Verify that the List is displayed as if SidebarListStyle had been set
4. Remove the navigationBarItems (line 11)
5. Run the app again
6. Verify that the style for the List has changed, and it's using the default style

What did you expect to happen?
I expected the List to keep the same style in both cases, with a navigationBarItem and without

What actually happened?
The List changes the style from its default style to SidebarListStyle

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!