Problem
The endPoint property of a Gradient (as seen in the documentation [here](
http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Gradient-property-endPoint)) is documented as defaulting to {"y": 1.0, "x": 0.0}. It does not. If left unspecified, the gradient is not applied. Also, setting y to 1.0 (as the same documentation shows) does not work...it must be set to '100%'.
Problem description
Gradient endPoint property does not work as documented and doesn't take the default value properly.
Steps to reproduce
1. Run the following code. The square is solid red.
2. Uncomment the "1st test" line and run again. The box still appears solid red.
3. Now comment back out the "1st test" line, uncomment the "2nd test" line, and run again. Now the box appears with the correct gradient.
{panel:title=app.js}
var win1=Ti.UI.createWindow({
layout:'vertical',
backgroundColor:'gray',
exitOnClose:true,
navBarHidden:true
});
var view1=Ti.UI.createView({
height:100,
width:100,
backgroundGradient:{type:'linear',
//endPoint:{ x:0, y:1.0 }, // 1st test
//endPoint:{ x:0, y:'100%' }, // 2nd test
colors:[ {color:'white',
offset:0.0},
{color:'red',
offset:1.0} ]}
});
win1.add(view1);
win1.open();
{panel}
Expected result
A white-to-red vertical gradient box should appear at the top of the screen, but instead the box is completely red.
Additional notes
Using float values for the parameters never work: setting e.g. y=0.5 shows a completely white box. It works fine if setting is 50%.
Also, the documentation (link specified in "Problem" section) lacks the Android glyph to show that Gradient can be used on Android...it just shows iPhone, iPad, and MW glyphs.
This is a layout issue. Re-assigning to core.
PR: https://github.com/appcelerator/titanium_mobile/pull/3843
Tested with: SDK:3.1.0.v20130228145653 Studio: 3.1.0.201302252142 Device: Samsung tab(v 3.2) works as expected