Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6490] iOS: keyboardToolbar stays on the screen after the keyboard is gone

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-12-14T10:50:37.000+0000
Affected Version/sRelease 1.8.0, Release 1.7.6
Fix Version/sSprint 2011-49, Release 1.7.6, Release 1.8.0.1
ComponentsiOS
Labelsn/a
ReporterQing Gao
AssigneeStephen Tramer
Created2011-12-06T14:50:14.000+0000
Updated2014-06-19T12:44:18.000+0000

Description

After the textfield lose focus, the keyboard is gone but in some case the keyboardToolbar is still left on the screen.

Repro Steps

1.Build a project based on the following code. 2.Click the first row of testFields and the keyboard will appear. 3.Continuously click the "next" button on the keyboardToolbar for 4 times and then click the "Done" button on the same keyboardToolbar. Expected Result: The keyboardToolbar should be gone with the keyboard. Actual Result: The keyboardToolbar still stays in the middle of the screen while the keyboard is gone.
Titanium.UI.setBackgroundColor('#000');
var datasource=[],textFieldArray=[],table,rowId=1,textFieldId= 0;
var win1 = Titanium.UI.createWindow({
	title:'Window',
	barColor:'#808080',

});

for (i = 0; i <=12; i++) {

	var row = createRows(rowId);
	datasource.push(row);
	rowId++;

}
table=Titanium.UI.createTableView({
	top:0,
	data:datasource
})

win1.add(table);
function createRows(_rowId) {
	var row = Titanium.UI.createTableViewRow();
	row.rowId = _rowId;
	row.height=60;
	var flexSpace = Titanium.UI.createButton({
		systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
	});

	var navButtons = Titanium.UI.createButtonBar({
		labels:['Previous','Next'],
		backgroundColor:'#000',
		top:100,
		style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
		height:25,
		width:'auto'
	});
	var done = Titanium.UI.createButton({
		systemButton:Titanium.UI.iPhone.SystemButton.DONE
	});
	var inputTextField = Titanium.UI.createTextField({
		color : '#ff7c00',
		top : 5,
		height : 50,
		textAlign : 'right',
		width : '25%',
		hintText : '',
		left : '65%',
		right : '8%',
		keyboardToolbar : [navButtons,flexSpace,done],
		keyboardToolbarColor : '#898989',
		returnKeyType : Titanium.UI.RETURNKEY_DEFAULT,
		borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
		keyboardType : Titanium.UI.KEYBOARD_NUMBER_PAD,
		font : {
			fontSize : 20,
			fontColor : '#ff7c00',
			fontWeight : 'bold',
			fontFamily : 'Helvetica Neue'
		}
	});
	inputTextField.rowId=_rowId
	textFieldId = textFieldId + 1;
	inputTextField.id = textFieldId;
	textFieldArray.push(inputTextField);
	inputTextField
	.addEventListener(
	'blur', function(e) {
	});
	navButtons.addEventListener('click', function(e) {
		max = textFieldArray.length;

		if(e.index ===0) { /*Prev Tab*/

			if(	inputTextField.id ===1) {
				done.fireEvent('click');
			} else {

				var rowIndex=inputTextField.rowId-1;

				changeFocus(rowIndex,0,textFieldArray);
			}
		} else { /*Next Tab*/

			if(inputTextField.id === max) {
				done.fireEvent('click');
			} else {
				var rowIndex=inputTextField.rowId+1;
				changeFocus(rowIndex,1,textFieldArray) ;
			}
		}

	});
	done.addEventListener('click', function() {
		for(i=0,j=textFieldArray.length;i<j;i++) {
			var textField =  textFieldArray[i];
			textField.blur();
		}
	});
	row.add(inputTextField);
	return row;

}

function changeFocus(_rowIndex,_flag,textFieldArray) {

	table.scrollToIndex(_rowIndex,{animated:true,position:Ti.UI.iPhone.TableViewScrollPosition.BOTTOM});

	textFieldArray[_rowIndex-1].focus();

};

win1.open();

Attachments

FileDateSize
Screen shot 2011-12-06 at 2.48.45 PM.png2011-12-06T14:50:14.000+000098379

Comments

  1. Dustin Hyde 2011-12-08

    Bug fixed. Verified on: SDK: 1.8.0.1.v20111208104316 Studio: 1.0.7.201112080131 OS: OS X Lion Devices Tested: iOS Simulator 5.0 iPhone/iPad
  2. Stephen Tramer 2011-12-14

    Removing merge tag.

JSON Source