Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2089] Android scrollview unusable with swipe

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2013-10-16T16:49:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid
ReporterJohn Liddell
AssigneeMauro Parra-Miranda
Created2013-10-16T16:41:39.000+0000
Updated2016-03-08T07:41:03.000+0000

Description

Adding a swipe event listener to a window containing a scrollview causes the scrollview to stop scrolling properly on Android. added one line to the kitchensink scroll_views_basic.js to reproduce.
function scroll_view_basic(_args) {
	var win = Titanium.UI.createWindow({
		title:_args.title
	});
	
	win.addEventListener('swipe', function(e){});
	
	var scrollView = Titanium.UI.createScrollView({
		contentWidth:'auto',
		contentHeight:'auto',
		top:0,
		showVerticalScrollIndicator:true,
		showHorizontalScrollIndicator:true
	});
	
	
	var view = Ti.UI.createView({
		backgroundColor:'#336699',
		borderRadius:10,
		width:300,
		height:2000,
		top:10
	});
	
	scrollView.add(view);
	
	var button = Titanium.UI.createButton({
		title:'Scroll to Top',
		height:40,
		width:200,
		bottom:10
	});
	view.add(button);
	button.addEventListener('click', function()
	{
		scrollView.scrollTo(0,0);
	});
	
	var button2 = Titanium.UI.createButton({
		title:'Add to Scroll View',
		height:40,
		width:200,
		top:20
	});
	scrollView.add(button2);
	button2.addEventListener('click', function()
	{
		var view = Ti.UI.createView({
			backgroundColor:'red',
			borderRadius:10,
			width:300,
			height:300,
			top:2020
		});
		scrollView.add(view);
	
	});
	
	win.add(scrollView);
	
	return win;
};

module.exports = scroll_view_basic;

Comments

  1. Mauro Parra-Miranda 2013-10-16

    Hello, we don't recommend have multiple scrollable controls in the same view. It doesn't work because the swipe is being transferred to the parent view. Is there any way you can redesign your UI? Best, Mauro
  2. John Liddell 2013-10-16

    there is only one scrollable control existing in this window, this is the TI example on scroll views from kitchen sink...
  3. Mauro Parra-Miranda 2013-10-16

    Hello John, the scrolling of the scrollableview is being transfered to the window as well, that's the reason is acting weird. Best, Mauro
  4. John Liddell 2013-10-16

    the scrolling works perfectly fine if you remove the line adding a swipe event listener. can be reproduced in a single windowed single scrollview project as well.
  5. Mauro Parra-Miranda 2013-10-16

    Hello John, yes, it works just fine because you are not adding several views/windows with different scrolling. i.e., the unusable part is because you can't put two different scrolling elements on top of the other. Best, Mauro
  6. John Liddell 2013-10-16

    It in fact does not work event with a single scroll view.
  7. Mauro Parra-Miranda 2013-10-16

    Hello, you said that it works if you don't add the event in the window, right? Does the scrollview works? Best, Mauro
  8. John Liddell 2013-10-16

    if i create a single window and a single scrollview, then addEventListener('swipe', function(x){}); to either the window or the scrollview, the scrollview will no longer scroll properly. i am not trying to do multiple scrolling items on one view.
  9. Mauro Parra-Miranda 2013-10-16

    Hello John, you can't add a swipe event to scrollableview. It already has a similar event, therefore if you add two, it will work funky or not work at all. If you add a swipe to the window, the actions in the scrollview will be transmitted to the parent (i.e., the window) and will act funky with the scrollable view. Best, Mauro
  10. John Liddell 2013-10-16

    my concern is not with scrollableview but with scrollview
  11. Mauro Parra-Miranda 2013-11-24

    Invalid issue.

JSON Source