The problem
In this KitchenSink example:
https://github.com/appcelerator/KitchenSink/blob/master/Resources/examples/view_with_size.js
"size" property is used to define and manipulate view dimension values:
var view = Ti.UI.createView({
size:{
width:100,
height:100
},
backgroundColor:"red"
});
button.addEventListener('click',function() {
view.size = {width:150,height:150};
label.text = "Box should now be 150x150";
});
Expected behavior
Since "size" object's properties "width" and "height" reflect rendered view's dimension values, behavior from KitchenSink example is unintuitive and confusing. In my opinion that behavior should be removed (from KitchenSink and from SDK).
Only valid use case should be this:
var view = Ti.UI.createView({ height: '50%', width: 'auto' });
...
view.height // 50%
view.width // 'auto'
view.size.height // 200 (for example), readonly
view.size.width // 42 (for example), readonly
From documentation: "The size property is a read-only dictionary with two properties, width and height." https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.View-object
As commented, already documented. Not a bug.
I don't understand. This should be a bug, I commented that "size" property is read-only (from documentation), while in KitchenSink example there is a code that writes to that property: "view.size = {width:150,height:150};"
Invalid issue.