{ "id": "162414", "key": "ALOY-1517", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "18409", "name": "Release 6.1.0", "archived": false, "released": true }, { "id": "18731", "name": "alloy 1.9.5", "archived": false, "released": true, "releaseDate": "2016-11-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-11-24T17:17:29.000+0000", "created": "2016-08-04T12:15:55.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Alloy", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2016-12-09T00:47:35.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13603", "name": "Styling", "description": "TSS, dynamic styling, styling API" } ], "description": "When I use a conditional style I know the style only applies if the conditions are met. If not, a default style will be applied. For example:\r\n\r\n*index.xml*\r\n{code:xml}\r\n\r\n{code}\r\n\r\n*index.tss*\r\n{code:javascript}\r\n\"Label[platform=ios formFactor=tablet]\":{\r\n color: \"red\"\r\n}\r\n{code}\r\n\r\nOn iPad the label will be red, but it will render as black on other devices.\r\n\r\nBut this is not the case when I’m styling a NavigationWindow for a specific platform:\r\n\r\n*index.xml*\r\n\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n*index.tss*\r\n\r\n{code:javascript}\r\n\"NavigationWindow[platform=ios formFactor=tablet]\":{}\r\n{code}\r\n\r\nLaunching the app on an iPhone, Alloy don’t create the NavigationWindow:\r\n\r\n{code:javascript}\r\n $.__views.index = Ti.UI.iOS.createNavigationWindow(function() {\r\n var o = {};\r\n Alloy.isTablet && Alloy.deepExtend(true, o, {\r\n window: $.__views.__alloyId0,\r\n id: \"index\"\r\n });\r\n return o;\r\n }());\r\n{code}\r\n\r\nThe app crash with the error message: *“Invalid type passed to function”*.\r\n\r\nWhy a style determines if create or not the element? The correct code could be:\r\n\r\n{code:javascript}\r\n $.__views.index = Ti.UI.iOS.createNavigationWindow(function() {\r\n var o = {};\r\n Alloy.isTablet && Alloy.deepExtend(true, o, {\r\n });\r\n\r\n Alloy.deepExtend(true, o, {\r\n window: $.__views.__alloyId0,\r\n id: \"index\"\r\n });\r\n return o;\r\n }());\r\n{code}", "attachment": [ { "id": "59978", "filename": "Test Navigation Window.zip", "author": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "created": "2016-08-04T12:15:19.000+0000", "size": 10474170, "mimeType": "application/zip" } ], "flagged": false, "summary": "UI elements are not created properly with formFactor property in style", "creator": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "subtasks": [], "reporter": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.11.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8.0GB\r\n\r\nNode.js\r\n Node.js Version = 0.12.7\r\n npm Version = 2.11.3\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.8\r\n node-appc Version = 0.2.31\r\n\r\nTitanium SDKs\r\n 5.3.1.GA\r\n Version = 5.3.1\r\n Install Location = /Users/jormagar/Library/Application Support/Titanium/mobilesdk/osx/5.3.1.GA\r\n Platforms = android, mobileweb, iphone\r\n git Hash = ee11b10\r\n git Timestamp = 06/09/16 01:33\r\n node-appc Version = 0.2.33\r\n 5.3.0.GA\r\n Version = 5.3.0\r\n Install Location = /Users/jormagar/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA\r\n Platforms = android, mobileweb, iphone\r\n git Hash = 94fa8af\r\n git Timestamp = 06/01/16 10:17\r\n node-appc Version = 0.2.33\r\n 5.2.2.GA\r\n Version = 5.2.2\r\n Install Location = /Users/jormagar/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA\r\n Platforms = android, mobileweb, iphone\r\n git Hash = b685ddb\r\n git Timestamp = 03/28/16 14:12\r\n node-appc Version = 0.2.33\r\n\r\nAlloy Version 1.8.7", "closedSprints": [ { "id": 751, "state": "closed", "name": "2016 Sprint 23 Tooling", "startDate": "2016-11-05T00:40:36.428Z", "endDate": "2016-11-19T01:40:00.000Z", "completeDate": "2016-11-28T03:51:25.291Z", "originBoardId": 199 } ], "comment": { "comments": [ { "id": "400932", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR: https://github.com/appcelerator/alloy/pull/808\r\n", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2016-11-14T23:08:01.000+0000", "updated": "2016-11-14T23:08:01.000+0000" }, { "id": "403049", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\nMacOS 10.12 (16A323)\r\nTi SDK 6.1.0.v20161208114813\r\nAppc NPM 4.2.8\r\nAppc CLI 6.1.0-312\r\nAlloy 1.9.5\r\nXcode 8.1 (8B62)\r\n\r\nUI Elements with a form factor set, both with and without styling defined, will be created properly. Tested by creating UI elements and setting a platform and formfactor on their style. Then built for both the specified platform/formfactor and not, with styling defined and not. All combinations had properly generated code and launched without error.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-12-09T00:47:35.000+0000", "updated": "2016-12-09T00:47:35.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }