Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23338] Windows: Ti.UI.Button - Color property sets background color instead of text color

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-05-09T17:10:02.000+0000
Affected Version/sRelease 5.2.2
Fix Version/sRelease 5.3.0
Componentsn/a
Labelsqe-5.3.0
ReporterJonas Bjurhult
AssigneeChristopher Williams
Created2016-05-03T12:38:56.000+0000
Updated2016-05-10T22:42:08.000+0000

Description

According to http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Button-property-color the color property should set the text color of a button. Currently it sets and overrides any previously set backgroundColor. Example: index.xml
<Alloy>
	<Window class="container">
		<Button id="btn" onClick="doClick">Button 1</Button>
		<Button id="btn2" onClick="doClick2">Button 2</Button>
	</Window>
</Alloy>
index.tss
".container": {
	backgroundColor:"white",
	layout: 'vertical'
}

"#btn": {
	width: Ti.UI.SIZE,
	backgroundColor: "blue",
	color: "red"
}

"#btn2": {
	width: Ti.UI.SIZE,
	backgroundColor: "blue",
}
index.js
function doClick(e) {
    $.btn.color = "blue";
}

function doClick2(e) {
    $.btn2.color = "yellow";
}

$.index.open();

Comments

  1. Nazmus Salahin 2016-05-04

    Hello, I am able to reproduce this issue with given code and given step on Windows Phone. *Steps:* 1. Create an alloy project with given code for Windows Phone. 2. Build and run the app on Windows Phone. 3. Click the first button. >> Background color of the button is changed to blue. Code says:
       function doClick(e) {
       $.btn.color="blue";
       }
       
    According to documentation color property refers to text color of a Button. But in reality it is referring to background color of the button. 4. Click the second button. >> Same thing happens. Thanks *Environment*: *OS :* Microsoft Windows 8.1 Enterprise N *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  2. Christopher Williams 2016-05-09

    https://github.com/appcelerator/titanium_mobile_windows/pull/676
  3. Christopher Williams 2016-05-09

    Merged to 5_3_X, cherry-picked to master
  4. Gary Mathews 2016-05-09

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/679
  5. Josh Longton 2016-05-10

    Verified as fixed. Tested on: Nokia Lumia 928 (8.1) Windows Simulator (8.1) Microsoft Lumia 640 (10) Windows Simulator (10) Windows 10 Studio: 4.6.0.201605030516 Ti SDK: 5.3.0.v20160509143032 Appc NPM: 4.2.5-5 App CLI: 5.3.0-44 Node v0.12.7 *Closing Ticket.*

JSON Source