[TIMOB-7400] Android: ScrollView - Runtime error generated when scrollView.contentOffset object is used in a call back function
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-11T22:31:13.000+0000 |
Affected Version/s | Release 1.8.0.1, Release 1.8.1 |
Fix Version/s | Sprint 2012-03, Release 2.0.0, Release 1.8.2 |
Components | Android |
Labels | parity, qe-and012312, qe-testadded |
Reporter | Wilson Luu |
Assignee | Hieu Pham |
Created | 2012-01-25T13:49:19.000+0000 |
Updated | 2012-03-11T22:31:13.000+0000 |
Description
Steps to reproduce:
1. Launch the following code in app.js:
var win = Titanium.UI.createWindow({
layout:'vertical',
backgroundColor:'#fff'
});
var scrollView = Ti.UI.createScrollView({
showHorizontalScrollIndicator:true, showVerticalScrollIndicator:true,
width: 250, height: 100, top: 50,
borderColor:'green', borderWidth:1,
contentWidth:1000, contentHeight:100
});
for(var i=0; i<10; i++) {
for(var j=0; j<10; j++) {
scrollView.add(Ti.UI.createLabel({
top:i*100, left:j*100,
width:100, height:100,
text:i+':'+j, textAlign:'center',
color:'white',
backgroundColor:'#A0' + Number(i%2*8).toString(16) +'0'+ Number(8-j%2*8).toString(16)+'0',
borderColor:'black', borderWidth:1
}));
}
}
var button = Ti.UI.createButton({title:'Flip', width:100, height:50});
button.addEventListener('click', function() {
scrollView.width = 100;
scrollView.height = 250;
scrollView.contentWidth = 100;
scrollView.contentHeight = 1000;
button.title = 'Click again';
});
scrollView.addEventListener('scroll', function() {
// bug is here
Ti.API.info('Offset: (' + scrollView.contentOffset.x + ', ' + scrollView.contentOffset.y + ')');
});
win.add(scrollView);
win.add(button);
win.open();
Actual: Runtime error occur. See attachment.
Expected: Should not get a runtime error. Above code ran without error in iOS
Note: Occurs in 1.8.0.1
Attachments
File | Date | Size |
---|---|---|
device-2012-01-25-125800.png | 2012-01-25T13:49:19.000+0000 | 30164 |
updated title
Testing code:
No longer getting the runtime error, however the vertical scroll is not responding Tested with 1.9.0.v20120208180134 on Droid 3 (2.3.4)
Vertical scroll issue has a separate bug TIMOB-7402 closing this as we no longer get the runtime error