Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1721] Styles: Alloy global can no longer be accessed in styles

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2020-02-25T18:37:21.000+0000
Affected Version/sAlloy 1.14.5
Fix Version/sCLI Release 8.0.0
Componentsn/a
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2020-02-20T16:25:36.000+0000
Updated2020-02-25T18:37:21.000+0000

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.Globals.color = 'blue'
<Alloy>
	<Window id="win" onClick="onClick">
		<Label text="foo"/>
	</Window>
</Alloy>
function onClick() {
	$.UI.create('Window');
}
$.win.open();
'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

Comments

  1. Ewan Harris 2020-02-20

    https://github.com/appcelerator/alloy/pull/955
  2. Ewan Harris 2020-02-20

    Alloy PR merged, should be in a preprod CLI (expecting 8.0.0-master.10) in around an hour
  3. Lokesh Choudhary 2020-02-25

    Verified the fix in CLI 8.0.0-master.10. Closing. Studio Ver: 6.0.0.201911251516 SDK Ver: 9.0.0.v20200224113949 OS Ver: 10.14.5 Xcode Ver: Xcode 11.3.1 Appc NPM: 5.0.0-2 Appc CLI: 8.0.0-master.10 Daemon Ver: 3.2.0 Ti CLI Ver: 5.2.2 Alloy Ver: 1.14.6 Node Ver: 12.13.1 NPM Ver: 6.12.1 Java Ver: 11.0.1 Android Devices: ⇨ google Pixel (Android 10) IOS Simulator: ⇨ iPhone 11 Pro iOS 13.3

JSON Source