Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1306

AttributedString proxy property doesn't work if there's whitespace

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Cannot Reproduce
    • Affects Version/s: Alloy 1.7.0
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
      None
    • Environment:

      SDK 5.0.0.GA
      CLI 5.0.1.GA / Alloy 1.7.8

      Description

      The <AttributedString> described in the docs does not work if there's whitespace between the <Label> and <AttributedString> elements because of TIMOB-19168.

      XML

      <Alloy>
      	<Window>
      		<Label>
      			<AttributedString class="ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis vel orci sit amet facilisis. Sed lobortis ante et sapien sagittis, eu mattis libero suscipit.</AttributedString>
      		</Label>
      	</Window>
      </Alloy>
      

      TSS

      ".ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING" : {
      	attributes: [
      		{
      			type: Ti.UI.ATTRIBUTE_LINE_BREAK,
      			value: Ti.UI.ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING,
      			range: [0, 164]
      		}
      	]
      }
      

      compiled

          $.__views.__alloyId14 = Ti.UI.createAttributedString({
              attributes: [ {
                  type: Ti.UI.ATTRIBUTE_LINE_BREAK,
                  value: Ti.UI.ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING,
                  range: [ 0, 164 ]
              } ],
              text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis vel orci sit amet facilisis. Sed lobortis ante et sapien sagittis, eu mattis libero suscipit.",
              id: "__alloyId14"
          });
          $.__views.__alloyId13 = Ti.UI.createLabel({
              font: {
                  fontSize: 17
              },
              text: "",
              attributedString: $.__views.__alloyId14,
              id: "__alloyId13"
          });
      

      As you can see the text property is set to "" which because of TIMOB-19168 results in an empty label. The workaround is to do:

      <Alloy>
      	<Window>
      		<Label><AttributedString class="ATTRIBUTE_LINE_BREAK_BY_CHAR_WRAPPING">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis vel orci sit amet facilisis. Sed lobortis ante et sapien sagittis, eu mattis libero suscipit.</AttributedString></Label>
      	</Window>
      </Alloy>
      

      But Alloy should take care of this since it doesn't make sense to set a text and attributedString at the same time, in particular because of TIMOB-19168 and that all samples in the documentation include spacing.

      I was also wondering why do we have 2 alternate (the other being ALOY-961) implementations for attributedStrings in Alloy?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                batman Bruce Wayne
                Reporter:
                fokkezb Fokke Zandbergen
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code