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.
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
PR merged in prep for a 1.5.1-rc release
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.
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.