[TIMOB-27694] Android: Textfield.focus() method is not working in Ti SDK 8.3.0.GA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-01-03T17:28:29.000+0000 |
Affected Version/s | Release 8.2.1, Release 8.3.0 |
Fix Version/s | Release 8.3.1 |
Components | Android |
Labels | engSchedule, escalation |
Reporter | Motiur Rahman |
Assignee | Christopher Williams |
Created | 2019-12-20T14:24:47.000+0000 |
Updated | 2020-07-16T04:58:48.000+0000 |
Description
*Issue:* Textfield.focus() method is not working properly on android after updating to 8.3.0. It is getting focused but no keyboard is shown. The keyboard is only showing on the click of the TextField but if I call TextField.focus() then textfield is getting focused without a keyboard.
*Steps To Reproduce:*
1. Create a classic project
2. Paste this code in app.js file
3. Run it on android device or emulator
4. Click on the "Focus Test" Button
*Note: Works as expected with Ti SDK 8.2.0.GA*
var win = Ti.UI.createWindow({
title : "Focus Test",
backgroundColor : 'red',
layout : "vertical"
});
// Create a TextField.
var aTextField = Ti.UI.createTextField({
height : 40,
top : 30,
left : 20,
right : 20,
backgroundColor : "gray",
hintText : 'This is hint text',
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
keyboardType : Ti.UI.KEYBOARD_DEFAULT,
returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
// Listen for return events.
aTextField.addEventListener('return', function(e) {
aTextField.blur();
alert('Input was: ' + aTextField.value);
});
// Add to the parent view.
win.add(aTextField);
// Create a Button.
var test = Ti.UI.createButton({
title : 'Focus Test',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE,
top : 50,
});
// Listen for click events.
test.addEventListener('click', function() {
aTextField.focus();
//alert('\'aButton\' was clicked!');
});
// Add to the parent view.
win.add(test);
win.open();
master/9.0.0: https://github.com/appcelerator/titanium_mobile/pull/11405 8_3_X backport: https://github.com/appcelerator/titanium_mobile/pull/11406
I've supplied a very small patch for master (9.0.0 target) and a backport for 8_3_X branch if we wanted to ask them to try a non-GA maintenance build as a fix (
ti sdk install -b 8_3_X
) if/once it gets merged and built. For now a simple workaround is to explicitly set theeditable
property to true on the textfield.Verified the fix with SDK 8.3.1.v20191220101805 & 9.0.0.v20200103081513. Closing.
Removing from fixVersion 9.0.0 as this shipped in 8.3.1.GA