GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-12T14:54:07.000+0000 |
Affected Version/s | Release 1.8.2, Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-08, Release 2.1.1, Release 3.0.0 |
Components | Android |
Labels | SupportTeam, api, qe-testadded, regression |
Reporter | Federico Casali |
Assignee | Hieu Pham |
Created | 2012-04-17T16:36:15.000+0000 |
Updated | 2012-07-16T23:55:23.000+0000 |
Problem description
Changing label textid property causes the label to disappear.
Steps to reproduce and sample code
- Create a window, put a label with textid property.
- Add an event listener on the label (or on the view) in order to modify the textid content
- Click and trigger the eventListener
Result: 'textid' content changed as expected
- Click again
Result: label disappears
See attached sample code:
var win = Titanium.UI.createWindow({
backgroundColor:'white',
title:'window',
barColor:'#ff7b01',
top:0
});
var view = Ti.UI.createView({
top:0,
height:80,
right:0,
left:0
});
var label = Ti.UI.createLabel({
font:{fontSize:30,fontFamily:'Helvetica Neue'},
color:'red',
left:0,
width:'100%',
text:'Label1',
right:'10%',
textid:'check'
});
view.add(label);
view.addEventListener('click',function(e){
label.text = 'Label1 is fine';
label.textid='new';
// alert(label.textid);
})
win.add(view)
win.open();
Additional notes
Not able to reproduce on 1.7.6
textId and text properties cannot be used at the same time. One will overwrite the other. Setting textId will cause a resource lookup on that key (a key defined in Android resources), and set the label's text to the corresponding value. If this key is undefined, the text is set to an empty string. I will submit a PR with a fix such that if the key is undefined, we will not MODIFY the existing text, i.e not setting it to an empty string. Please look at http://docs.appcelerator.com/titanium/2.0/#!/api/Titanium.UI.Label for more details.
Tested with 2.0.2.v20120505151714 with Samsung Nexus S 4.0.4
Occurs with Xoom tablet running 4.0.3 using SDK 2.1.1.v20120705143056 and SDK 2.1.0GA.
Fix for this needs to backport into 2.1.1.
Environment used for verification - Tested with Titanium SDK: 2.1.1.v20120716180600 Tested with Titanium Studio: 2.1.1.201207161421 Device - Android Emulator 2.3.3 Machine OS - MAC 10.7.3