Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24236] Support language natural direction text alignment

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2016-12-17T17:11:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsRTL
ReporterHazem Khaled
AssigneeEric Merriman
Created2016-12-16T16:57:21.000+0000
Updated2017-03-24T18:03:20.000+0000

Description

We want to add new natural text alignment, already supported both iOS and Android, for Android natural is anyRtl. iOS https://developer.apple.com/reference/uikit/uilabel/1620541-textalignment Android https://developer.android.com/reference/android/view/View.html#attr_android:textDirection
var win = Ti.UI.createWindow({
        layout: 'vertical'
    }),
    rtlLabel = Ti.UI.createLabel({
        text: "أنقذوا حلب، أنقذوا سوريا!!",
        top: 30,
        textAlign: Ti.UI.TEXT_ALIGNMENT_NATURAL
    }),
    ltrLabel = Ti.UI.createLabel({
        text: "Save Aleppo, Save Syria!!",
        top: 30,
        textAlign: Ti.UI.TEXT_ALIGNMENT_NATURAL
    });

win.add(rtlLabel);
win.add(ltrLabel);

win.open();

Comments

  1. Hans Knöchel 2016-12-17

    Hey [~hazemkhaled], we recently changed the iOS text-alignment to be natural by default (see [this snippet](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUtils.m#L1354) from 6.1.0 / master), which still behaves as left-aligned text for your example. For advanced RTL-styles, use the [Ti.UI.ATTRIBUTE_WRITING_DIRECTION_RIGHT_TO_LEFT](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-ATTRIBUTE_WRITING_DIRECTION_RIGHT_TO_LEFT) attribute for attributed labels.
  2. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source