Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13915] iOS: backgroundGradient property appears as empty object in Javascript

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsios, parity
ReporterTony Lukasavage
AssigneeUnknown
Created2013-05-20T14:25:42.000+0000
Updated2018-02-28T20:03:37.000+0000

Description

problem

When setting a backgroundGradient for a view in iOS, the property applies properly, but trying to access the property or print it returns an empty object. On Android or Mobileweb if I attempt to JSON.stringify() a view's backgroundGradient property, I get all the values associated with the property as expected. If I do the same on iOS, I get only an empty object. {}. While not critical, this makes it impossible for me to perform runtime testing to assert that Alloy is applying styles correctly when backgroundGradient is being used on iOS. This makes it particularly tricky if there is a platform-specific style for iOS that includes a gradient.

expected

Like Android and Mobileweb, if I perform JSON.stringify(someView.backgroundGradient) I would like to be able to see the stringified property, not just an empty object.

test case

var win = Ti.UI.createWindow({
	backgroundGradient: {
        type: "linear",
        startPoint: {
            x: "0%",
            y: "0%"
        },
        endPoint: {
            x: "0%",
            y: "100%"
        },
        colors: [ "#7de36e", "#1e8010" ]
    }
});

Ti.API.info(JSON.stringify(win.backgroundGradient));

win.open();
On iOS this will print only an empty object, on Android and Mobileweb it will be:
{"type":"linear","startPoint":{"x":"0%","y":"0%"},"endPoint":{"x":"0%","y":"100%"},"colors":["#7de36e","#1e8010"]}

Comments

  1. Ingo Muschenetz 2014-04-07

    To fix, we'd have to refactor the code to use properties as opposed to private variables.

JSON Source