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"]}
To fix, we'd have to refactor the code to use properties as opposed to private variables.