Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1589] ListItem having a Label with AttributedString is not working

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-11-20T18:39:01.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK
Labelsn/a
Reporterankur garha
AssigneeBruce Wayne
Created2017-09-24T06:05:34.000+0000
Updated2018-07-27T12:19:04.000+0000

Description

<ListView id="listView" defaultItemTemplate="result">
  <Templates>
    <ItemTemplate name="result">
        <Label  bindId="title" id="title" />
    </ItemTemplate>
  </Templates>
  <ListSection id="section"></ListSection>
</ListView>
var snippet = "Test string";
var formatter = Ti.UI.createAttributedString({
  text : snippet,
  attributes : [{
    type : Titanium.UI.ATTRIBUTE_FOREGROUND_COLOR,
    value : 'red',
    range : [0, 4]
  }]
});

var item = {
  snippet : {
    text : snippet,
    attributedString : formatter
  },
  properties : {
    accessoryType : Titanium.UI.LIST_ACCESSORY_TYPE_NONE
  },
};
 
$.section.appendItems([item]);

It's always giving an error like this :-
[ERROR] :  Script Error: {
[ERROR] :      column = 32;
[ERROR] :      line = 223;
[ERROR] :      message = "Invalid type passed to function";
[ERROR] :      nativeLocation = "-[TiUILabel setAttributedString_:] (TiUILabel.m:491)";
[ERROR] :      nativeReason = "expected: TiUIAttributedStringProxy, was: NSNull";
[ERROR] :      stack = "[native code]\nrefresh\nController\ncreateController\ngoToInspectionPanel\n";
[ERROR] :  }

Attachments

FileDateSize
Simulator Screen Shot - iPhone 7 Plus - 2017-11-09 at 12.48.59.png2017-11-09T20:49:49.000+000070709

Comments

  1. Hans Knöchel 2017-09-24

    Looks related to AC-1009 which was resolved by the creator of the ticket. Please ensure you cleaned your build-directory and watch out for possible typos. If it's still not working after that, we can move it to the Alloy-space, thx!
  2. Sharif AbuDarda 2017-10-15

    Hello [~speedyankur@gmail.com], Can you please follow up on [~hknoechel], comment above? Let us know if you have done the things properly. Thanks.
  3. Sharif AbuDarda 2017-10-31

    Hello [~speedyankur@gmail.com], Any update on your issue?
  4. ankur garha 2017-11-01

    No its still not working for me.
  5. Feon Sua Xin Miao 2017-11-09

    Works for me with SDK 6.3.0.GA, CLI 6.3.0. Above test app launched with no error, please see attached screen shot.
  6. Feon Sua Xin Miao 2017-11-20

    Please reopen with more information if occurs.
  7. Jonas Funk Johannessen 2018-07-27

    Using 7.1.1.GA the error is reproducible if template with a Ti.UI.TextArea is set with Ti.UI.AttributedString in one Ti.UI.ListItem and plain string value in another.

JSON Source