[TIMOB-9955] Android: ScrollView with a wrap view becomes unscrollable on android Ti 2.1
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-04-01T17:47:29.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Sprint 2012-15 Core |
Components | Android |
Labels | core, module_scrollview, parity, qe-review, qe-testadded |
Reporter | Nikhil Sharma |
Assignee | Allen Yeung |
Created | 2012-07-12T14:04:59.000+0000 |
Updated | 2013-04-02T07:07:57.000+0000 |
Description
ScrollView with a wrap view becomes unscrollable on android Ti SDK 2.1.0.GA. It works on Ti SDK 2.0.1.GA2. It works fine on iOS.
Repo Steps
1. Run the below code in your app.js 2. You can see the scrollView becomes unscrollable.
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var scrollView = Ti.UI.createScrollView({
top : 44,
left : 0,
right : 0,
bottom : 0,
showVerticalScrollIndicator : true,
showHorizontalScrollIndicator : true,
canCancelEvents : false,
zIndex : 10
});
var view = Ti.UI.createView({
backgroundColor:'blue',
left : "4%",
right : "4%",
layout: 'vertical',
top : 0
});
for (var i = 0; i < 20; i++) {
var v = Ti.UI.createLabel({
backgroundColor: 'green',
height : 50,
top : 50,
text : i
});
view.add(v);
};
contentHeight = 2050;
scrollView.contentHeight = view.height = contentHeight;
scrollView.add(view);
win.add(scrollView);
win.open();
The test example attached above works as expected. Setting "canCancelEvents: false" limits scroll touch area to 4% from left/right borders.
PR Ready: https://github.com/appcelerator/titanium_mobile/pull/2634
More detailed test steps: 1. Launch the app.js above 2. Long press either the blue background, or a green label, and then scroll up and down with the same press. (the view should not scroll) 3. Try to scroll inside blue background without a long press, and it should scroll. This behavior should match iOS.
Verified fixed with mobile sdk-2.2.0.v20120810080115 Titanium Studio, build: 2.1.1.201207271312
Occurs on: Titanium SDK: 2.1.2.v20120816171609 Titanium Studio: 2.1.2.201208192014 Device: Samsung GALAXY Note (2.3.6) Fixed with: SDK version: 2.2.0.v20120810080115
I have reverted the fix for this in https://github.com/appcelerator/titanium_mobile/pull/3558. For android, we actually block all events from any subview to the scroll view and it's the closest we can get to the iOS implementation since it just maps to a native property. I have documented that there may be a difference between iOS and Android in the docs in this PR. If you want the blue view to scroll for this test case, I would recommend not setting the 'canCancelEvents' property to false.
Scrollview is now scrollable. Verified with following env. Titanium SDK: 3.0.0.GA Titanium Studio:3.0.1.201212181159 Device: LG-P970 Android 2.2.2
ScrollView in not scrollable. Tested on: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.0.v20130331073351 CLI version : 3.0.25-alpha OS : MAC OSX 10.7.5
Please read the comments before reopening. As I mentioned, it SHOULD be unscrollable if you specify 'canCancelEvents' to false. The docs have also been updated to reflect this.
working as expected, Hence closing it.