Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6495] iOS and Android: Support for Global Vars in Styles (.tss) dropped??

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2020-02-21T10:34:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterMuhammad Ahmed Fahad
AssigneeAbir Mukherjee
Created2020-02-21T03:21:02.000+0000
Updated2020-02-21T10:34:04.000+0000

Description

Titanium SDK 9.0.0.v20200220034622 Happens in both iOS and Android Please add:
var Alloy = Alloy || require('/alloy');
to the build process in the contents of the styles folder we have styles declared as Global vars accessible via Alloy.Globals: E.g.
  bottom: Alloy.Globals.Styles.NAV_BAR_BUTTONS_BOTTOM_PADDING,
  height: Alloy.Globals.Styles.NAV_BAR_BUTTONS_HEIGHT,
  touchFeedbackColor: Alloy.Globals.Colors.CALL_TO_ACTION
We didn't notice issues whilst internally testing but later when released to Production we are capturing these JS errors:
action: create, 
bubbles: False, 
cancelBubble: False, 
column: 172, 
controller: api/mobile_app/v1/errors/reports, 
format: json, 
javascriptStack: 
ReferenceError: Alloy is not defined
    at /alloy/styles/calendar.js:1:172
    at Module._runScript (ti:/module.js:587:9)
    at Module.load (ti:/module.js:106:7)
    at Module.loadJavascriptText (ti:/module.js:436:9)
    at Module.loadAsFile (ti:/module.js:488:15)
    at Module.loadAsFileOrDirectory (ti:/module.js:410:20)
    at Module.require (ti:/module.js:245:23)
    at Module.global.Module.require (<embedded>:19311:34)
    at require (ti:/module.js:550:15)
    at Object.exports.createStyle (/alloy.js:263:1)
Please note that error occurs in: *{color:red}/alloy/styles/calendar.js:1:172{color}* which is a .tss file compiled to .js It is breaking some minor functionality in the app.

Comments

  1. Ewan Harris 2020-02-21

    [~fahad86] this is an unintended regression due to changes in SDK 9. We've fixed it in ALOY-1721and are aiming to release a CLI RC with the fix next week, you could probably workaround this yourself for now by adding the below to your alloy.js
       global.Alloy = Alloy;
       global._ = _;
       global.Backbone = Backbone;
       

JSON Source