Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24851

Android: Deprecate Label "wordWrap" property (it's not needed)

    Details

    • Story Points:
      5
    • Sprint:
      2018 Sprint 06 SDK

      Description

      Summary:
      The Ti.UI.Label "wordWrap" property is Android only (ie: not portable). When set false, newline '\n' characters are ignored and the label is put into single-line mode.

      This property is unnecessary and should be ignored/deprecated.

      Reason 1:
      If you want newline '\n' characters to be ignored, then you should remove them from the string yourself before applying them to the label. For example:

      var myString = "Test1\nTest2\nTest3";
      var label = Ti.UI.createLabel({
      	text: myString.replace(/\n/g, ""),
      });
      

      Reason 2:
      If you want to limit a label's text to 1 line, then you should set the "maxLines" property to 1. This property is supported on all platforms and will show ellipsis (enabled by default) if the text does not fit within the label. It also honors newlines characters too and would show ellipsis where the line break occurs.

      var label = Ti.UI.createLabel({
      	text: "This is line 1.\nLine 2 cannot be seen.",
      	maxLines: 1,
      });
      

      Reason 3:
      Setting a width on a label implies a wrapping width already, making the "wordWrap" property redundant. And if you don't want to word wrap (and honor newlines), then you can set the label's width to Ti.UI.SIZE (the default setting) and put it into a horizontal ScrollView.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              gmathews Gary Mathews
              Reviewer:
              Gary Mathews
            • Watchers:
              4 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