Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1052] iOS: color-property sometimes overrides color set in attributedString

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2015-07-06T06:06:35.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsTCSupportTriage, attributedString, color
ReporterFokke Zandbergen
AssigneeRadamantis Torres-Lechuga
Created2014-11-12T13:03:05.000+0000
Updated2016-03-08T07:37:23.000+0000

Description

The following test case shows that the color property of a Ti.UI.Label *sometimes* overrides color set in the Attributed String, while I expect the color always to be the default.

Test Case

Remove the comments before top:20 and you'll see *ipsum* is no longer red, but green like the rest of the text.
var win = Titanium.UI.createWindow({
  backgroundColor: '#ddd',
});

win.add(Ti.UI.createLabel({
  // top: 20,
  color: 'green',
  attributedString: Ti.UI.iOS.createAttributedString({
    text: 'Bacon ipsum dolor',
    attributes: [{
      type: Ti.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,
      value: 'red',
      range: [6, 5]
    }, {
      type: Ti.UI.iOS.ATTRIBUTE_FONT,
      value: {
        fontSize: 17
      },
      range: [6, 5]
    }]
  })
}));

win.open();
The same is probably true for TextField and TextArea as well.

Comments

No comments

JSON Source