[AC-2089] Android scrollview unusable with swipe
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-10-16T16:49:27.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android |
Reporter | John Liddell |
Assignee | Mauro Parra-Miranda |
Created | 2013-10-16T16:41:39.000+0000 |
Updated | 2016-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;
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
there is only one scrollable control existing in this window, this is the TI example on scroll views from kitchen sink...
Hello John, the scrolling of the scrollableview is being transfered to the window as well, that's the reason is acting weird. Best, Mauro
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.
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
It in fact does not work event with a single scroll view.
Hello, you said that it works if you don't add the event in the window, right? Does the scrollview works? Best, Mauro
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.
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
my concern is not with scrollableview but with scrollview
Invalid issue.