iOS xe:Commands.Tap gesture doesnt work on iOS, works fine android
LeoJHarris opened this issue · 1 comments
LeoJHarris commented
Hi there,
I am having an issue raising the gesture command for iOS, on android it works fine.
I have a setup with a CollectionView and each item has a PancakeView wrapping an item (see below), is there any reason why this wouldnt be working on iOS if it works fine on android?
Im calling
Effects.Init();
after
Xamarin.Forms.Forms.Init();
<CollectionView
Margin="10,0"
ItemsSource="{Binding Incidents}">
<CollectionView.ItemsLayout>
<GridItemsLayout
HorizontalItemSpacing="10"
Orientation="Vertical"
Span="2"
VerticalItemSpacing="10" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<pancakeview:PancakeView
Padding="20"
xe:Commands.Tap="{Binding ItemTappedCommand}" // ItemTapped
xe:Commands.TapParameter="{Binding .}" // Passes the ViewModel
xe:TouchEffect.Color="White"
BorderColor="White"
BorderThickness="5"
CornerRadius="0"
HeightRequest="120">
<Grid HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image
Grid.Row="0"
VerticalOptions="Center">
<Image.Source>
<FontImageSource
FontFamily="{StaticResource MaterialFontFamily}"
Glyph="{Binding IncidenceGlyph}"
Size="{StaticResource MaterialFontSize}"
Color="White" />
</Image.Source>
</Image>
<Label
Grid.Row="1"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
Text="{Binding IncidentType}"
TextColor="White" />
</Grid>
</pancakeview:PancakeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
My ViewModel has a property:
public Command<IncidentViewModel> ItemTappedCommand { get; set; }
Then simply used like this:
ItemTappedCommand = new Command<IncidentViewModel>(async (incidentViewModel) =>
{
IReadOnlyList<Page> stack = CurrentPage.Navigation.NavigationStack;
if (stack[stack.Count - 1].GetType() != typeof(IncidentMediaPickerPage))
{
await CoreMethods.PushPageModel<IncidentMediaPickerPageModel>(incidentViewModel.Incident).ConfigureAwait(false);
}
})
LeoJHarris commented
Resolved wrapping it around <xe:BorderView .. />