Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15751] Android: height: Ti.UI.SIZE doesn't work correctly when descendant has height: Ti.UI.FILL

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-03-14T01:08:30.000+0000
Affected Version/sRelease 3.1.3
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterLiam Mitchell
AssigneeSunila
Created2013-10-15T23:15:02.000+0000
Updated2017-03-16T21:01:14.000+0000

Description

Problem

A view with height set to Ti.UI.SIZE and fixed height children will incorrectly behave like Ti.UI.FILL *IF* the child contains its own child view with height set to Ti.UI.FILL.

Test case

var window = Ti.UI.createWindow({backgroundColor: "white"});

var dynamicHeight = Ti.UI.createView({height: Ti.UI.SIZE, backgroundColor: "yellow"});
window.add(dynamicHeight);

var fixedHeight = Ti.UI.createView({height: 100, backgroundColor: "red"});
dynamicHeight.add(fixedHeight);

var fillHeight = Ti.UI.createView({height: Ti.UI.FILL, width: "50%", backgroundColor: "blue"});
fixedHeight.add(fillHeight);

// Toggle height between fill and fixed
window.addEventListener('click', function() {
  fillHeight.height = (fillHeight.height == Ti.UI.FILL) ? 100 : Ti.UI.FILL; 
});

window.open();
Expected: dynamicHeight should be the same size as its fixed height child. Actual: dynamicHeight fills the screen.

Workaround

Don't use FILL anywhere inside a SIZE if you value your sanity.

Comments

  1. Sunila 2013-12-09

    If one of the parents is fixed height or width, do not consider for fill conflict. https://github.com/appcelerator/titanium_mobile/pull/5099
  2. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source