Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1721

Styles: Alloy global can no longer be accessed in styles

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.14.5
    • Fix Version/s: CLI Release 8.0.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      SDK 9.0.0.v20200220034622

    • Story Points:
      5
    • Sprint:
      2020 Sprint 4

      Description

      Description

      SDK 9 removes the implicit global scope in app.js. We tried to handle this in ALOY-1633, but there was an oversight that the Alloy global can be used in styles which does not get touched by the babel plugin.

      We need to either figure out how we can inject Alloy if needed, or just fallback to forcing the Alloy global to exist

      Steps to reproduce

      1. Copy the below contents to the right files

      alloy.js

      Alloy.Globals.color = 'blue'
      

      views/index.xml

      <Alloy>
      	<Window id="win" onClick="onClick">
      		<Label text="foo"/>
      	</Window>
      </Alloy>
      

      controllers/index.js

      function onClick() {
      	$.UI.create('Window');
      }
      $.win.open();
      

      styles/index.tss

      'Window': {
      	backgroundColor: Alloy.Globals.color
      }
      

      2. Build for any platform/device
      3. Tap the window

      Actual

      Runtime error

      Expected

      Blue window with the label foo

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                eharris Ewan Harris
                Reporter:
                eharris Ewan Harris
                Tester:
                Lokesh Choudhary
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration