Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12988] iOS: Calling focus() on the next text field causes the parent scroll view to bounce on iPad 1 only

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-04-19T22:07:29.000+0000
Affected Version/sRelease 3.0.2
Fix Version/s2013 Sprint 08 API, 2013 Sprint 08, Release 3.1.1, Release 3.2.0
ComponentsiOS
LabelsSupportTeam, qe-closed-3.1.1
ReporterDaniel Sefton
AssigneeVishal Duggal
Created2013-03-07T00:19:36.000+0000
Updated2013-05-15T17:39:47.000+0000

Description

*Problem description* When calling focus() on the next text field in a vertical layout, the parent scroll view bounces instead of smoothly transitioning to the next field. It works fine on other devices e.g. iPad 3 and iOS simulator. *Test case*
var win1 = Titanium.UI.createWindow({
	title : 'Tab 1',
	backgroundColor : '#fff'
});

var scrollContainer = Ti.UI.createScrollView({
	height : Ti.UI.SIZE,
	layout : "vertical",
	left : 10,
	right : 10,
	bottom : 0
});

var formContainer = Ti.UI.createView({
	backgroundColor : "#fff",
	height : Ti.UI.SIZE,
	width : Ti.UI.FILL,
	layout : "vertical",
	top : 7,
	left : 0,
	right : 0,
	bottom : 7,
	borderWidth : 1,
	borderColor : '#000'
});
scrollContainer.add(formContainer);

var getTextFieldRow = function(arg) {

	var nameField = Titanium.UI.createTextField({
		id : arg.id,
		hintText : "ID: " + arg.id,
		color : '#444',
		font : {
			fontSize : 12,
			fontFamily : 'Helvetica Neue'
		},
		height : 35,
		width : 262,
		paddingLeft : 6,
		suppressReturn : false,
		returnKeyType : Titanium.UI.RETURNKEY_NEXT,
		borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
	});

	return nameField;
}
var textFields = [];
for (var i = 0; i < 30; i++) {
	textFields.push(getTextFieldRow({
		id : i
	}));
}

for (var i = 0; i < textFields.length; i++) {
	textFields[i].addEventListener('return', function(e) {
		if (e.source.id + 1 < textFields.length) {
			textFields[e.source.id + 1].focus();
		}
	});
	formContainer.add(textFields[i]);
}

win1.add(scrollContainer);
win1.open();

Comments

  1. Blain Hamon 2013-03-18

    Aha. I get it, I get it. iPad 1 is the only iPad that's single core. It's a timing issue because of that.
  2. Blain Hamon 2013-03-21

    https://github.com/appcelerator/titanium_mobile/pull/4007
  3. Vishal Duggal 2013-04-17

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/4178 Huge regression path. Apologies.
  4. Sabil Rahim 2013-04-19

    FR
  5. Vishal Duggal 2013-04-22

    Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4202
  6. Olga Romero 2013-05-15

    Verified fix with: Appcelerator Studio, build: 3.1.1.201305142215 SDK, build: 3.1.1.v20130514180723 Device: iPad 1 iOS 5.1.1 When calling focus() on the next text field in a vertical layout, the parent scroll view is smoothly transitioning to the next field

JSON Source