Scenario description
Define a label inside a view and add the view to a tableView as headerView property.
After scrolling the tableView, the label might move outside of the view, resulting being invisible or truncated.
Sample code and step to reproduce
- Run the code below.
- Scroll up and down the tableView.
Result: the label in the headerView might move outside of the view, resulting in being invisible or truncated.
This behavior does not seems to be always reproducible, it might take two or three scrolling attempts.
Also, I've not been able to reproduce the issue if commenting out all properties from the label (except 'text' of course).
Not reproducible on 1.7.6 TiSDK
var win = Titanium.UI.createWindow({
// barColor : '#929292',
// title : 'something',
// backgroundColor : '#E7E7E7'
});
var labelPlan = Titanium.UI.createLabel({
top : 20,
// height : 56,
// left : '5%',
// left:20,
// right:10,
// right:'3%',
// width : '93.75%',
// color : '#363636',
// font : {
// fontSize : 15,
// fontWeight : 'bold',
// fontFamily : 'Helvetica Neue'
// },
text : 'testing'
});
var subView = Titanium.UI.createView({
layout : 'vertical',
top : 0,
left : 0,
height:56,
// height:Ti.UI.SIZE,
backgroundColor : 'red'
});
subView.add(labelPlan)
var dataSource=[]
for(var i=0;i<100;i++){
var row = Ti.UI.createTableViewRow({
height : 80,
//touchEnabled:false
});
var tf1 = Titanium.UI.createTextField({
color : '#336699',
height : 80,
top : 10,
left : 10,
width : 250,
hintText : 'hint' + i
});
row.add(tf1);
dataSource.push(row)
}
var menuTableView = Titanium.UI.createTableView({
separatorColor:'#e7e7e7',
data : dataSource,
backgroundColor :'#e7e7e7',
headerView:subView
});
// menuTableView.headerView=subView;
win.add(menuTableView);
win.open();
This is a layout issue. One possible workaround is to remove 'layout: vertical' from subView.
PR 2094
Tested with 2.0.2.v20120505151714 with droid 2.2.3
Re-opening to edit label