Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1149] iOS: Gradient array properties are converted into objects

GitHub Issuen/a
Resolution Date2014-10-02T21:15:15.000+0000
Affected Version/sAlloy 1.5.0
Fix Version/sAlloy 1.5.1
Labelsqe-3.4.0, qe-manualtest, regression
ReporterFederico Casali
AssigneeTim Poulsen


Problem description

Gradients contain properties as array, for example the 'color' property. In Alloy, those properties are now converted and passed as objects and an app is crashing if using those properties. The issue seems to be introduced after ALOY-1051 as is not reproducible using Alloy version 1.4.1 (and Alloy 1.5.0-rc3 as well - see ALOY-1146, where a regression was introduced breaking Aloy-1051), but is reproducible with Alloy 1.5.0-rc, 1.5.0-rc2 and 1.5.0-rc5. Is therefore a regression.

Steps to reproduce

1. Grab the sample code for ALOY-717 : https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-717 2. Run the sample app on iOS (any version) Result: App crashes with an "Application Error - Invalid type passed to function at alloy.js" See error log attached and screenshot. 3. Edit index.tss and comment the 'colors' property for .bgGradient class:
'.bgGradient': {
	backgroundGradient: {
		type: 'linear',
        startPoint: { x: '0%', y: '50%' },
        endPoint: { x: '100%', y: '50%' },
        // colors: [
        	// { color: 'red', offset: 0.0},
        	// { color: 'blue', offset: 0.25 },
        	// { color: 'red', offset: 1.0 }
        // ],
and run on iOS devices Result: app runs fine and no error are thrown.




  1. Tim Poulsen 2014-09-29

    PR for 1_5_X https://github.com/appcelerator/alloy/pull/579 Since arrays as members of an object seem to be the trigger for this issue, it's probably best to test with any attributes that accept arrays: Attributes that accept objects with nested arrays: * backgroundGradient * attributedString Attributes that accept arrays of strings: * emailDialog.toRecipients, ccRecipients, bccRecipients
  2. Tim Poulsen 2014-10-01

    PR merged in prep for a 1.5.1-rc release
  3. Federico Casali 2014-10-02

    Verified fixed TiSDK 3.4.0.GA Appcelerator Studio 3.4.0.GA CLI 3.4.0.GA Alloy 1.5.1-rc Xcode 6 - iPhone 5, iPhone 6 (iOS 8), Android and MobileWeb Closing.
  4. Federico Casali 2014-10-02

    Note: With this change, backgroundGradient properties will not be deep merged when using Dynamic Styles as they would be if specified in the TSS/XML files. The last style applied wins.

JSON Source