roubachof / Sharpnado.Tabs

Pure MAUI and Xamarin.Forms Tabs, including fixed tabs, scrollable tabs, bottom tabs, badge, segmented control, custom tabs, button tabs, bendable tabs...
MIT License
474 stars 62 forks source link

On Android Bottom TAB Item click is not working #48

Closed HiteshGenesis closed 1 year ago

HiteshGenesis commented 2 years ago

Platform (please complete the following information):

Describe the bug On Android Bottom, the TAB Item click is not working.it's very hard to change the tabs

To Reproduce Steps to reproduce the behavior: On Android Bottom, the TAB Item click is not working.it's very hard to change the tabs

roubachof commented 2 years ago

I use them everyday in all my apps so I would need a bit more information 😀

HiteshGenesis commented 2 years ago

I am using the below TAB ITEM UI i am using SVG Image as ICON. the touch tab item is not working.

if we remove the Frame from below UI ,the Touch is working.not sure why Frame is blocking the Touch

SVGTabItem.xaml <tabs:TabItem xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:tabs="clr-namespace:Sharpnado.Tabs;assembly=Sharpnado.Tabs" xmlns:ffimageloadingsvg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms" xmlns:components="clr-namespace:LSMobile.Components" x:Class="LSMobile.Components.SVGTabItem">

**SVGTabItem.xaml.cs** using System; using System.Runtime.CompilerServices; using FFImageLoading.Forms; using FFImageLoading.Svg.Forms; using Sharpnado.Tabs; using Xamarin.Forms; public partial class SVGTabItem : TabItem { public static readonly BindableProperty ImageSourcePathProperty = BindableProperty.Create(nameof(ImageSourcePath), typeof(string), typeof(SvgCachedImage), default(string), Xamarin.Forms.BindingMode.OneWay); public string ImageSourcePath { get { return (string)this.GetValue(ImageSourcePathProperty); } set { this.SetValue(ImageSourcePathProperty, value); } } public static readonly BindableProperty TitleTextProperty = BindableProperty.Create(nameof(TitleText), typeof(string), typeof(Label), default(string), Xamarin.Forms.BindingMode.OneWay); public string TitleText { get { return (string)this.GetValue(TitleTextProperty); } set { this.SetValue(TitleTextProperty, value); } } public SVGTabItem() { this.InitializeComponent(); } protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName == ImageSourcePathProperty.PropertyName) { this.Icon.Source = new EmbeddedResourceImageSource(new Uri(this.ImageSourcePath)); } if (propertyName == TitleTextProperty.PropertyName) { this.Title.Text = this.TitleText; } if (propertyName == IsSelectedProperty.PropertyName) { if (this.IsSelected == true) { this.Container.BackgroundColor = (Color)Application.Current.Resources["PrimaryButtonColor"]; } else { this.Container.BackgroundColor = Color.Transparent; } } } protected override void OnBadgeChanged(BadgeView oldBadge) { } }
roubachof commented 2 years ago

Maybe have a look at the others implementations of TabItem you should miss something

nabeelyaadi commented 2 years ago

I'm sort of having the same problem on Android in my Xamarin.Forms project. Kindly have a look at the question I posted on Stackoverflow. https://stackoverflow.com/questions/70531170/middle-tab-items-not-firing-tap-event-on-sharpnado-tabs

nabeelyaadi commented 2 years ago

This is the code I'm using: ` <sho:ViewSwitcher x:Name="Switcher" Grid.Row="0" Grid.RowSpan="3" Animate="False" SelectedIndex="{Binding SelectedViewModelIndex}">

        <sho:LazyView x:TypeArguments="pages:ProfilePage" BindingContext="{Binding ProfilePageViewModel}" />

    </sho:ViewSwitcher>

    <Image Source="navigationbackground.png" Grid.Row="3" TranslationY="5" />
    <sho:TabHostView x:Name="TabHostLogo"
                         Grid.Row="3"
                         WidthRequest="200"
                         HeightRequest="60"
                         Margin="0"
                         Padding="0,20,0,0"
                         HorizontalOptions="Fill"
                         VerticalOptions="Start"
                         BackgroundColor="Transparent"
                         IsSegmented="False"
                         Orientation="Horizontal"
                         TabType="Fixed"
                         SelectedTabIndexChanged="TabHostLogo_SelectedTabIndexChanged"
                         SelectedIndex="{Binding Source={x:Reference Switcher}, Path=SelectedIndex, Mode=TwoWay}">

        <sho:TabHostView.Tabs>

            <sho:BottomTabItem IconImageSource="homeiconselected.png"  IconSize="20" />

            <sho:BottomTabItem IconImageSource="profileicon.png" BackgroundColor="Red" IconSize="20" >
                <sho:BottomTabItem.GestureRecognizers>
                    <TapGestureRecognizer Command="{Binding ProfileTabCommand}"/>
                </sho:BottomTabItem.GestureRecognizers>
            </sho:BottomTabItem>

            <sho:TabButton x:Name="TabButton"
                               IsVisible="True"
                               ButtonBackgroundColor="Transparent"
                               ButtonCircleSize="40"
                               CornerRadius="40"
                               IconImageSource="navigationaddbutton.png"
                               TapCommand="{Binding ProfileTabCommand}"
                               Scale="2.5"
                               Margin="0,0,0,15"
                               TranslationY="-20" />
            <sho:BottomTabItem IconImageSource="chaticon.png" BackgroundColor="Red" IconSize="20"/>
            <sho:BottomTabItem IconImageSource="moreicon.png" IconSize="20"/>

        </sho:TabHostView.Tabs>
    </sho:TabHostView>

</Grid>`