Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10331] MobileWeb: scrollView - does not handle the contentHeight changing as it should

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-09T23:09:04.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsMobileWeb
Labelsapi, qe-port
ReporterJon Alter
AssigneeBryan Hughes
Created2012-08-06T13:17:04.000+0000
Updated2012-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;
});

Comments

  1. Bryan Hughes 2012-08-07

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2694
  2. Lokesh Choudhary 2012-08-28

    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

JSON Source