Bug 42883 - ScrollViewRenderer.OnTouchEvent not being called in when scrollView.Orientation = Horizontal on Android
Summary: ScrollViewRenderer.OnTouchEvent not being called in when scrollView.Orientati...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-28 13:18 UTC by John Halloran
Modified: 2017-03-22 21:27 UTC (History)
6 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
Solution with custom renderer showing the problem. (48.09 KB, application/zip)
2016-07-28 13:59 UTC, John Halloran
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description John Halloran 2016-07-28 13:18:40 UTC
On Android if you create a custom renderer for a ScrollView you receive OnTouchEvent calls as normal if you set it ScrollOrientation.Vertical. However if you set it to ScrollOrientation.Horizontal you do not get touch events.

I have attached a sample project to show this problem. In CustomScrollView.cs there is a WriteLine in OnTouchEvent but when you start the app and scroll it you receive no events.

It looks as though something intercepts the touch event. I am not sure what is causing it but having looked at the ScrollViewRenderer source I can see it contains a HorizontalScrollView container that it uses when orientation is set to ScrollOrientation.Horizontal. Somewhere OnInterceptTouch events blocks them and I reckon its in there.
Comment 1 John Halloran 2016-07-28 13:59:56 UTC
Created attachment 16813 [details]
Solution with custom renderer showing the problem.
Comment 2 adrianknight89 2016-10-19 08:32:46 UTC
In order to allow bidirectional scroll, XF is using two scrollviews. When the scroll mode is horizontal, the horizontal scrollview is catching the touch event. Any custom renderer you implement will actually be deriving from the vertical scrollview (which happens to be the parent). That's why you're not seeing anything.
Comment 3 adrianknight89 2016-10-19 18:16:04 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/472
Comment 4 Rui Marinho 2016-10-31 11:44:32 UTC
Should be fixed in 2.3.4-pre1
Comment 5 Parmendra Kumar 2016-12-01 14:55:43 UTC
I have checked this issue with Xamarin.Forms 2.3.4-pre1 and I am still getting same issue as bug description.

Screencast: http://www.screencast.com/t/BpQcjpEypy7

Hence reopened this issue.

Could you please follow the screencast and let me know If I have missed anything.


Thanks.
Comment 6 adrianknight89 2016-12-02 22:32:36 UTC
@Parmendra, can you test on a device and see if it behaves the same?
Comment 7 Parmendra Kumar 2016-12-05 13:20:43 UTC
Yes, I have checked this issue with MotoG(6.0.1) and I am getting same issue.
Comment 8 adrianknight89 2016-12-30 15:33:32 UTC
I tested this again on latest master and was unable to reproduce the issue. I suggest that you wait for 2.3.4-pre2 and test again.
Comment 9 adrianknight89 2016-12-30 15:34:23 UTC
Note that I don't have a MotoG. I tested it on S6.
Comment 10 Samantha Houts [MSFT] 2017-03-22 21:27:07 UTC
The fix does work. Make sure you open the CustomScrollView and uncomment the ExportRenderer attribute in the test project.