xamarin/Xamarin.Forms

[ImageButton] ImageButton's VisualState inside a ScrollView doesn't work properly

Open

#4,981 opened on Jan 14, 2019

 (1 comment) (4 reactions) (0 assignees)C# (1,926 forks)batch import
a/imagebuttone/4 :clock4:help wantedinactivep/Androidp/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

I'm setting ImageButton VisualState following the example set here: https://blog.xamarin.com/xamarin-forms-3-4-0-say-hello-to-imagebutton

However, VisualState inside a ScrollView or ListView doesn't behave correctly.

iOS:

  1. Inside a ListView/ScrollView the VisualState doesn't change on click/tap. However, If you tap and hold the VisualState does change.
  2. If the ImageButton is inside a ListView/ScrollView and you tap and scroll (after VisualState change has taken place, please see the attached screengrab) the state gets stuck to smaller scale and doesn't revert back.
  3. Outside any ListView or ScrollView the ImageButton state changes on tap as expected contrary to no. 1 above. However, still gets stuck on smaller scale if you tap, wait for state change and then swipe/scroll.

Android:

  1. If the ImageButton is inside a ListView/ScrollView and you tap and scroll/swipe (after VisualState change has taken place, please see the attached screengrab) the state gets stuck to smaller scale and doesn't revert back.

Possible related issue here: https://github.com/xamarin/Xamarin.Forms/issues/4960

Steps to Reproduce

  1. Extract and run the repro attached
  2. Click on ImageButton
  3. Click on ImageButton and Swipe/Scroll

Expected Behavior

  1. On tap VIsualState should change and scale down and revert
  2. On tap and swipe ImageButton VisualState should not get stuck.

Actual Behavior

  1. On iOS the VisualState doesn't scale down unless you tap and hold (inside a ListView/ScrollView)
  2. On tap and swipe/scroll VisualState gets stuck on the scaled down state (inside a ListView/ScrollView)

Basic Information

  • Version with issue: XF 3.4 latest
  • Last known good version: Unknown
  • IDE: Visual Studio Community 2017 for Mac Version 7.7.2 (build 21)
  • Platform Target Frameworks:
    • iOS: 12.1
    • Android: Android 8.1 (API 27)
    • UWP: N/A
  • Android Support Library Version: 27.02.1
  • Nuget Packages: Default (File => New Project).
  • Affected Devices: Reproduced using iPhone 6, 6S+, Galaxy S6 Edge, Note 9, and both Simulator and Emulator

Screenshots

https://drive.google.com/file/d/11mr_NDzEHERtrxTVW-Ox-3egtlyEJNFo/view?usp=sharing

Reproduction Link

ImageButtonRepro.zip

Contributor guide