Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9824] API: backgroundGradient "colors" default value

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-06T04:41:47.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-15 API, Release 3.0.0
ComponentsTiAPI
Labelsapi, module_view, parity, qe-review, qe-testadded
ReporterJosh Roesslein
AssigneeKarl Rowley
Created2012-06-27T15:06:19.000+0000
Updated2012-09-06T04:41:47.000+0000

Description

We need to define the default behavior for when no "colors" property is specified in the backgroundGradient object. Right now on iOS if you specify no value, there will be no visible gradient. On Android not setting this property to an array causes a Java exception. We should agree on the "correct" behavior and document it.

Comments

  1. Karl Rowley 2012-07-24

    On mobile web not specifying a value also causes no visible gradient, like IOS.
  2. Karl Rowley 2012-07-25

    Pull request https://github.com/appcelerator/titanium_mobile/pull/2636
  3. Karl Rowley 2012-07-25

    Here's the test code from TIMOB-10015. Steps to reproduce (prior to the fix): (1) Remove the colors property from the code below, and run. Expected behavior: View with red/white gradient is not displayed. Actual behavior: App crashes.
       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:'100%' },
                                             colors:[ {color:'white' /*, offset:0.0*/ },
                                                      {color:'red' /*, offset:1.0*/ } ]}
                       });
       win1.add(view1);
        
       win1.open();
       
  4. Karl Rowley 2012-07-27

    If colors are not specified in a backgroundGradient, IOS, Android and mobile web behave the same way -- the view is not displayed. However, it appears that backgroundGradient does not work as expected on mobile web. The test case included in this bug causes a solid red box to be displayed in mobile web.
  5. Anshu Mittal 2012-08-31

    Verified on: SDK:2.2.0.v20120830182512 Studio:2.2.0.v20120830182512 Devices: iOS simulator, Samsung galaxy tab(android v 3.2), mobile web in browser Now, the color gradient is shown on iOS and android whereas Red color block is being shown on mobile web.
  6. Anshu Mittal 2012-09-06

    Reopening to update labels

JSON Source