question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] TabBar Icons not showing when using FontIconSource for Tab.Icon

See original GitHub issue

Description

The icons of the tabs are not showing up on iOS when using FontIconSource on the Tab.Icon property.

Steps to Reproduce

  1. Create a MAUI App using Shell
  2. Add the materialdesignicons-webfont.ttf or any other icon font
  3. Register the icon font in MauiProgram.cs using AddFont() in the builder
  4. Define the Icons as static resources in App.xaml or any other resource dictionary
  5. In AppShell.xaml, add a TabBar with Tabs
  6. Use the FontIconSource type on the Tab.Icon property and choose the desired static resource as a glyph
  7. Debug on iOS

Expected Behavior: The TabBar displays the Icons from the FontIconSource Actual Behavior: The TabBar does not display the Icons FontIconSource

Hint: This works fine on Android

Example code:

Resource Dictionary:

  <x:String x:Key="SettingsIcon">&#xF0493;</x:String>
  <x:String x:Key="TimerIcon">&#xF0954;</x:String>

Shell:

  <TabBar>
    <Tab
      Title="{x:Static strings:Strings.HomeLabel}">
      <Tab.Icon>
        <FontImageSource
          FontFamily="materialdesignicons"
          Glyph="{StaticResource TimerIcon}"/>
      </Tab.Icon>
      <ShellContent
        ContentTemplate="{DataTemplate views:MainPage}"
        Route="MainPage"/>
    </Tab>
    <Tab
      Title="{x:Static strings:Strings.SettingsLabel}">
      <Tab.Icon>
        <FontImageSource
          FontFamily="materialdesignicons"
          Glyph="{StaticResource SettingsIcon}"/>
      </Tab.Icon>
      <ShellContent
        Title="{x:Static strings:Strings.SettingsLabel}"
        ContentTemplate="{DataTemplate views:SettingsPage}"
        Route="SettingsPage"/>
    </Tab>
  </TabBar>

Link to public reproduction project repository

https://github.com/ewerspej/dotnet-maui-bug-repro-ios-tabs-shell/

Version with bug

7.0.100-rc.1.22431.12

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.5

Did you find any workaround?

No

Relevant log output

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
sthewissencommented, Oct 19, 2022

I have something similar, and it seems like they are simply set to the same color as my background (white). When I give them a different background they appear.

 <TabBar Route="Main"
        Shell.TabBarTitleColor="Red"
        Shell.TabBarBackgroundColor="Orange"
        Shell.TabBarForegroundColor="Red"
        Shell.TabBarDisabledColor="Green"
        Shell.TabBarUnselectedColor="Yellow">

Seems a bit like some of these set colors are overridden internally somewhere (iOS16, iPhone14 Pro emulator).

image
3reactions
sthewissencommented, Oct 19, 2022

All the more reason to fix it, don’t you think? The TabBar is just not usable this way on iOS.

Wholeheartedly agreed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tab bar not showing icons?
So, the tab bar icon was showing up in the child views [in storyboard] but was not showing up in the parent view...
Read more >
Tab bar icon and title not showing with Storyboard References
iOS : Tab bar icon and title not showing with Storyboard References [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
Tab bar label and icon not visible until clicked. : r/swift
In my Viewcontroller I have the following code to generate a label and image for the tab bar icon.. however I noticed that...
Read more >
Tab bars | Apple Developer Documentation
Tab bars use bar items to navigate between mutually exclusive panes of content in the same view.
Read more >
NET MAUI Shell tabs
Learn how to customize and control a .NET MAUI TabBar, which represents the bottom tab bar in a .NET MAUI Shell app.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found