[TIMOB-10331] MobileWeb: scrollView - does not handle the contentHeight changing as it should
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-09T23:09:04.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Sprint 2012-16 API, Release 3.0.0 |
Components | MobileWeb |
Labels | api, qe-port |
Reporter | Jon Alter |
Assignee | Bryan Hughes |
Created | 2012-08-06T13:17:04.000+0000 |
Updated | 2012-08-28T16:44:06.000+0000 |
Description
If you are scrolled to the bottom of a scrollView and then the contentHeight of the scrollView is reduced, you will be shown the bottom where the scrollView was, not the new bottom.
Steps to repro:
1. run the code below 2. scroll to the bottom 3. click the button 4. notice that you no longer see the blue content view 5. touch the scroll view 6. notice that suddenly you are at the bottom of the blue view
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
win.open();
var scrollView = Ti.UI.createScrollView({
top: 60,
height: 400,
contentHeight: Ti.UI.SIZE
});
win.add(scrollView);
var contentView = Ti.UI.createView({
height: 1000,
backgroundColor: 'blue',
borderWidth: 5,
borderRadius: 20,
borderColor: 'red'
});
scrollView.add(contentView);
var button = Ti.UI.createButton({
title: 'Click me',
width: 100,
height: 40,
top: 10
});
win.add(button);
button.addEventListener('click', function(){
contentView.height = 400;
});
Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2694
Verified fix on: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120827143312 Chrome 21.0.xx Firefox 15 Safari 6.0 Android 4.0.4 default browser,chrome 18.0.xx ,firefox 15.0 Iphone 5.0.1 mobile safari