Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1320] Styles not applied when an element uses another namespace

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-10-30T09:39:35.000+0000
Affected Version/salloy 1.7.22
Fix Version/sRelease 5.2.0, alloy 1.7.23
ComponentsStyling
Labelsn/a
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao
Created2015-10-28T12:43:27.000+0000
Updated2016-02-02T23:03:31.000+0000

Description

When an Alloy view element uses another namespace styles are no longer applied. When you set ns to the default Ti.UI it still works, but any other value will not. *index.xml*
<Alloy>
    <Window>
        <View />
        <View ns="Ti.UI" />
        <View ns="Ti.UI.Android" />
    </Window>
</Alloy>
*index.tss*
'View': {
	backgroundColor: 'red'
}
*Compiled code*
    $.__views.__alloyId0 = Ti.UI.createView({
        backgroundColor: "red",
        id: "__alloyId0"
    });
    $.__views.index.add($.__views.__alloyId0);
    $.__views.__alloyId1 = Ti.UI.createView({
        backgroundColor: "red",
        id: "__alloyId1"
    });
    $.__views.index.add($.__views.__alloyId1);
    $.__views.__alloyId2 = Ti.UI.Android.createView({
        id: "__alloyId2"
    });

Comments

  1. Feon Sua Xin Miao 2015-10-28

    Is Ti.UI.Android.createView() a valid function? Regardless, the workaround for now is to assign an id to the view that uses another namespace.
  2. Fokke Zandbergen 2015-10-29

    No it's not ;) But you get the idea right?
  3. Feon Sua Xin Miao 2015-10-29

    PR: https://github.com/appcelerator/alloy/pull/736 Test app: https://github.com/feons/alloy/tree/ALOY-1320/test/apps/testing/ALOY-1320 Functional Test: 1. Run test app, style should be applied to CustomLabel and it's text should be red.
  4. Fokke Zandbergen 2015-10-30

    Tested using the included app and compiled code is as expected!
  5. Eric Wieber 2016-02-02

    Verified fixed, using: MacOS 10.11.3 (15D21) Studio 4.5.0.201601262138 Ti SDK 5.2.0.v20160202103508 Appc NPM 4.2.3-1 Appc CLI 5.2.0-239 Alloy 1.7.33 Xcode 7.2 (7C68) Styles are correctly applied when the element is using a namespace other than the default. Tested using the provided test case and the app located here: https://github.com/feons/alloy/tree/ALOY-1320/test/apps/testing/ALOY-1320

JSON Source