Skip to content

[Bug] SettingPicker icon not rendered in combination with ChoicesConfiguration.pickerDisplayMode(.menu) #44

@duraki

Description

@duraki

While experimenting with PR #19 by @Saik0s, I've found a bug which results in SettingPicker component not rendering the icon, as it should. This happens when used in combination with ChoicesConfiguration.pickerDisplayMode(.menu) instead of revolving around default .navigation display mode, which works.

Bug Reproduction

To reproduce this bug and make icon not showing use the following code (notably choiceConfiguration: (...) constructor param:

// ...
struct SomeView: View {
  @AppStorage("pickerIndex") var pickerIndex = 0

  var body: some View {
    // ...
    SettingGroup(header: "Text Appearance", footer: "Use this settings to customize text rendering styles.") {
      SettingPicker(
        icon: .system(icon: "textformat.subscript", backgroundColor: .pink),
        title: "Example Picker",
        choices: ["Default", "Gradient", "Image based"],
        selectedIndex: $pickerIndex,
        choicesConfiguration: .init(pickerDisplayMode: .menu)  /** bug produced by this line */
      )
    }
  }
}

Example of working code when the icon is shown, using .navigation display mode instead:

// ...
SettingGroup(header: "...", footer: "...") {
    SettingPicker(
        // ...
        choicesConfiguration: .init(pickerDisplayMode: .navigation)
    )
}

Rendered Results

Left side is working example when using .navigation display mode, while the right side is showing bugged version. The important item is the "Vehicle Model" settings (last item).

Expected results due to .navigation disp. mode         Unexpected result due to .menu disp. mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions