PM-3349 Fix for TabGestureRecognizer not working inside the StackLayout area of IconLabelButton

This commit is contained in:
Dinis Vieira 2023-11-04 18:08:44 +00:00
parent c6309173ba
commit 840f24dbe5
No known key found for this signature in database
GPG key ID: 9389160FF6C295F3
3 changed files with 13 additions and 8 deletions

View file

@ -11,13 +11,13 @@
<RoundRectangle CornerRadius="{Binding CornerRadius, Source={x:Reference _iconLabelButton}}" /> <RoundRectangle CornerRadius="{Binding CornerRadius, Source={x:Reference _iconLabelButton}}" />
</Border.StrokeShape> </Border.StrokeShape>
<Grid> <Grid>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_OnTapped" Command="{Binding ButtonCommand, Source={x:Reference _iconLabelButton}}" />
</Grid.GestureRecognizers>
<StackLayout <StackLayout
Spacing="6" Spacing="6"
Orientation="Horizontal" Orientation="Horizontal"
HorizontalOptions="Center"> HorizontalOptions="Center">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ButtonCommand, Source={x:Reference _iconLabelButton}}" />
</StackLayout.GestureRecognizers>
<controls:IconLabel <controls:IconLabel
VerticalOptions="Center" VerticalOptions="Center"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"

View file

@ -25,6 +25,8 @@ namespace Bit.App.Controls
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create( public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(
nameof(CornerRadius), typeof(CornerRadius), typeof(IconLabelButton)); nameof(CornerRadius), typeof(CornerRadius), typeof(IconLabelButton));
public event EventHandler<TappedEventArgs> Tapped;
public IconLabelButton() public IconLabelButton()
{ {
InitializeComponent(); InitializeComponent();
@ -71,6 +73,11 @@ namespace Bit.App.Controls
get { return (CornerRadius)GetValue(CornerRadiusProperty); } get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); } set { SetValue(CornerRadiusProperty, value); }
} }
private void TapGestureRecognizer_OnTapped(object sender, TappedEventArgs e)
{
Tapped?.Invoke(sender, e);
}
} }
} }

View file

@ -128,11 +128,9 @@
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
Icon="{Binding Source={x:Static core:BitwardenIcons.Suitcase}}" Icon="{Binding Source={x:Static core:BitwardenIcons.Suitcase}}"
Label="{u:I18n LogInSso}" Label="{u:I18n LogInSso}"
AutomationId="LogInWithSsoButton"> AutomationId="LogInWithSsoButton"
<controls:IconLabelButton.GestureRecognizers> Tapped="LogInSSO_Clicked"
<TapGestureRecognizer Tapped="LogInSSO_Clicked" /> />
</controls:IconLabelButton.GestureRecognizers>
</controls:IconLabelButton>
<Label <Label
Text="{Binding LoggingInAsText}" Text="{Binding LoggingInAsText}"
StyleClass="text-sm" StyleClass="text-sm"