galadril/Xam.Shell.Badge

Xamarin iOS Shell Tabbbar sometime showing but sometime not showing badge count

Closed this issue · 15 comments

Hello
I have implement badge in Shell tabbar so it's working fine in Android but in iOS not working.
Example code

<Shell
xmlns:badge="clr-namespace:Xam.Shell.Badge;assembly=Xam.Shell.Badge">
<TabBar Route="Tab">
      <Tab Title="{language:Translate ProfileText}"
             Icon="profile_icon.png"
             badge:Badge.BackgroundColor="Red"
             badge:Badge.Text="{Binding ProfileBadgeCount}"
             Route="Tab4">
            <ShellContent Route="ProfilePage"
                          ContentTemplate="{DataTemplate dashboardViews:ProfilePage}" />
        </Tab>
</TabBar>
</Shell>

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Please anyone help me.

Did you run the Init in you AppDelegate?

BottomBar.Init();

Did you run the Init in you AppDelegate?

BottomBar.Init();

Yes i have added,
but problem is like below
in first time its installing -> no badge -> then login -> badge showing -> kill app -? again opened -> badge showing -> then once app loaded -> badge gone

This is checked against v1.0.10?

Yes

This is checked against v1.0.10?

Yes.

Hello @galadril
have you resolved this issue?

any update?

any update?

Not yet...please resolved issue

Really busy at the moment, please create a PR if you find the fix

@AdilSaiyad I had a similar problem. I binded a int property with the value zero. If you look into the source of this library you'll see in iOS/Renderers/BadgeShellItemRenderer:76 (ApplyBadge) that it will show a ● with the color UIColor.Clear.
That results in some grey dot in my case.

Basically I think that this ● can be set to NULL there but I don't know what @galadril had in mind here.

So to solve my issue is that I wrote a ValueConverter that converts an int that is zero to NULL and that's it.


    public class NumberToBadgeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType == typeof(string) && value is int && (int)value == 0)
                return null;
                
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }

This package will no longer receive updates?

@angelru like with all open source I guess it depends on the time of the maintainer(s).
@galadril said he is busy, so if there is issues other people can also look into it and submit a pull request.

@angelru, please, try the latest v.1.0.13 package. If you still experience this issue, feel free to create new issue.