Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5972] When the width of the ScrollableView is changed the current page of a ScrollableView is changed

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-11-11T09:39:24.000+0000
Affected Version/sRelease 1.7.3, Release 1.8.0
Fix Version/sSprint 2011-45, Release 1.8.0.1
ComponentsiOS
Labelscurrentpage, ios, module_scrollableview, parity, resize, scrollableView, width
ReporterFrancisco Antonio Duran Ramirez
AssigneeSabil Rahim
Created2011-11-03T07:15:27.000+0000
Updated2011-12-07T15:59:05.000+0000

Description

Problem

When the width of the ScrollableView changes, the current page on the screen inexplicably jumps to 0, while the currentPage property itself remains whatever you set it to. This is visible if you press "scroll" and then the "resize" button.

Reproducible steps:

1. Run the code below 2. Scroll to page 1 on the green square 3. Press the scroll button 4. Press the resize button notice that the current page is changed

Expected behavior:

Customer wants to keep the number of the current page after press the resize button.

More details:

Tested in a mobile device with Android, and worked well.

Sample code:

var win = Titanium.UI.createWindow({
 	backgroundColor : '#f0f0f0',
	layout : 'vertical'
});

var views = [];

for(var i = 0; i < 3; i++) {
	views[i] = Ti.UI.createView();
	views[i].add(Ti.UI.createLabel({
		text : i,
		width : 'auto',
		height : 'auto'
	}));
}

var parentView = Ti.UI.createView({
	width : 100,
	height : 100
});
var scrollableView = Ti.UI.createScrollableView({
	borderColor : 'green',
	borderWidth : 1,
	views : views,
	showPagingControls : true,
	pagingControlHeight : 20,
	currentPage : 2
});

var scrollButton = Ti.UI.createButton({
	title : 'scroll',
	width : 100,
	height : 50
});
scrollButton.addEventListener('click', function() {
	scrollableView.currentPage = 2;
});
var resizeButton = Ti.UI.createButton({
	title : 'resize',
	width : 100,
	height : 50
});
resizeButton.addEventListener('click', function() {
	parentView.width = 200;
	Ti.API.info('currentPage: ' + scrollableView.currentPage + ' (supposedly...)');
});

parentView.add(scrollableView);

win.add(parentView);

win.add(scrollButton);
win.add(resizeButton);
win.open();

Helpdesk

APP-256873

Comments

  1. Sabil Rahim 2011-11-09

    pull pending #656
  2. Michael Pettiford 2011-12-07

    Tested on Ti Studio 1.0.7.201112061404 
Ti Mob SDK 1.8.0.1.v20111207091653 
OSX Lion iPhone 4S OS 5.0.1 Expected behavior of the current page being kept the same after resize is shown

JSON Source