Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2480] Setting width to Ti.UI.SIZE in tss doesn't work for views containing label only

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-02-21T22:12:48.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
Labelsn/a
Reporterlevani
AssigneeRitu Agrawal
Created2014-02-09T09:16:56.000+0000
Updated2016-03-08T07:41:32.000+0000

Description

I have the following xml markup:
<View id="cancel" class="buttonStyle" left="7">
	<Label class="buttonLbl">something</Label>
</View>
and the following tss code in app.tss:
".buttonStyle": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	borderWidth: "0.6",
	borderColor: "white",
	borderRadius: 4,
}
".buttonLbl": {
	top: 5, bottom: 5, left: 10, right: 10,
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	touchEnabled: false,
	color: "white",
	font: {
		fontSize: 12
	}
}
As you see the width of .buttonStyle is set to Ti.UI.SIZE but I get the following result: !http://i.imgur.com/fs67jqx.png! but if I set width inside xml like this:
<View id="cancel" width="Ti.UI.SIZE" class="buttonStyle" left="7">
	<Label class="buttonLbl">something</Label>
</View>
then I get: !http://i.imgur.com/bhuaEci.png!

Comments

  1. Ritu Agrawal 2014-02-18

    I have not been able to reproduce this issue with the following environment: CLI 3.2.1 + SDK 3.2.1 + Alloy 1.3.1 I get the same behavior irrespective of if I specify width in xml file or tss file. index.js
       $.index.open();
       
    index.tss
       ".buttonStyle": {
           width: Ti.UI.SIZE,
           height: Ti.UI.SIZE,
           borderWidth: "0.6",
           borderColor: "white",
           borderRadius: 4,
       }
       ".buttonLbl": {
           top: 5, bottom: 5, left: 10, right: 10,
           width: Ti.UI.SIZE,
           height: Ti.UI.SIZE,
           touchEnabled: false,
           color: "white",
           font: {
               fontSize: 12
           }
       }
       
    index.xml
       <Alloy>
           <Window class="container" backgroundColor='black'>
           	<View id="cancel" class="buttonStyle" left="7">
           		<Label class="buttonLbl">something</Label>
       		</View>
           </Window>
       </Alloy>
       
  2. levani 2014-02-21

    I managed to solve the problem and this doesn't appear to be a bug. Please close/delete this bug report. Thanks!
  3. Ritu Agrawal 2014-02-21

    Closing based on reporters comment.

JSON Source