Problem description
On Android, 'e.source.size.height' and 'e.source.size.width' relative to a view nested inside another view, inside a tableViewRow, returns 0
Issue it's only occurring on Android. On iOS correctly returns the right values.
Sample code and steps to reproduce
var win = Ti.UI.createWindow({
backgroundColor:'gray'
});
var data = [];
var label = Ti.UI.createLabel({
text:'nel mezzo del cammin di nostra vita...'
});
var view = Ti.UI.createView({
backgroundColor:'blue',
height:Ti.UI.SIZE,
// width:Ti.UI.SIZE,
width:210
});
view.addEventListener('postlayout',function(e){
Ti.API.info('#### - ' + 'size.width: ' + e.source.size.width + ' - size.height: ' + e.source.size.height);
});
var view2 = Ti.UI.createView({
backgroundColor:'orange',
height:Ti.UI.SIZE,
// width:Ti.UI.SIZE,
width:250
});
view.add(label);
view2.add(view);
var tvr = Ti.UI.createTableViewRow({
backgroundColor:'yellow'
});
tvr.add(view2);
data.push(tvr);
var tv = Ti.UI.createTableView({
data:data
});
win.add(tv);
win.open();
Run the sample code and check the log for the 'e.source.size.width' and 'e.source.size.height' values.
Changing line 34 and just adding 'view' to the tableViewRow, then correct values are returned.
Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120827143312 Tested with Titanium Studio: 2.1.2.201208201549 Device - Android 2.2 emulator Machine OS - MAC 10.7.3
Reopening to update labels
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887