Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] iOS Touch Effects cause weird behavior with multiple selection enabled in CollectionView items #1157

@meJevin

Description

@meJevin

Description

In my project I have the following scenario: I have a CollectionView with a custom ItemTemplate. My custom ItemTemplate has TouchEffects applied on it. There is an option to disable those touch effects via a binding. I create a BindableProperty for my custom ItemTemplate and set a binding on it which can be controlled from outside. When that property changes I remove/add the TouchEffects.

Everything is OK on Android. But on iOS the LongPressCommand doesn't seem to go away for some reason.

I've isolated the problem into a separate project and put it into a github repo, so you guys could inspect it better.
https://github.com/meJevin/TouchEffectBug

Please pay attention to Controls/TestTemplate.xaml and its code-behind file. This is my custom template. In code behind I have a bindable property, which, when changes, adds or removes touch effects.

You can see how I use that template in MainPage.xaml.

When run, application will not have any touch effects. Press the 'Change Template' button on the top in order to trigger a property change and therefore add effects to the ItemTemplate.

After that you will be able to long press it.

Press the button at the top again to trigger the removal of touch effects.

On Android everything works as expected. On iOS however, long pressing an item still calls the LongPressCommand (that we removed).

Steps to Reproduce

  1. Go to https://github.com/meJevin/TouchEffectBug
  2. Clone repo to your PC
  3. Run application on Android emulator (or device)
  4. Verify that there are no TouchEffects on current ItemTemplate by long pressing a CollectionView item (nothing should happen)
  5. Press 'Change Template' to add TouchEffects (including LongPressCommand)
  6. Verify that TouchEffects have been applied to CollectionView Items by long pressing one of them.
  7. Press 'Change Template' to remove TouchEffects
  8. Verify that there are no TouchEffects on current ItemTemplate by long pressing a CollectionView item (nothing should happen)
  9. Repeat steps 3-8 on an iOS device and you will fail on the 8th step. Because LongPressCommand still fires.

Expected Behavior

Android and iOS behavior is the same

Actual Behavior

iOS can not remove LongPressCommand

Basic Information

  • Version with issue: 1.1.0
  • Last known good version: -
  • iOS: 14.4.2
  • Nuget Packages: Xamarin.Forms 5.0.0.2012, Xamarin.Essentials 1.6.1, Xamarin.CommunityToolkit 1.1.0
  • Affected Devices: iPhone 11

Reproduction Link

https://github.com/meJevin/TouchEffectBug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Breaky break.need-more-informationNeed more information to investigate a bug or proposal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions