Problem description
Using Dynamic Styles classes, some properties of Picker objects are not returned correctly.
It might be related to the fix introduced for ALOY-1051 (and eventually in PR501 for ALOY-1144), as is not reproducible using Alloy 1.4.1 and 1.5.0-rc3, but is reproducible using Alloy versions 1.5.0-rc4 and 1.5.0-rc (or 1.5.0-dev).
Steps to reproduce
1. Run the attached sample code
2. Click on the 'Hello World' label and check console log
Result:
Ti.API.info(JSON.stringify($.createStyle({
classes:['test', "pickerClass"]
})));
should return:
{"type":1,"minDate":"2012-01-01T00:00:00.000Z","maxDate":"2014-05-01T19:00:00.000Z","value":"2014-04-15T19:00:00.000Z","classes":["test","pickerClass"]}
(and that is what is being returned using 1.4.1 and 1.5.0-rc3)
instead, using Alloy 1.5.0-rc or 1.5.0-rc4, it returns:
{"type":1,"minDate":{},"maxDate":{},"value":{},"classes":["test","pickerClass"]}
..
With RC4 the alert/info statements show: * the properly merged properties for the dynamic style based on the family & size classes * incompletely merged properties for the dynamic style based on the test & pickerClass classes * the properly merged properties for the dynamic style based on the test2 & viewClass classes
With RC3, the alert/info statements show: * incompletely merged properties for the dynamic style based on the family & size classes * the properly merged properties for the dynamic style based on the test & pickerClass classes * the properly merged properties for the dynamic style based on the test2 & viewClass classes
The pickerClass class would generate JavaScript Date objects, which would be evaluated when the info/alert methods are run. The
JSON.stringify()
method returnsnull
for objects with methods, which would include those Date objects. This is most likely the reason for the different output.I think there *is* an issue with Date objects, which can be fixed by:
Which can be fixed by my comment above yours.
PRs: 1_5_X -- https://github.com/appcelerator/alloy/pull/572 master -- https://github.com/appcelerator/alloy/pull/573 Functional tests: * Run the attached app & follow steps to reproduce. The app should output the expected values * Run the ALOY\-1051 test app. Clicking the label should alert the properly merged style values * Run the advanced/complex_styling app and all font styles should be properly merged and displayed
Merged PRs.
Merged PRs: Master: https://github.com/appcelerator/alloy/pull/575 1_5_X: https://github.com/appcelerator/alloy/pull/576
When I run the attached project now with alloy 1.5.0 -rc4 taken from : git://github.com/appcelerator/alloy.git#1_5_X I am able to see the following result:
Hence, able to see the expected results.
Verified fixed. TiSDK 3.4.0.v20140924140915 Appcelerator Studio 3.4.0.201409231834 CLI 3.4.0-rc4 Alloy 1.5.0-rc4 Xcode6 iPad mini & iPhone 5 (iOS 8) and Android Galaxy Nexus 4.3 Closing.
Added story points