Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1056] Cannot set onTintColor attribute/property in XML markup

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-06-20T19:13:28.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.5.0
ComponentsXML
Labelsqe-closed-3.4.0, qe-manualtest, qe-testadded
ReporterBenjamin Hatfield
AssigneeFeon Sua Xin Miao
Created2014-06-19T21:48:24.000+0000
Updated2014-08-20T10:35:20.000+0000

Description

*Preface* Not sure if this is an Alloy bug or we should not prefix property names with "on" in the Titanium SDK. *Description* Titanium SDK 3.3.0 introduces a new property for iOS that changes the color of the button when it is switched on: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Switch-property-onTintColor When using this property in Alloy XML markup, Alloy thinks it's an event. Property works fine in TSS or Controller code. *REPRODUCTION and RESULTS* The code below fails in the simulator with this error: {noformat} [ERROR] : Script Error { [ERROR] : backtrace = "#0 () at file:///Users/bhatfield/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/4D9D3D70-9C78-4444-8A90-3C0277E07381/TestNewApis.app/alloy.js:232"; [ERROR] : line = 34; [ERROR] : message = "Can't find variable: green"; [ERROR] : name = ReferenceError; [ERROR] : sourceId = 268417408; [ERROR] : sourceURL = "file:///Users/bhatfield/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/4D9D3D70-9C78-4444-8A90-3C0277E07381/TestNewApis.app/alloy/controllers/index.js"; [ERROR] : } {noformat} *Test Case:* {noformat} {noformat}

Attachments

FileDateSize
switch_off.png2014-06-20T08:26:58.000+000034238
switch_on.png2014-06-20T08:26:58.000+000033292

Comments

  1. Tim Poulsen 2014-06-20

    Alloy assumes any XML attribute beginning with "on" are denoting event listeners. I added on manual workaround for an Android menu property that wasn't a listener. Looks like we'll have to make that more generic now that there are additional properties named with "on" that aren't used to signify event listeners.
  2. Feon Sua Xin Miao 2014-06-20

    PR: https://github.com/appcelerator/alloy/pull/457 Test app: https://github.com/feons/alloy/tree/ALOY-1056/test/apps/testing/ALOY-1056 Functional Test: 1. Compile the test app on iOS 2. onTintColor property works fine, the UI should look like attached screenshots.
  3. Tim Poulsen 2014-06-20

    PR tested and merged
  4. Priya Agarwal 2014-08-20

    Verified with: Appc Studio - 3.4.0.201408180158 SDK - 3.4.0.v20140819094113 acs - 1.0.16 alloy - 1.5.0-dev npm - 1.3.2 titanium - 3.4.0-dev titanium-code-processor - 1.1.1 OS - mavericks (v10.9.4) Xcode - 6Beta5 Device - iPhone5s(v8.0) onTintColor working as expected. Hence closing the issue

JSON Source